<< Back to previous view

[LOGIC-179] Document how defn/implicit do with multiple goals does not work Created: 05/Aug/16  Updated: 05/Aug/16

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

Type: Enhancement Priority: Trivial
Reporter: Oskar Wickstrom Assignee: David Nolen
Resolution: Unresolved Votes: 0
Labels: documentation
Environment:

Clojure 1.8
core.logic 0.8.10


Attachments: Text File logic-repl.txt    

 Description   

Hi! I have a small documentation improvement proposal:

When using regular `defn` to create a relation, I've found that an empty (fresh [] ...) is needed if you want to use multiple relations and goals inside your defn:ed relation, otherwise your goals are in the implicit do from defn, and only the last one has any effect.

Simple example:

{{
defn-logic> (defn test [a b]
(== a 1)
(== b 2))
#'defn-logic/test
defn-logic> (run* [q] (fresh [a b]
(== q [a b])
(test a b)))
([_0 2])
defn-logic> (defn test [a b]
(fresh []
(== a 1)
(== b 2)))
#'defn-logic/test
defn-logic> (run* [q] (fresh [a b]
(== q [a b])
(test a b)))
([1 2])
defn-logic>
}}

Again, this is perfectly correct and reasonable, but maybe a bit confusing for beginners, in that the implicit do "fails silently". What I'm looking for here is probably just a heads up in the Wiki docs. I couldn't find it, but maybe it exists already? I'd be happy to add it to the documentation and send a PR.



 Comments   
Comment by Oskar Wickstrom [ 05/Aug/16 6:03 AM ]

The REPL session got messed up, now attached as a file instead.

Comment by Oskar Wickstrom [ 05/Aug/16 7:48 AM ]

Oh, I just found `all` (http://clojuredocs.org/clojure.core.logic/all) which seems to be preferred over `(fresh [] ...)`.





[LOGIC-131] Docstrings for lvaro and nonlvaro need improvement. Created: 22/Apr/13  Updated: 28/Jul/13  Resolved: 07/May/13

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

Type: Defect Priority: Minor
Reporter: Austin Haas Assignee: David Nolen
Resolution: Completed Votes: 0
Labels: documentation

Attachments: File LOGIC-131-fix.diff    
Patch: Code

 Description   

Assuming the following definitions:

1. A term is ground if it does not contain unassociated logic variables.
2. Otherwise, it is non-ground.

My suggestions:

lvaro: A non-relational goal that succeeds if the supplied logic variable is fresh.

nonlvaro: A non-relational goal that succeeds if the supplied logic variable is not fresh.

In the case nonlvaro, it's important to recognize that the implementation only tests whether the supplied lvar is not fresh, and "not fresh" != grounded; the result could be partially instantiated. For example, nonlvaro succeeds here when its argument is neither fresh nor grounded:

(run* [q]
  (fresh [x]
    (== q [x])
    (nonlvaro q)))
;; => ([_0])


 Comments   
Comment by Austin Haas [ 22/Apr/13 12:26 PM ]

I added those initial definitions when I thought "groundedness" was the operative word, so they aren't directly relevant.

Comment by David Nolen [ 22/Apr/13 12:29 PM ]

Thanks, I'll happily accept docstring patches.

Comment by Austin Haas [ 07/May/13 2:11 PM ]

This patch changes the docstrings for lvaro and nonlvaro to be more accurate. This is a fix for LOGIC-131.

Comment by David Nolen [ 07/May/13 10:29 PM ]

fixed http://github.com/clojure/core.logic/commit/cc30fcb4f5690e928fa7103e5091b9de8aba0013





[LOGIC-33] Added usage section to readme.md Created: 15/Mar/12  Updated: 28/Jul/13  Resolved: 17/Mar/13

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

Type: Enhancement Priority: Trivial
Reporter: Linus Ericsson Assignee: David Nolen
Resolution: Declined Votes: 0
Labels: documentation

Attachments: Text File usage-added.patch    
Patch: Code

 Description   

added a short usage section in readme.md

the latest working repo was 0.6.7 for me, so that's what in the patch. (i have signed CA)



 Comments   
Comment by David Nolen [ 17/Mar/13 7:11 PM ]

Basic usage has since been added to README.md





Generated at Sat Aug 27 15:48:34 CDT 2016 using JIRA 4.4#649-r158309.