Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Yonaba/Moses.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYonaba <roland.yonaba@gmail.com>2018-09-16 05:18:27 +0300
committerYonaba <roland.yonaba@gmail.com>2018-09-16 05:18:27 +0300
commit14171d243b76c845c3a9001aee1a0e9d2056f95e (patch)
tree7cca91a6de09ccee2518bb5149aaf9ff92ab6879
parent6c631261135c1f66223863e6bd469ed9b1b11277 (diff)
Fixed issue with zipping false valuesMoses-2.1.0-1
-rw-r--r--moses.lua2
-rw-r--r--moses_min.lua2
-rw-r--r--spec/array_spec.lua1
3 files changed, 3 insertions, 2 deletions
diff --git a/moses.lua b/moses.lua
index ffdaeb0..eef3534 100644
--- a/moses.lua
+++ b/moses.lua
@@ -1475,7 +1475,7 @@ function M.zip(...)
for i = 1,n do
if not _ans[i] then _ans[i] = {} end
for k, array in ipairs(args) do
- if array[i] then _ans[i][#_ans[i]+1] = array[i] end
+ if (array[i]~= nil) then _ans[i][#_ans[i]+1] = array[i] end
end
end
return _ans
diff --git a/moses_min.lua b/moses_min.lua
index e2117cb..feba2ca 100644
--- a/moses_min.lua
+++ b/moses_min.lua
@@ -258,7 +258,7 @@ function S1wg_DG.zip(...)local cdxFVpZw={...}
local Y=S1wg_DG.max(cdxFVpZw,function(BuX1r)return#BuX1r end)local o9Uh={}
for Wyf83f2=1,Y do if not o9Uh[Wyf83f2]then o9Uh[Wyf83f2]={}end
for P0olj,z in
-kyWtqIf0(cdxFVpZw)do if z[Wyf83f2]then
+kyWtqIf0(cdxFVpZw)do if(z[Wyf83f2]~=nil)then
o9Uh[Wyf83f2][#o9Uh[Wyf83f2]+1]=z[Wyf83f2]end end end;return o9Uh end
function S1wg_DG.zipWith(EHCCkt,...)local x={...}
local xNWVmS=S1wg_DG.max(x,function(Pkis6H28)return#Pkis6H28 end)local kGWnkgDu={}for tSE=1,xNWVmS do
diff --git a/spec/array_spec.lua b/spec/array_spec.lua
index 6e618ad..e69e8da 100644
--- a/spec/array_spec.lua
+++ b/spec/array_spec.lua
@@ -598,6 +598,7 @@ describe('Array functions specs', function()
it('zips together values from different arrays sharing the same index', function()
local names = {'Bob','Alice','James'}; local ages = {22, 23}
assert.is_true(M.isEqual(M.zip(names,ages),{{'Bob',22},{'Alice',23},{'James'}}))
+ assert.is_true(M.isEqual(M.zip({false},{false}),{{false,false}}))
end)
end)