>>13
No code online yet, only random samples up to a year old lying around across machines (so “stole” wasn't exactly the correct word).
Random sample:
; # Ad-hoc polymorphism
; ((+ 1) 2)
(def (∷ + ; The type of + is such that
(⇒ (∷ + (→ (Int . α) β))) ; type variable α is limited to the possible futher arguments of +
; after it has taken an int and β is limited to the possible
; return values of + after (Int . β) has been applied.
(→ (Int) (→ α β))) ; And it takes an int and returns a function of type α to β
(n) (λ x (+ n . x)))) ; Not sure if the above is inferable from this…
; (+ 1 2)
(def (∷ + (→ (Int Int) Int)) ; Plain add two ints.
(a b) (:+ a b)) ; :+ is the primitive plus.
; (+ 1 2 3 4)
(def (∷ + (→ [Int] Int)) ; From a homogenous list of Ints to another Int
x (foldl + 0 x)) ; This reuses the previous definition of +.
Or something like that. I've been thinking about actually starting work on an interpreter lately.