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
(defun eval (e env) | |
(cond ((symbolp e) (cadr (assoc e env))) | |
((eql (car e) 'lambda) (cons e env)) | |
(t (apply (eval (car e) env) (eval (cadr e) env))))) | |
(defun apply (f x) | |
(eval (cddr (car f)) (cons (list (cadr (car f)) x) (cdr f)))) | |
;; CL-USER> (eval '(((lambda (f) (lambda (x) (f x))) (lambda (a) a)) (lambda (b) b)) '()) | |
;; ((LAMBDA (B) B)) |
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
module Parser where | |
import Text.ParserCombinators.Parsec hiding (token) | |
data Sexp = List [Sexp] | Atom String deriving (Show) | |
sexps :: Parser [Sexp] | |
sexps = sexp `sepBy` listSeparator | |
sexp :: Parser Sexp |
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
import Control.Monad | |
import Control.Monad.State | |
import Data.Array.Unboxed | |
import Data.Word | |
import Data.Char | |
import qualified Data.Map as M | |
import Data.Ix | |
data Bf = Bf { getArray :: UArray Int Word8 | |
, getPointer :: Int |
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
import Data.Map as M hiding (map) | |
import Data.Set as S hiding (map) | |
import Data.Maybe (catMaybes) | |
type State = Int | |
type Input = Char | |
data DFA = DFA { getEdges :: Map (State, Input) State | |
, getAcceptingStates :: Set State | |
} |
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
--- /home/sinan/Downloads/glapse-0.3/glapseControllers/glapseMain.py 2011-06-24 19:16:45.000000000 +0300 | |
+++ /home/sinan/opt/glapse/glapseControllers/glapseMain.py 2012-04-21 13:57:06.864076116 +0300 | |
@@ -47,7 +47,6 @@ | |
self.outputDir = output | |
self.quality = quality | |
self.interval = interval | |
- self.currentShot = 0 | |
# Start a thread to take screenshots | |
self.done = False |
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
{ | |
module Main (main) where | |
import Control.Monad.IO.Class (liftIO) | |
} | |
%wrapper "monad" | |
$whitespace = [\ \b\t\n\f\v\r] |
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
{-# OPTIONS_GHC -Wall #-} | |
module Lexer where | |
import Prelude hiding (lex) | |
import Control.Monad.State | |
import qualified Data.Set as S | |
import Char (toLower) | |
data LexemeClass | |
= LLParen |
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
function makeThunk(f, args) | |
return { tag = "thunk", f = f, args = args } | |
end | |
function evalThunk(t) | |
return t.f(unpack(t.args)) | |
end | |
function cons(first, rest) | |
return { first = first, |
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
(type (tree a b) | |
Leaf | |
(Node (a (list b)) (tree a b) (tree a b))) | |
(type (maybe a) | |
Nothing | |
(Just a)) | |
(define empty Leaf) |
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
test.hs:20:8: | |
Couldn't match expected type `Parser | |
(MemoTable[a1AV] str0) str0 s0 t0' | |
with actual type `Language.Haskell.TH.Syntax.Q | |
Language.Haskell.TH.Syntax.Exp' | |
In the return type of a call of `Language.Haskell.TH.Syntax.lift' | |
In the expression: Language.Haskell.TH.Syntax.lift Nothing | |
In a case alternative: | |
Nothing -> Language.Haskell.TH.Syntax.lift Nothing |