using Symata # load Symata and enter Symata mode f(x_) := x^2 f(2) [f(x+y), f("dog"), f(2.0)] ClearAll(f) # remove the definition for `f` fib(1) := 1 fib(2) := 1 fib(n_) := fib(n-1) + fib(n-2) fib(10) addone(x_) := (a = 1, x + a) addone(y) a g(x_) := Module([c,d],(c=1,d=3,a+d+x)) # local variables are lexically scoped. g(z) [c,d] gt5(x_) := x > 5 g(x_Float`gt5`) := 1 g(10.0) # The conditions in the new definition are satisfied by 10.0 [g(4.0), g(10), g(q + r)] # The definition using `Module` applies here h(x_^2) := x [h(r^2), h(r^3), h((r+q)^2), h(Expand((r+q)^2)), 4 , 2] FullForm(r^2) ClearAll(f,h,a) g(x_Symbol, p__Integer) := Apply(Plus, x^[p]) g(y,1,4,7,10) Apply(ClearAll, UserSyms()) f(x_) := x^2 g(x_) = x^2 x = 3 h(x_) = x^2 j(x_) := x^2 [f(a), g(a), h(a), j(a)] Map(DownValues, [f,g,h,j]) ClearAll(f,g,h,j,x) # clear the symbols used in this example 1; ClearAll(g,h,a,b) # J(expr) interprets expr as Julia code f = J((x) -> x^2 ) ; f(3) f("dog") # This calls the Julia function, so we get what "dog"^2 means in Julia f(a+b) Function(x, x^2)(a) (x -> x^2)(a) ([x,y] -> x^2 + y^2)(3,4) VersionInfo() InputForm(Now())