I am pleased to announce Algebraic Racket, an extension for algebraic
structures in untyped Racket.

https://github.com/dedbox/racket-algebraic

Algebraic structures provide the operational under-pinnings for algebraic
data types. What's missing is the static typing constraints.

The initial release provides a #lang algebraic/racket/base that extends
#lang racket/base with:

1. First class, lexically scoped, naturally ordered data constructors.

  > (data Maybe (Just Nothing))
  > (define maybe
      (function*
        [(n _ Nothing) n]
        [(_ f (Just x)) (f x)]))
  > (maybe #f values (Just 123))
  123
  > (maybe #f values Nothing)
  #f

2. A consistent destructuring syntax for functions and macros.

  > (define fib
      (function
        [n #:if (< n 2) 1]
        [n (+ (fib (- n 1))
              (fib (- n 2)))]))
  > (map fib (build-list 7 values))
  '(1 1 2 3 5 8 13)

  > (define-syntax m-fib
      (macro
        [n:nat #:if (< (var n) 2) 1]
        [n:nat (+ (m-fib #,(- (var n) 1))
                  (m-fib #,(- (var n) 2)))]))
  > (list (m-fib 0) (m-fib 1) (m-fib 2)
          (m-fib 3) (m-fib 4) (m-fib 5) (m-fib 6))
  '(1 1 2 3 5 8 13)

The package is fully documented. The documentation includes the first of
three tutorials in a series on building interpreters with Algebraic
Racket.

Algebraic Racket is the first major milestone in a larger effort to
produce a complete language-oriented toolkit for integrating algebraic
structure into more sophisticated designs.

The project aims to:

  1. Implement and document the forms, functions, and syntax classes
     comprising Algebraic Racket for maximum potential reuse.

  2. Support the development of modular type systems and other
     language-facing components as libraries.

Pull requests of any size are welcome. For major changes, please start a
conversation on racket-users or open an issue to discuss what you would
like to change.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to