I also added a 'match-with' function to my functional module that allows matching in the style of erlang and ml, additionally using guards:
Code: Select all
(match-with '(1 2 3)
(((a ? integer?) (b ? integer?) (c ? integer? (fn (i) (< i 3))))
(+ a b c)) ; won't get reached because of guard
(((a ? integer?) (b ? integer?) (c ? integer? (fn (i) (< i 4))))
(* a b c))) ; this matches because all guards return true