Merge pull request #135 from aeternity/radrow-patch-3
Remove find_all from stdlib
This commit is contained in:
commit
6d87960147
@ -23,11 +23,6 @@ namespace List =
|
|||||||
[] => None
|
[] => None
|
||||||
h::t => if(p(h)) Some(h) else find(p, t)
|
h::t => if(p(h)) Some(h) else find(p, t)
|
||||||
|
|
||||||
function find_all(p : 'a => bool, l : list('a)) : list('a) = find_all_(p, l, [])
|
|
||||||
private function find_all_(p : 'a => bool, l : list('a), acc : list('a)) : list('a) = switch(l)
|
|
||||||
[] => reverse(acc)
|
|
||||||
h::t => find_all_(p, t, if(p(h)) h::acc else acc)
|
|
||||||
|
|
||||||
function find_indices(p : 'a => bool, l : list('a)) : list(int) = find_indices_(p, l, 0, [])
|
function find_indices(p : 'a => bool, l : list('a)) : list(int) = find_indices_(p, l, 0, [])
|
||||||
private function find_indices_( p : 'a => bool
|
private function find_indices_( p : 'a => bool
|
||||||
, l : list('a)
|
, l : list('a)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user