I hereby claim:
- I am shonfeder on github.
- I am shonfeder (https://keybase.io/shonfeder) on keybase.
- I have a public key ASBDCrS3OyOBp9UsG6Hfu6NSm0zYEubj7ErZJjNSRyqe7wo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
maybe(just(_)). | |
maybe(nothing). | |
bind(nothing, _, nothing). | |
bind(just(A), P, M) :- call(P, A, M), | |
maybe(M). | |
return(X, just(X)). | |
maybe_div(_,0,nothing) :- !. |
class (Enum a, Bounded a, Eq a) => Cyclical a where | |
next :: a -> a | |
next a = if a == maxBound then minBound else succ a | |
prev :: a -> a | |
prev a = if a == minBound then maxBound else pred a | |
data Direction = North | East | South | West | |
deriving (Show, Enum, Bounded, Eq) | |
instance Cyclical Direction |
(* either turn left (L) or right (R) 90 degrees, then walk forward the given number of blocks, ending at a new intersection. *) | |
(* Relative *) | |
datatype relative_direction = L | R | |
type distance = int | |
datatype instruction = Inst of relative_direction * distance | |
fun dirFromChar c = case c of #"L" => L | |
| #"R" => R |