Details
-
Type:
Enhancement
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Completed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
would be nice to be able to do stuff like
(cond-m foo
(cons ?a nil) (println a))
where foo is some value, and (cons ?a nil) is pattern to match and (println a) is code to execute if it matches. (cons ?a nil) would match a sequence with one element, with ?a matching that one element.
you can sort of do this by modifying replace-lvar to turn (cons a b) into (lcons a b) this works for some cases but fails for the one given above, not sure why
(cond-m '[(1)]
[(cons ?a nil)] a)
does actually return 1 if you making the change to replace-lvar my mistake