aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2017-10-08 09:40:52 -0300
committerHisham Muhammad <hisham@gobolinux.org>2017-10-08 09:40:52 -0300
commitfa91718c540542d94e8bf7df94e9fdf0cd170569 (patch)
treef7dddfe6a589d67508f872bcf3ec8504ad978b50
parent49fdc6e080637fd9e5d8a9ae355fa06510cb68ee (diff)
downloadluarocks-fa91718c540542d94e8bf7df94e9fdf0cd170569.tar.gz
luarocks-fa91718c540542d94e8bf7df94e9fdf0cd170569.tar.bz2
luarocks-fa91718c540542d94e8bf7df94e9fdf0cd170569.zip
fun: make function argument the last one
Use an order that works better with the Lua function syntax.
-rw-r--r--src/luarocks/fun.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/luarocks/fun.lua b/src/luarocks/fun.lua
index e8e0c6bb..a4dc6840 100644
--- a/src/luarocks/fun.lua
+++ b/src/luarocks/fun.lua
@@ -23,7 +23,7 @@ function fun.contains(xs, v)
23 return false 23 return false
24end 24end
25 25
26function fun.map(f, xs) 26function fun.map(xs, f)
27 local rs = {} 27 local rs = {}
28 for i = 1, #xs do 28 for i = 1, #xs do
29 rs[i] = f(xs[i]) 29 rs[i] = f(xs[i])
@@ -31,10 +31,10 @@ function fun.map(f, xs)
31 return rs 31 return rs
32end 32end
33 33
34function fun.traverse(f, t) 34function fun.traverse(t, f)
35 return fun.map(function(x) 35 return fun.map(t, function(x)
36 return type(x) == "table" and fun.traverse(f, x) or f(x) 36 return type(x) == "table" and fun.traverse(x, f) or f(x)
37 end, t) 37 end)
38end 38end
39 39
40return fun 40return fun