(define \$Integer (type {[\$var-match (lambda [\$tgt] {tgt})] [\$= (lambda [\$val \$tgt] (eq? val tgt))]})) (define \$compare-integer (lambda [\$m \$n] (if (lt? m n) (if (eq? m n) )))) (define \$Double (type {[\$var-match (lambda [\$tgt] {tgt})] [\$= (lambda [\$val \$tgt] (eq-f? val tgt))]})) (define \$Nat (type {[\$var-match (lambda [\$tgt] {tgt})] [\$inductive-match (destructor {[o [] {[0 {[]}] [_ {}]}] [s [Nat] {[\$tgt (match (compare-integer tgt 0) Order {[ {(- tgt 1)}] [_ {}]})]}]})] [\$= (lambda [\$val \$tgt] (eq? val tgt))]})) (define \$between (lambda [\$m \$n] (match (compare-integer m n) Order {[ {m @(between (+ m 1) n)}] [ {n}] [ {}]}))) (define \$min (lambda [\$ns] (match ns (List Integer) {[> n] [ (let {[\$r (min rs)]} (match (compare-integer n r) Order {[ n] [_ r]}))]}))) (define \$max (lambda [\$ns] (match ns (List Integer) {[> n] [ (let {[\$r (max rs)]} (match (compare-integer n r) Order {[ n] [_ r]}))]}))) (define \$gcd (lambda [\$ns] (match ns (Set Integer) {[> n] [ (gcd {m @((remove-all Integer) (map (lambda [\$r] (mod r m)) rs) 0)})]})))