Skip to content

Instantly share code, notes, and snippets.

@turanct
turanct / Main.hs
Created July 3, 2017 13:45
Query Parser
import Text.ParserCombinators.Parsec
data Query = And Query Query
| Or Query Query
| Not Query
| Statement String deriving (Show)
andParser = do
arg1 <- statementParser
string " AND "
@turanct
turanct / REPLinatweet.php
Created October 7, 2014 06:24
a PHP REPL in a tweet
<?php
while(1){echo"> ";$i=rtrim(stream_get_line(STDIN,512,PHP_EOL),';');try{@eval('print_r('.$i.');');}catch(Exception$e){print_r($e);}echo"\n";}
@turanct
turanct / hangman.scm
Last active March 10, 2021 02:02
The Hangman game in Guile Scheme (lisp)
#!/usr/bin/env guile -s
!#
(use-modules
(srfi srfi-1)
(ice-9 rdelim))
(define words-path "words.txt")
(define random-word-from-file
@turanct
turanct / game-of-life.scm
Last active October 28, 2021 16:56
Super simple Conway's game of life in scheme
(define create-coord
(lambda (x y)
(list x y)))
(define get-x
(lambda (coord)
(car coord)))
(define get-y
(lambda (coord)