Jump to content

100 doors: Difference between revisions

127 bytes removed ,  3 months ago
m (Fixed ultra optimized Python version)
Line 7,868:
=={{header|langur}}==
=== not optimized ===
<syntaxhighlight lang="langur">var .doors = [false] x* 100
{{works with|langur|0.8}}
<syntaxhighlight lang="langur">var .doors = [false] x 100
 
for .i of .doors {
Line 7,880 ⟶ 7,879:
 
Or, we could use the foldfrom() function to produce the output.
<syntaxhighlight lang="langur">writeln foldfrom(ffn(.a, .b, .c) if(.b: .a~[.c]; .a), [], .doors, series 1..len .doors)</syntaxhighlight>
 
=== optimized ===
<syntaxhighlight lang="langur">writeln map(f .x fn{^ 2}, series 1..10)</syntaxhighlight>
 
{{works with|langur|0.8.11}}
<syntaxhighlight lang="langur">writeln map f{^2}, 1..10</syntaxhighlight>
 
{{out}}
1,007

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.