Carth

Purely functional programming with lisp-syntax. Less infix, more parens!

Table of Contents

Welcome to the homepage of the Carth – a work-in-progress programming language with no great ambitions. It just wants to sit comfortably between Rust, Haskell, and Scheme, and to become the go-to language for its creator – me!

Although having existed for some years now, Carth is still in fairly early stages of development. The author has managed to do Advent of Code in it, but that's about as useful as it can be right now. There are no guarantees of stability, so if you do decide to try the language out – please beware that the whole building may at any point flip upside down right under your nose.

Also, I don't really keep this site up-to-date at all yet, so don't trust anything or anyone you encounter here!

1Why Carth?

2Documentation

3Development

All development on the Carth project happens openly on Sourcehut in ~jojo/carth. The source for this website is also on Github in bryal/carth-website.

4Example

Just to give you a quick taste. More examples can be found in the examples directory.

(import std)

(define main fizzbuzz)

(define (fizzbuzz Unit)
  (for (range 1 100)
       (<o display fizzbuzz')))

(define (fizzbuzz' n)
  (match (Pair (divisible? n 3) (divisible? n 5))
    (case (Pair False False) (my-show-int n))
    (case (Pair True False) "Fizz")
    (case (Pair False True) "Buzz")
    (case (Pair True True) "Fizzbuzz")))

(define my-show-int
  (fmatch
    (case 1 "one")
    (case 2 "two")
    (case n (show-int n))))

5Related work