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
number = do w <- whole | |
return $ Number $ read w | |
<|> do f <- fraction | |
return $ Number $ read ('0':f) | |
<|> do w <- whole | |
f <- fraction | |
return $ Number $ read (w ++ f) | |
where whole = many1 digit | |
fraction = do char '.' | |
a <- many1 digit |
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
term = try prefix <|> try paren <|> try name <|> try number <|> try str <?> "term" | |
prefix = do o <- prefixOper | |
t <- term | |
return $ Unary o t | |
prefixOper = token $ many1 $ oneOf $ nub $ concat prefixes | |
prefixes :: [String] | |
prefixes = [ "!" |
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
... | |
[ 19 of 125] Compiling Yi.Prelude ( Yi/Prelude.hs, dist/build/Yi/Prelude.o ) | |
Yi/Prelude.hs:182:9: | |
Duplicate instance declarations: | |
instance Category Accessor.T -- Defined at Yi/Prelude.hs:182:9-38 | |
instance Category Accessor.T | |
-- Defined in data-accessor-0.2.1:Data.Accessor.Private | |
cabal: Error: some packages failed to install: | |
yi-0.6.1 failed during the building phase. The exception was: |
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
tokenBase = token showTok posFromTok | |
where showTok (p, t) = show t | |
posFromTok (p, t) = p | |
match x = tokenBase testTok | |
where testTok (p, t) = if t == x then Just t else Nothing | |
advance = tokenBase testTok | |
where testTok (p, t) = Just t |
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
module BFLike | |
(run, interpret, tobc, eval) where | |
import Data.Char | |
qqq :: (a, b, c) -> d -> (a, b, c, d) | |
qqq (a, b, c) d = (a, b, c, d) | |
run' :: ([Char], [Int], Int) -> Int -> ([Char], [Int], Int) | |
run' (value, state, ptr) inst = |
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
module BF (run, Memory, Command) where | |
import Data.Char | |
data Memory = Memory [Integer] Integer [Integer] | |
empty = Memory [0,0..] 0 [0,0..] | |
type Command = Char | |
run :: [Commmand] -> (Memory, String) |
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
(defclass rock ()()) | |
(defclass paper ()()) | |
(defclass scissors ()()) | |
(defgeneric r-p-s (a b)) | |
(defmethod r-p-s ((r rock) (p paper)) 'paper) | |
(defmethod r-p-s ((r rock) (s scissors)) 'rock) | |
(defmethod r-p-s ((p paper) (s scissors)) 'scissors) |
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
a(); | |
b(); | |
#----------------# A random division in the routine is created here. | |
c(d for.each()); # This is very unintuitive. | |
e(); # | |
f(); # |
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
request ↼ server listen() | |
print("how many times is this printed") | |
print(request address, request port) | |
#-------- | |
display ↼ routine { print(@ address, @ port) } | |
request ↼ server listen() | |
print("how many times is this printed") | |
display(request) |
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
test <- { print("hi."); print(@1); print("hi again."); } | |
a <- b each | |
test(a) |
OlderNewer