Skip to content

AlexKnauth/colon-match

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

colon-match Build Status

match with colon notation, based on discussion with @soegaard at http://lists.racket-lang.org/users/archive/2013-December/060826.html

documentation: http://pkg-build.racket-lang.org/doc/colon-match/index.html

The :match form is like match, except that it allowes identifiers with colons in patterns to specify different types of values. The pattern x:num matches a number and binds it as x, the pattern v:str matches a string and binds it as v, and so on.

Examples:

> (require colon-match)
> (:match 1 [n:num n])
1
> (:match 'x [n:num n] [_ #f])
#f
> (:match '(1 2 3) [(list a:num b:num c:num) (+ a b c)])
6
> (:match '(sym "str" 3)
    [(list-no-order n:num str:str sym:sym)
     (list n str sym)])
'(3 "str" sym)

Releases

No releases published

Packages

No packages published

Languages