function fix(m,F) return fn f|n| if n not in m then m[n] = F(f,n) end return m[n] end end Lazy = table(Type,"Lazy"){ function string "lazy expression" end, function value if self.x is null x = self.f() self.x = x return x else return self.x end end } function lazy(f) return table Lazy{f=f,x=null} end Function.add = |f;g| |x| f(x)+g(x) Function.sub = |f;g| |x| f(x)-g(x) Function.mul = |f;g| |x| f(x)*g(x) Function.div = |f;r| |x| f(x)/r Function.rmul = |r;f| |x| r*f(x)