100 doors: Difference between revisions

Content deleted Content added
Dirk (talk | contribs)
m Fixed ultra optimized Python version
Langurmonkey (talk | contribs)
Line 7,868: Line 7,868:
=={{header|langur}}==
=={{header|langur}}==
=== not optimized ===
=== not optimized ===
<syntaxhighlight lang="langur">var .doors = [false] * 100
{{works with|langur|0.8}}
<syntaxhighlight lang="langur">var .doors = [false] x 100


for .i of .doors {
for .i of .doors {
Line 7,880: Line 7,879:


Or, we could use the foldfrom() function to produce the output.
Or, we could use the foldfrom() function to produce the output.
<syntaxhighlight lang="langur">writeln foldfrom(f if(.b: .a~[.c]; .a), [], .doors, series 1..len .doors)</syntaxhighlight>
<syntaxhighlight lang="langur">writeln foldfrom(fn(.a, .b, .c) if(.b: .a~[.c]; .a), [], .doors, series 1..len .doors)</syntaxhighlight>


=== optimized ===
=== optimized ===
<syntaxhighlight lang="langur">writeln map(f .x ^ 2, series 1..10)</syntaxhighlight>
<syntaxhighlight lang="langur">writeln map fn{^2}, 1..10</syntaxhighlight>

{{works with|langur|0.8.11}}
<syntaxhighlight lang="langur">writeln map f{^2}, 1..10</syntaxhighlight>


{{out}}
{{out}}