You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Z-Shang edited this page Feb 15, 2015
·
1 revision
Pattern Matching and Type Matching in LoLi-Next
Pattern Matching:
(MATCH EXP1 EXP2) => TEMP ENV
The function MATCH matches up the EXP1 and EXP2 and generates a temporary environment
E.g.:
(match (a b c) (1 2 3)) => ( (a 1) (b 2) (c 3) )
(match (_ _ a) (1 2 3)) => ( (a 3) )
TMATCH is similar to MATCH
(tmatch (:TYPE1 :TYPE2 :TYPE3) (a b c)) => ( (a (get-type 'a :TYPE1)) (b (get-type 'b :TYPE2)) (c (get-type 'c :TYPE3)) )
(tmatch (_ _ :TYPE1) (a b c)) => ( a b (c (get-type 'c :TYPE1)) )