Skip to content

Commit

Permalink
Minor changes to iter standard module
Browse files Browse the repository at this point in the history
  • Loading branch information
bamless committed Dec 6, 2023
1 parent 6f52f72 commit 2390bc4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Binary file modified src/lib/core/iter.jsc
Binary file not shown.
14 changes: 10 additions & 4 deletions src/lib/core/iter.jsr
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ class Iterable
return sum(this, start)
end

fun any(predicate)
fun any(predicate=null)
return any(this, predicate)
end

fun all(predicate)
fun all(predicate=null)
return all(this, predicate)
end

Expand Down Expand Up @@ -298,7 +298,10 @@ fun sum(iterable, start=0)
return res
end

fun any(iterable, predicate)
fun any(iterable, predicate=null)
if !predicate
predicate = |e| => e
end
for var e in iterable
if predicate(e)
return true
Expand All @@ -307,7 +310,10 @@ fun any(iterable, predicate)
return false
end

fun all(iterable, predicate)
fun all(iterable, predicate=null)
if !predicate
predicate = |e| => e
end
for var e in iterable
if !predicate(e)
return false
Expand Down

0 comments on commit 2390bc4

Please sign in to comment.