Skip to content

Instantly share code, notes, and snippets.

View bixuanzju's full-sized avatar
🎯
Focusing

Xuan Bi bixuanzju

🎯
Focusing
View GitHub Profile
@bixuanzju
bixuanzju / sml.el
Last active December 25, 2015 11:39
For Coursera
(defun isml ()
"If sml repl exists, then restart it else create a new repl."
(interactive)
(when (get-buffer "*sml*")
(with-current-buffer "*sml*"
(when (process-live-p "sml")
(comint-send-eof)))
(sleep-for 0.2))
(sml-run "sml" ""))
@bixuanzju
bixuanzju / church-encoding.hs
Last active November 10, 2017 05:30
church-encoding
{-# LANGUAGE RankNTypes #-}
newtype BST k v = Roll
{ unroll :: forall r. r -> (k -> v -> r -> r -> r) -> r
}
-- Two constructors
leave :: BST k v
leave = Roll const