This file contains hidden or 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
| ;; 従来のcard matcherをregular-card matcherにリネーム | |
| (define $regular-card | |
| (algebraic-data-matcher | |
| {<card suit (mod 13)>})) | |
| ;; Joker入りcard matcher | |
| ;; (,<Joker>みたいなvalue typeは考えてない | |
| ;; 欲しけりゃプリミティブパターン節を一個追加すればいいと思うけど未検証) | |
| (define $card | |
| (matcher |
This file contains hidden or 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
| [<cons <card _ $n> | |
| <cons <card _ ,(- n 1)> | |
| <cons <card _ ,(- n 2)> | |
| <cons <card _ ,(- n 3)> | |
| <cons <card _ (& ?(lt? $ 11) ,(- n 4))> ;; ここだけ修正: ,(- n 4) → (& ?(lt? $ 11) ,(- n 4)) | |
| <nil>>>>>> | |
| <Straight>] |
This file contains hidden or 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
| nat(0). | |
| nat(X1) :- nat(X), X1 is X + 1. | |
| pair_of_nats(X, Y) :- nat(X), nat(Y). | |
| (0 step) | |
| pair_of_nats(X, Y). | |
| (1 step) | |
| nat(X), nat(Y). |
This file contains hidden or 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
| data T a = T {element :: a, element2 :: a, element3 :: String} deriving (Show) | |
| class F a where | |
| mes :: a -> String | |
| instance F Int where mes _ = "Int" | |
| instance F Double where mes _ = "Double" | |
| mkDefaultT :: (F a, Num a) => a -> T a | |
| mkDefaultT x = T x x (mes x) |
This file contains hidden or 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
| function solve(t,n){return ("0".repeat(n)+(t^t>>1).toString(2)).slice(-n)} |
This file contains hidden or 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
| import Control.Arrow | |
| import Data.List | |
| clockwise :: (Int, Int) -> (Int, Int) -> (Int, Int) -> Bool | |
| clockwise (x1, y1) (x2, y2) (x3, y3) = (x1 - x2) * (y3 - y2) - (x3 - x2) * (y1 - y2) < 0 | |
| -- Graph == [(Int, Int)] | |
| convexHull :: Graph -> Graph | |
| convexHull = (uncurry (++)) . (upperHalf &&& lowerHalf) . sort | |
| where |
OlderNewer