21 lines
384 B
Text
21 lines
384 B
Text
(import std.Range :range :forEach)
|
|
(import std.List)
|
|
|
|
(mut doors (list:fill 100 false))
|
|
(let r (range 0 100))
|
|
|
|
(forEach r
|
|
(fun (i) {
|
|
(mut j i)
|
|
(while (< j 100) {
|
|
(@= doors j (not (@ doors j)))
|
|
(set j (+ j i 1)) })
|
|
(print doors) }))
|
|
|
|
(print
|
|
(list:map
|
|
(list:filter
|
|
(list:zipWithIndex doors)
|
|
(fun (e)
|
|
(@ e 1)))
|
|
(fun (e) (@ e 0))))
|