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
{-# LANGUAGE RecordWildCards, Arrows #-} | |
import Numeric | |
import Data.Char | |
import Control.Monad | |
import Data.Monoid ((<>)) | |
import Data.List (nub, sort, reverse) | |
data RepeatBounds = RB |
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
extern crate regex; | |
#[derive(Debug)] | |
enum GrammarItem { | |
F(String), | |
L(String), | |
R(String), | |
Digits(String), | |
Other(String), | |
} |
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 precog.macro.ValueClass; | |
class ABC implements ValueClass { | |
var a: Int; | |
var b: Bool; | |
var c: String; | |
} | |
/* | |
class ABC extends ValueClass { |
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 js.Browser.*; | |
import js.html.CanvasElement; | |
import js.html.CanvasRenderingContext2D; | |
import js.html.HTMLDocument; | |
import js.html.MouseEvent; | |
import sf.test.Test.Entity; | |
/** | |
* @author YellowAfterlife | |
* http://yal.cc/top-down-bouncing-loot-effects/ |
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
numbers :: [Int] | |
numbers = zip [1, 2, 3] [4, 5, 6] | |
main :: IO () | |
main = print numbers | |
-- Output: [(1,4), (2,5), (3,6)] |
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
//Lisp interpreter in 90 lines of C++ | |
//I've enjoyed reading Peter Norvig's recent articles on Lisp. He implements a Scheme interpreter in 90 lines of Python in the first, and develops it further in the second. | |
//Just for fun I wondered if I could write one in C++. My goals would be | |
//1. A Lisp interpreter that would complete Peter's Lis.py test cases correctly... | |
//2. ...in no more than 90 lines of C++. | |
//Although I've been thinking about this for a few weeks, as I write this I have not written a line of the code. I'm pretty sure I will achieve 1, and 2 will be... a piece of cake! |
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
(ns particles.core) | |
(def display (.getElementById js/document "display")) | |
(def context (.getContext display "2d")) | |
(def damping 0.999) | |
(def max-particles 250) | |
(def line-width 2) | |
(def app-state (atom {:width (.-innerWidth js/window) | |
:height (.-innerHeight js/window)})) |
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
Lisp interpreter in 90 lines of C++ | |
I've enjoyed reading Peter Norvig's recent articles on Lisp. He implements a Scheme interpreter in 90 lines of Python in the first, and develops it further in the second. | |
Just for fun I wondered if I could write one in C++. My goals would be | |
1. A Lisp interpreter that would complete Peter's Lis.py test cases correctly... | |
2. ...in no more than 90 lines of C++. | |
Although I've been thinking about this for a few weeks, as I write this I have not written a line of the code. I'm pretty sure I will achieve 1, and 2 will be... a piece of cake! |
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
http://ianlunn.co.uk/articles/quickly-showhide-hidden-files-mac-os-x-mavericks/ |
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
; http://www.algolist.com/Dijkstra's_algorithm | |
(defn dijkstra [g src] | |
(loop [dsts (assoc (zipmap (keys g) (repeat nil)) src 0) | |
curr src | |
unvi (apply hash-set (keys g))] | |
(if (empty? unvi) | |
dsts | |
(let [unvi (disj unvi curr) | |
nextn (first (sort-by #(% dsts) unvi)) |
NewerOlder