Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import "prelude.eg"
- using System
- using List
- data open, closed
- def toggle =
- [ open N -> closed N | closed N -> open N ]
- def doors =
- [ N -> map [ N -> closed N ] (fromto 1 N) ]
- def toggleK =
- [ K, nil -> nil
- | K, cons (D N) DD ->
- let DOOR = if (N%K) == 0 then toggle (D N) else D N in
- cons DOOR (toggleK K DD) ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement