Skip to content
a racket macro that allows definitions to be spread across a file
Racket
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
define-match-spread-out
.gitignore
.travis.yml
README.md
info.rkt

README.md

define-match-spread-out Build Status

documentation: http://docs.racket-lang.org/define-match-spread-out/index.html

A racket library that allows you to write code like this:

(define* (f #t) 2)
(define* (f #f) 3)
(define* (f  _) 0)
(define* (f x y) x)

That would be roughly equivalent to

(define f
  (match*-case-lambda
    [[#t] 2]
    [[#f] 3]
    [[_] 0]
    [[x y] x]))

Or, using just case-lambda and match variants:

(define f
  (case-lambda
    [(tmp)
     (match tmp
       [#t 2]
       [#f 3]
       [_  0])]
    [(tmp1 tmp2)
     (match* (tmp1 tmp2)
       [(x y) x])]))
You can’t perform that action at this time.