~jojo/Carth

ref: 749208029494a7c48ce04444a513424f4b998416 Carth/std/math.carth -rw-r--r-- 909 bytes
Add example list-monad to demo macro features & the do macro
std: Add sum
std: Make divisible? work on other integer types as well
std: Woops forgot to commit these a couple ago
std: Make {inc,dec} (a -> a) instead of (Int -> Int)

Should of course be constrained to integer types in the future, but
for now, this is quite convenient.
Add F16, F32, F128

Also, fix inconsistencies with "FNN" vs "FloatNN" vs "Double". Now,
always "FNN", e.g. "F64".
Implement binops as "builtin virtual functions"

This way, they only need to be declared for the typechecker and
handled in the codegen, but they don't need to exist as variants in
the AST for the intermediate compilation steps. Some existing variants
could maybe be handled this way too, like transmute.
Add global variables

Previously, top-level definitions could only be functions. Now,
non-function variables are initialized with `carth_init` in `main`.

Could be interesting to initialize them at compile time instead, using
some kind of compile-time evaluation mechanism, probably using the JIT.
Instead of ccc everywhere, generate fastcc wrappers around externs

Pros:

- Extern declarations can now be written in a carth
  interpretation, with currying and all, because the generated wrapper
  will be curried. No need to manually write curried wrappers!

- Fastcc is faster and can optimize tail calls *way* better than
  ccc. We now have almost guaranteed tail call elimination in most
  possible cases.

Cons:

- Carth functions can now not be called from the outside, as they
  don't conform to the C abi. Maybe we'll add a feature to generate
  "reverse-wrappers" for marked carth functions.
Forgot to track std/math.carth a few commits back