egison-3.0.1: lib/core/base.egi
;;
;; Base.egi
;;
(define $bool
(matcher
{[,$val []
{[$tgt (if (eq? val tgt)
{[]}
{})]}]
[$ [something]
{[$tgt {tgt}]}]
}))
(define $or
(lambda [$b1 $b2]
(if b1
#t
b2)))
(define $and
(lambda [$b1 $b2]
(if b1
b2
#f)))
(define $not
(lambda [$b]
(match b bool
{[,#t #f]
[,#f #t]})))
(define $char
(matcher
{[,$c []
{[$tgt (if (eq? tgt c)
{[]}
{})]}]
[$ [something]
{[$tgt {tgt}]}]
}))
(define $string
(matcher
{[,$s []
{[$tgt (if (eq? tgt s)
{[]}
{})]}]
[$ [something]
{[$tgt {tgt}]}]
}))
(define $ordering
(algebraic-data-matcher
(| <less> <equal> <greater>)))
(define $match?
(lambda [$a]
(lambda [$x $y]
(match x a
{[,y #t]
[_ #f]}))))