Last active
June 6, 2020 18:25
-
-
Save egisatoshi/225c59499563f7cd0abf029279e4145c to your computer and use it in GitHub Desktop.
(require Egison version 4.0.1) https://www.nikoli.co.jp/ja/puzzles/suiri_puzzle/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
concat (matchAll (["akira", "susumu", "tamotsu", "tomo"], ["blue", "green", "red", "white"], [1, 2, 3, 4]) | |
as (list something, multiset something, multiset something) with | |
| ([$x_1, $x_2, $x_3, $x_4], [$y_1, $y_2, $y_3, $y_4], [$z_1, $z_2, $z_3, $z_4]) | |
-> matchAll [(x_1, y_1, z_1), (x_2, y_2, z_2), (x_3, y_3, z_3), (x_4, y_4, z_4)] | |
as set (eq, eq, eq) with | |
| (#"akira", #"blue", !#1) :: | |
(#"susumu", !#"green", !#4) :: | |
(_, #"red", #2) :: | |
(_, #"white", $n) :: | |
(#"tamotsu", _, #(n - 1)) :: _ | |
-> [(x_1, y_1, z_1), (x_2, y_2, z_2), (x_3, y_3, z_3), (x_4, y_4, z_4)]) | |
-- [[("akira", "blue", 4), ("susumu", "white", 3), ("tamotsu", "red", 2), ("tomo", "green", 1)]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment