Skip to content

Instantly share code, notes, and snippets.

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
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 = [ "!"
...
[ 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:
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
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 =
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)
(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)
a();
b();
#----------------# A random division in the routine is created here.
c(d for.each()); # This is very unintuitive.
e(); #
f(); #
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)
test <- { print("hi."); print(@1); print("hi again."); }
a <- b each
test(a)