Skip to content
This repository was archived by the owner on Apr 12, 2026. It is now read-only.

carpentry-org/defmulti

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

defmulti

NOTE: Superseded by https://github.com/carpentry-org/match-utils.

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

 
 
 

Contributors