<< Back to previous view

[LOGIC-138] Allow tying multiple noms in one binder Created: 10/Jun/13  Updated: 10/Jun/13

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

Type: Enhancement Priority: Minor
Reporter: Tom Jack Assignee: David Nolen
Resolution: Unresolved Votes: 0
Labels: nominal


I think it may be useful to be able to tie multiple noms in one binder, with or without significant order.

A couple use cases I've thought of so far:

Lambdas in a non-currying language. Here order matters.

(== (list 'fn (ties [x y] (list '+ x y)))
    (list 'fn (ties [z w] (list '+ z w)))

My original use case, free/quantified variables in logical formulas. Order doesn't matter (note the second body has its noms swapped).

(== (list '∀ (ties #{x y} (list '= (list '+ x y) (list '+ y x))))
    (list '∀ (ties #{z w} (list '= (list '+ w z) (list '+ z w)))))

I have a draft implementation here: https://github.com/tomjack/core.logic/compare/ties

Possible issues with this implementation:

  • Is it OK to reextend IWalkTerm to IPersistentSet?
  • Should Tie and Ties present a uniform interface? (e.g. (tie? (ties #{x} x)))

Comment by David Nolen [ 10/Jun/13 3:37 PM ]

I really don't think the set bit is necessary, the vector syntax is fine. Also avoid needing to bring IWalkTerm back for sets. And yes, tie? should work in either case.

Comment by Tom Jack [ 10/Jun/13 3:55 PM ]

Hmm.. should:

(== (list 'fn (ties [x y] (list '- x y)))
    (list 'fn (ties [z w] (list '- w z)))

I'd think not.

Do you mean that order should always matter (take out the permutations stuff), or that it should never matter (don't use ties for cases like the above)?

Comment by David Nolen [ 10/Jun/13 4:07 PM ]

Ah hm, good point. Will think on it some more.

Generated at Sun Jan 21 09:01:20 CST 2018 using JIRA 4.4#649-r158309.