Filter: Difference between revisions
→{{header|langur}}
m (→{{header|Sidef}}: updated code) |
Langurmonkey (talk | contribs) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 1,566:
auto array := new int[]{1,2,3,4,5};
var evens := array.filterBy::(n => n.mod
evens.forEach
}</syntaxhighlight>
Using strong typed collections and extensions:
Line 1,581:
array
.filterBy::(int n => n.mod
.forEach::(int i){ console.printLine(i) }
}</syntaxhighlight>
{{out}}
Line 2,388:
=={{header|langur}}==
Using the filter() function filters by a function or regex and returns
▲<syntaxhighlight lang="langur">val .arr = series 7
writeln "
writeln "filtered: ", filter
</syntaxhighlight>
{{out}}
<pre>
filtered: [2, 4, 6]</pre>
|