std: add map/lookup-or-do
Fix loop bug in assertNoRec
Fixes bad test "data-direct-recursion-loop-bug.carth".
It now properly reports the error instead of looping forever.
Add test case for loop bug related to recursive data
std: make abs & sign work for all numeric types
add .stan.toml to ignore certain lints by default
feature: type aliases
(type Name String)
(type Age Nat)
(type (Person additional-details)
[Name Age additional-details])
std: Remove module net
We'll look into it and the rest of std when the selfhosted compiler is
done or dead.
std: Remove IO monad, for now
We really need at least HKT for it to be practical, and even then I'd
rather have an effect system and use that.
Update README & TODO. Carth is no longer (attempting to be) pure!
(until we've added effects, I think)
change syntax from defvar to def
Now defun reads as a contraction of def and fun.
(def twice (fun [f x] (f (f x))))
(defun twice [f x] (f (f x)))
Print backtrace on panic if --debug is set
Compile the following with "--debug" and run
(defvar main (io/wrap (foo Unit)))
(defun foo [Unit] (bar Unit))
(defun bar [Unit] (panic "oops"))
You will get an output like
*** Panic: oops
3: panic :of (Fun [Str] Unit)
2: bar :of (Fun [Unit] Unit)
1: foo :of (Fun [Unit] Unit)
Nice -- way more convenient than having nothing!
It is still quite limited though.
- You only get the function name and type, not source position.
- Only named carth functions show up. Generated ones & externs don't.
- It probably costs quite a bit of performance. Each push to the
backtrace requires a heap allocation.
std: fix parse/lift2 & add str=
error msg on unexpected de Bruijn index
Add syntax sugar for lambdas, De Bruijn notation
\(+ # 5)
is now equivalent to
(fun [x] (+ x 5))
and same goes for
(fun [x] [x x])
Change syntax of Fun type to match changes to fun expr
Now they all match
(defun add [a b ] (+ a b))
(fun [a b ] (+ a b))
(Fun [Int Int] Int)