<< Back to previous view

[LOGIC-6] no way to unify the first of a seq to one lvar and the rest to another Created: 01/Jun/11  Updated: 28/Jul/13  Resolved: 02/Jun/11

Status: Closed
Project: core.logic
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Major
Reporter: Kevin Downey Assignee: David Nolen
Resolution: Completed Votes: 0
Labels: None


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

Comment by Kevin Downey [ 01/Jun/11 4:53 PM ]

(cond-m '[(1)]
[(cons ?a nil)] a)

does actually return 1 if you making the change to replace-lvar my mistake

Comment by Kevin Downey [ 02/Jun/11 4:52 PM ]

bd9a3440977ed17648d1e57fec2ba52c95657733 adds support for unifying first and rest using (?first ?second . ?rest)

Generated at Wed Sep 26 09:37:14 CDT 2018 using JIRA 4.4#649-r158309.