core.logic

generalize the notion of hash for robustness

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

The second nom/hash throws an exception, because the nom/hash constraint is ran before the predc one.

(is (= (run* [q]
         (nom/fresh [x]
           (fresh [y]
             (predc y nom? `nom?)
             (nom/hash y x)
             (== y 'foo))))
      ()))

(is (= (run* [q]
         (nom/fresh [x]
           (fresh [y]
             (nom/hash y x)
             (predc y nom? `nom?)
             (== y 'foo))))
      ()))

Perhaps, we can generalize the notion of hash.

  1. refactoring.diff
    08/Jan/13 7:04 AM
    2 kB
    Nada Amin
  2. logic-102.diff
    07/Jan/13 12:39 PM
    5 kB
    Nada Amin

Activity

Hide
David Nolen added a comment -

Hmm but why throw in nom/hash like that instead of just failing?

Show
David Nolen added a comment - Hmm but why throw in nom/hash like that instead of just failing?
Hide
David Nolen added a comment -

Closed wrong ticket

Show
David Nolen added a comment - Closed wrong ticket
Hide
Nada Amin added a comment -

ok, seems reasonable to fail.

The fix to logic-101 is not entirely satisfactory, because we can now get constraints like _1#[_1]. so i think i also want to not use predc (but still use fixc), but have a custom constraint instead of the predc that takes the two rands into account.

implementing this now.

Show
Nada Amin added a comment - ok, seems reasonable to fail. The fix to logic-101 is not entirely satisfactory, because we can now get constraints like _1#[_1]. so i think i also want to not use predc (but still use fixc), but have a custom constraint instead of the predc that takes the two rands into account. implementing this now.
Hide
Nada Amin added a comment -

The patch logic-102.diff gives up on predc and fixc, and instead does a lot of ugly special-casing to cover the new TDD test cases.

Not too happy about this change...

Show
Nada Amin added a comment - The patch logic-102.diff gives up on predc and fixc, and instead does a lot of ugly special-casing to cover the new TDD test cases. Not too happy about this change...
Hide
David Nolen added a comment -

Is there something we could do to make it easier to rely on `fixc` and `predc`? Or is there some lacking feature of constraints?

Show
David Nolen added a comment - Is there something we could do to make it easier to rely on `fixc` and `predc`? Or is there some lacking feature of constraints?
Hide
David Nolen added a comment -

Also if you're OK w/ this patch, more than happy to move forward w/ this for now and it can be improved later.

Show
David Nolen added a comment - Also if you're OK w/ this patch, more than happy to move forward w/ this for now and it can be improved later.
Hide
Nada Amin added a comment -

OK, as discussed, please go ahead with the patch, and I'll think of some alternatives / refactoring soon.

Show
Nada Amin added a comment - OK, as discussed, please go ahead with the patch, and I'll think of some alternatives / refactoring soon.
Hide
Nada Amin added a comment -

refactoring.diff refactors the logic a bit. Hopefully it's more readable.

For now, it seems too much trouble for the gain to generalize hash or try to write it using more primitive constraints.

Show
Nada Amin added a comment - refactoring.diff refactors the logic a bit. Hopefully it's more readable. For now, it seems too much trouble for the gain to generalize hash or try to write it using more primitive constraints.
Hide
David Nolen added a comment -

Makes sense will apply later today.

Show
David Nolen added a comment - Makes sense will apply later today.
Hide
Nada Amin added a comment -

I am going to apply the refactoring to master.

Show
Nada Amin added a comment - I am going to apply the refactoring to master.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: