mirror of
https://github.com/peklaiho/madlisp.git
synced 2024-11-22 21:35:03 +00:00
add contains? function for collections
This commit is contained in:
parent
adc59073a1
commit
8f4edd2106
@ -72,6 +72,10 @@ class Collections implements ILib
|
|||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$env->set('contains?', new CoreFunc('contains?', 'Return true if first argument (collection) contains the second argument. Use optional third argument for strict comparison.', 2, 3,
|
||||||
|
fn (Seq $a, $b, bool $strict = false) => in_array($b, $a->getData(), $strict)
|
||||||
|
));
|
||||||
|
|
||||||
$env->set('get', new CoreFunc('get', 'Get the item from first argument (collection) by using the second argument as index or key.', 2, 2,
|
$env->set('get', new CoreFunc('get', 'Get the item from first argument (collection) by using the second argument as index or key.', 2, 2,
|
||||||
fn (Collection $a, $b) => $a->get($b)
|
fn (Collection $a, $b) => $a->get($b)
|
||||||
));
|
));
|
||||||
|
Loading…
Reference in New Issue
Block a user