src/Metaprogramming.jl

changeset 37
f8be66557e0f
parent 35
d881275c6564
equal deleted inserted replaced
36:6dfa8001eed2 37:f8be66557e0f
33 `foldl_exprs(f, a)` 33 `foldl_exprs(f, a)`
34 34
35 Does `foldl` on the `Expr`s in `a` with the `f`, a `Function` or another `Expr` 35 Does `foldl` on the `Expr`s in `a` with the `f`, a `Function` or another `Expr`
36 representing a function. Returns new `Expr` with the expanded `foldl` operation. 36 representing a function. Returns new `Expr` with the expanded `foldl` operation.
37 """ 37 """
38 function foldl_exprs(f :: Expr, a) 38 function foldl_exprs(f :: Union{Expr,Symbol}, a)
39 return foldl((b, c) -> :($f($b, $c)), a) 39 return foldl((b, c) -> :($f($b, $c)), a)
40 end 40 end
41 41
42 function foldl_exprs(f :: Function, a) 42 function foldl_exprs(f :: Function, a)
43 return foldl((b, c) -> :($(f(b, c))), a) 43 return foldl((b, c) -> :($(f(b, c))), a)

mercurial