Skip to content

carpentry-org/defmulti

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

defmulti

WIP

is a simple attempt at bringing multiple dispatch to Carp (see also carp-lang/Carp#1072).

Because it is a mere macro, the functions only work in call position and can’t be used in higher-order functions.

Usage

(load "defmulti.carp")

(defmulti addr
  [] 0
  [x] (+ x 1)
  [x y (f +)] (f x y))

(defn main []
  (do
    (println* (addr))
    (println* (addr 1))
    (println* (addr 4 3))
    (println* (addr 4 3 (f -)))
    (println* (addr 4 3 *))))

Have fun!

About

is a simple variadic function system

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published