Re: core.logic question

2021-09-29 Thread ru
Thanks to Tom: Mistake in "(== q 'IN-ZONE)". Must be "(l/== q 'IN-ZONE)" By the way. Can anybody recommend comprehensive documentation on core.logic and its API, with examples and so on? All I have found is sketchy and fragmentary.. суббота, 11 сентября 2021 г.

core.logic question

2021-09-11 Thread ru
Dear clojure users and team! I have a simple core.logic program: (require '[clojure.core.logic :as l] '[clojure.core.logic.pldb :as db]) (db/db-rel In-zone t z) (def bd (db/db-fact bd In-zone 'A 'B)) (println (db/with-db bd (l/run* [q]

Re: Using core.logic for bi-directional json transformation

2020-09-30 Thread Jules
e the relationship between the two > JSON dialects in such a way as to be able to travel backwards and forwards > between them using the same code, > > A long time ago I wrote a lot of PROLOG, so I thought I would have a look > at core.logic. > > I managed some limited success

Using core.logic for bi-directional json transformation

2020-09-30 Thread Jules
n the two JSON dialects in such a way as to be able to travel backwards and forwards between them using the same code, A long time ago I wrote a lot of PROLOG, so I thought I would have a look at core.logic. I managed some limited success using 'featurep' to inspect schema nodes for e

Second miniKanren Workshop CfP -- core.logic welcome!

2020-03-26 Thread Jason Hemann
Relational Programming Workshop is a new workshop for the miniKanren family of relational (pure constraint logic programming) languages: miniKanren, microKanren, core.logic, OCanren, Guanxi, etc. The workshop solicits papers and talks on the design, implementation, and application of miniKanren

Re: Why does this core.logic program never terminate if you ask for too many results?

2019-11-01 Thread Satyam Ramawat
Grand!! On Fri, 1 Nov 2019 at 1:08 PM, Laurens Van Houtven <_...@lvh.io> wrote: > Sure: I'm saying figuring out the formula from a handful of examples is > tricky. But I can do that, and I already know Clojure has conditionals. I'm > trying to learn something about how the logic engine works. > >

Re: Why does this core.logic program never terminate if you ask for too many results?

2019-11-01 Thread Laurens Van Houtven
Sure: I'm saying figuring out the formula from a handful of examples is tricky. But I can do that, and I already know Clojure has conditionals. I'm trying to learn something about how the logic engine works. lvh On Thu, Oct 31, 2019 at 5:23 PM Satyam Ramawat wrote: > Laurens, > > Have you tried

Re: Why does this core.logic program never terminate if you ask for too many results?

2019-10-31 Thread Satyam Ramawat
Laurens, Have you tried checking up to what extent it goes? On Thu, Oct 31, 2019 at 9:44 PM Laurens Van Houtven <_...@lvh.io> wrote: > I always need all of them. Figuring out how many that are combinatorially > is surprisingly tricky! > > On Thu, Oct 31, 2019 at 11:33 AM Satyam Ramawat > wrot

Re: Why does this core.logic program never terminate if you ask for too many results?

2019-10-31 Thread Laurens Van Houtven
I always need all of them. Figuring out how many that are combinatorially is surprisingly tricky! On Thu, Oct 31, 2019 at 11:33 AM Satyam Ramawat wrote: > I mean you can limit the answer according to need, by running into loop > until end users value satisfy, will can be either 5,20 or N. so it

Re: Why does this core.logic program never terminate if you ask for too many results?

2019-10-31 Thread Satyam Ramawat
I mean you can limit the answer according to need, by running into loop until end users value satisfy, will can be either 5,20 or N. so it will throw output according to run of a loop. On Thu, 31 Oct 2019 at 4:28 PM, Laurens Van Houtven <_...@lvh.io> wrote: > Satyam: you're suggesting limiting th

Re: Why does this core.logic program never terminate if you ask for too many results?

2019-10-31 Thread Laurens Van Houtven
Satyam: you're suggesting limiting the answers asked from run, or something else? On Thu, Oct 31, 2019 at 11:24 AM Satyam Ramawat wrote: > On a very simple way, you can restrict by using if statement by crossing > checking the count/length of the list, > https://clojuredocs.org/clojure.core/if >

Re: Why does this core.logic program never terminate if you ask for too many results?

2019-10-31 Thread Satyam Ramawat
On a very simple way, you can restrict by using if statement by crossing checking the count/length of the list, https://clojuredocs.org/clojure.core/if On Tuesday, October 29, 2019 at 11:06:54 PM UTC, Laurens Van Houtven wrote: > > Hi, > > I'm trying to divide a list into 3 lists such that (= my

Re: Why does this core.logic program never terminate if you ask for too many results?

2019-10-31 Thread Marc Limotte
At first glance, I'd guess that the empty list is causing your problem. You can always come up with one more path (which may not create a unique solution, but a path to explore) that has one more empty list appended. On Tue, Oct 29, 2019 at 6:06 PM Laurens Van Houtven <_...@lvh.io> wrote: > Hi,

Why does this core.logic program never terminate if you ask for too many results?

2019-10-29 Thread Laurens Van Houtven
Hi, I'm trying to divide a list into 3 lists such that (= my-list (concat a b c)). I guess you could say I'm writing concato :-) (l/run n [a b c] (l/fresh [A B] ;; uppercase are internal accumulators (l/appendo a b A) (l/appendo A c B) (l/== B '(p q r s ... running this progr

Making a game with core.logic

2019-10-16 Thread Pepijn de Vos
ogic gates, every input you connect a gate to creates two more inputs. So you need things like T wires and maybe inverters. So I figured I'd write a core.logic program that would just make valid circuits for various board sizes. Then you can do some nice visualizations and statistics. At then en

Re: What's the status of DCG in core.logic?

2018-09-27 Thread phil jones
Thanks. But is there anything specifically about dcg.clj? On Thursday, 27 September 2018 17:37:34 UTC-3, Pankaj Doharey wrote: > > http://minikanren.org/#writtenTutorials > > On Thursday, 27 September 2018 20:33:27 UTC+5:30, phil jones wrote: >> >> >> I see core.l

Re: What's the status of DCG in core.logic?

2018-09-27 Thread Pankaj Doharey
http://minikanren.org/#writtenTutorials On Thursday, 27 September 2018 20:33:27 UTC+5:30, phil jones wrote: > > > I see core.logic has a version of Prolog's DCG grammars. > > > https://github.com/clojure/core.logic/blob/master/src/main/clojure/clojure/core/logic/dcg.c

What's the status of DCG in core.logic?

2018-09-27 Thread phil jones
I see core.logic has a version of Prolog's DCG grammars. https://github.com/clojure/core.logic/blob/master/src/main/clojure/clojure/core/logic/dcg.clj Is this a usable solution at the moment? Does anyone know of any documentatiojn or tutorials anywhere? cheers Phil -- You received

[?] The Reasoned Schemer vs. Core.logic

2018-08-24 Thread Philos Kim
I am studying *The Reasoned Schemer, 2nd ed.* and translating its source code into Clojure. https://github.com/philoskim/reasoned-schemer-for-clojure In the middle of studying the problem #98 of Chapter 3, I encountered an unexpected result like this. https://github.com/philoskim/reasoned-sche

[?] The Reasoned Schemer vs. core.logic

2018-08-24 Thread Philos Kim
I am studying *The Reasoned Schemer, 2nd ed.* and translating its source code into Clojure. https://github.com/philoskim/reasoned-schemer-for-clojure In the middle of studying the problem #98 of Chapter 3, I encountered an unexpected result like this. https://github.com/philoskim/reasoned-sche

Re: Question regarding core.logic

2017-09-06 Thread Russell Mull
On Tuesday, September 5, 2017 at 2:03:36 PM UTC-7, Laverne Schrock wrote: > > > On Tuesday, September 5, 2017 at 1:50:59 PM UTC-5, Russell Mull wrote: >> >> It's not really clear what you're trying to do, so it's hard to offer >> further advice. >> > > Essentially, what I'm trying to do is pass

Re: Question regarding core.logic

2017-09-05 Thread Laverne Schrock
On Tuesday, September 5, 2017 at 1:50:59 PM UTC-5, Russell Mull wrote: > > On Monday, September 4, 2017 at 7:49:11 AM UTC-7, Laverne Schrock wrote: >> >> When I run (run* [q] (fresh [x] (== [x] ['z]) (== q x))), I get (z), >> which makes sense. >> >> When I run (run* [q] (fresh [x] (== q x))), I

Re: Question regarding core.logic

2017-09-05 Thread Russell Mull
On Monday, September 4, 2017 at 7:49:11 AM UTC-7, Laverne Schrock wrote: > > When I run (run* [q] (fresh [x] (== [x] ['z]) (== q x))), I get (z), > which makes sense. > > When I run (run* [q] (fresh [x] (== q x))), I get (_0), which makes sense > since I've placed no restriction on x. > > However

Question regarding core.logic

2017-09-04 Thread Laverne Schrock
When I run (run* [q] (fresh [x] (== [x] ['z]) (== q x))), I get (z), which makes sense. When I run (run* [q] (fresh [x] (== q x))), I get (_0), which makes sense since I've placed no restriction on x. However, when I run (run* [q] (fresh [x] (== ['x] ['z]) (== q x))), I get (), which doesn't m

introspecting execution of run in core.logic

2017-03-21 Thread Lambder
Hello All, Would it be possible to have the result contain, 'a execution explanation' so I can see which subgoals contributed to which particular result and when no result to see which goals has failed and therefore prevented from success? -- Lambder -- You received this message because

Re: algebra system & core.logic

2017-01-13 Thread Alex Gian
No, there isn't a system based on core.logic, AFAIK, but Gerry Sussmans scmutils has had an succesful initial port. I am sure that core.logic and many other Clojure facilities could be used to improve the symbolic logic, enable better algorithms etc, and I certainly hope this will h

Re: [core.logic] - why doesnt ITake/take* implementation always return a seqable?

2017-01-04 Thread Paulo César Cuneo
(bind a (== out as) On Tuesday, January 3, 2017 at 4:14:20 PM UTC-3, Paulo César Cuneo wrote: > > I was hacking around with core.logic, trying to implement a "bind var in > sub process". > > So that this this succeeds: > (run [q] >(fresh[a] > (

[core.logic] - why doesnt ITake/take* implementation always return a seqable?

2017-01-03 Thread Paulo César Cuneo
I was hacking around with core.logic, trying to implement a "bind var in sub process". So that this this succeeds: (run [q] (fresh[a] (runsub [q] ;; will "export 'q" or "bind 'q in caller context" [(== a 1) (== q 1

core.logic: faking sets and "sufficient" results

2016-12-28 Thread Nathan Smutz
Hi All, I work for a university and I've been commissioned to write a program that proves whether majors can be reasonably completed in 4 years. core.logic has seemed the obvious tool. The output should be a set of scheduled course-offerings satisfying major requirements, course-prereqs

Re: core.logic with 1.9.0-alpha12

2016-09-13 Thread Steve Miner
Filed LOGIC-180 bug with patch. http://dev.clojure.org/jira/browse/LOGIC-180 -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts

Re: core.logic with 1.9.0-alpha12

2016-09-13 Thread miner
[] ~@rest)) On Tuesday, September 13, 2016 at 3:45:18 AM UTC-4, Burt wrote: > > Hi, > > with "1.9.0-alpha10" and core.logic "0.8.10": > > (ns lwb.nd.rules > (:refer-clojure :exclude [==]) > (:require [clojure.core.logic :refer :all])) > => ni

Re: core.logic with 1.9.0-alpha12

2016-09-13 Thread David Nolen
Oops don't think so. If you have a patch, that would be welcome. David On Tue, Sep 13, 2016 at 3:45 AM, 'Burt' via Clojure < clojure@googlegroups.com> wrote: > Hi, > > with "1.9.0-alpha10" and core.logic "0.8.10": > > (ns lwb.n

core.logic with 1.9.0-alpha12

2016-09-13 Thread 'Burt' via Clojure
Hi, with "1.9.0-alpha10" and core.logic "0.8.10": (ns lwb.nd.rules (:refer-clojure :exclude [==]) (:require [clojure.core.logic :refer :all])) => nil with "1.9.0-alpha12" and core.logic "0.8.10": (ns lwb.nd.rules (:refer-clojure :exclude [==])

is core.logic still maintained?

2016-05-08 Thread Alex Miller
I'm sure David would be happy to look at issues but it's pretty far down his priority list these days. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are

is core.logic still maintained?

2016-05-08 Thread Rafik NACCACHE
Hi guys, Seems there has been no activity on core.logic since November 2015, Is core.logic still maintained ? Cheers -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that

Re: [core.logic] What's the difference between "q" and a fresh LVar? Or: "java.lang.ClassCastException: clojure.core.logic.LVar cannot be cast to java.lang.Number"

2016-04-09 Thread Kevin Downey
Check 'lein deps :tree' for conflicting core.logic versions, and delete the target directory to make sure you don't have old classfiles sitting around. On 04/09/2016 04:47 AM, Daniel Ziltener wrote: > Oops, yes, in my actual code it was both ":db/id", so that&#x

Re: [core.logic] What's the difference between "q" and a fresh LVar? Or: "java.lang.ClassCastException: clojure.core.logic.LVar cannot be cast to java.lang.Number"

2016-04-09 Thread Daniel Ziltener
ould cast light on the issue. You also are using :id in one > variation, and :db/id in the other. > > On 04/08/2016 05:46 PM, Daniel Ziltener wrote: > > Hi clj, > > > > I'm trying to do some simple core.logic stuff. My input is a vector of > > maps, which I tu

Re: [core.logic] What's the difference between "q" and a fresh LVar? Or: "java.lang.ClassCastException: clojure.core.logic.LVar cannot be cast to java.lang.Number"

2016-04-08 Thread Kevin Downey
Hard to say, the class cast exception will have more information in it that could cast light on the issue. You also are using :id in one variation, and :db/id in the other. On 04/08/2016 05:46 PM, Daniel Ziltener wrote: > Hi clj, > > I'm trying to do some simple core.logic stuff.

[core.logic] What's the difference between "q" and a fresh LVar? Or: "java.lang.ClassCastException: clojure.core.logic.LVar cannot be cast to java.lang.Number"

2016-04-08 Thread Daniel Ziltener
Hi clj, I'm trying to do some simple core.logic stuff. My input is a vector of maps, which I turn into a source for core.logic using (defn make-datamap-rel [datapile] (fn [q] (fn [a] (to-stream (map #(unify a % q) (flatten datapile)) Now I have written two variant

Re: How to use plain Clojure functions in core.logic?

2016-01-27 Thread 良ϖ
Well, FYI I've figured out you just need to project the variables you want. Sorry for double-posting. However I've got no idea about how optimum this is. So please don't hesitate if you think about any more clever way to use functions in core.logic :-) 胡軒 ```clojure (let [depart

How to use plain Clojure functions in core.logic?

2016-01-26 Thread 良ϖ
Hi everybody, I have defined a plain Clojure function which has a specific logic inside. It outputs a mutated state given an initial state and some other arguments. Basically, we could say it is like: (defn modifier [basic x y value] (assoc-in basic [x y] value)) I want core.logic to deal with

Re: Any chance of core.logic getting extended with probKanren?

2015-11-25 Thread Carl Cotner
Dragan Djuric wrote: >> > I know well how probabilistic logic works. It is a superset of the >> > true/false logic, and goes much beyond "half true" etc. My question was >> > about how this would look like when integrated with core.logic vs just >> > u

Re: Any chance of core.logic getting extended with probKanren?

2015-11-25 Thread David Nolen
logic, and goes much beyond "half true" etc. My question was > about how this would look like when integrated with core.logic vs just > using full-blown probabilistic logic-based library/language. > > On Wednesday, November 25, 2015 at 3:15:11 PM UTC+1, Carl Cotner wrote: >&g

Re: Any chance of core.logic getting extended with probKanren?

2015-11-25 Thread Dragan Djuric
s > > about how this would look like when integrated with core.logic vs just > using > > full-blown probabilistic logic-based library/language. > > > > On Wednesday, November 25, 2015 at 3:15:11 PM UTC+1, Carl Cotner wrote: > >> > >> > Although som

Re: Any chance of core.logic getting extended with probKanren?

2015-11-25 Thread Carl Cotner
d "half true" etc. My question was > about how this would look like when integrated with core.logic vs just using > full-blown probabilistic logic-based library/language. > > On Wednesday, November 25, 2015 at 3:15:11 PM UTC+1, Carl Cotner wrote: >> >> > Although som

Re: Any chance of core.logic getting extended with probKanren?

2015-11-25 Thread Dragan Djuric
I know well how probabilistic logic works. It is a superset of the true/false logic, and goes much beyond "half true" etc. My question was about how this would look like when integrated with core.logic vs just using full-blown probabilistic logic-based library/language. On Wednesday

Re: Any chance of core.logic getting extended with probKanren?

2015-11-25 Thread Carl Cotner
> Although some key building blocks are the same (MCMC), I really cannot see > how such things could be integrated to core.logic, and even why. This is not a concrete answer to your question, but probability can be thought of as a continuous extension of logic where 0 = False and 1 = True (

Re: Any chance of core.logic getting extended with probKanren?

2015-11-25 Thread Dragan Djuric
I am working on something related to probabilistic programming/inference/learning. Not yet ready for use but I hope to get it there the next year. Although some key building blocks are the same (MCMC), I really cannot see how such things could be integrated to core.logic, and even why. So, I

Re: Any chance of core.logic getting extended with probKanren?

2015-11-24 Thread Russell Mull
On Friday, November 20, 2015 at 5:51:05 AM UTC-8, Henrik Larsson wrote: > > I have started to play around with ProbLog2 and find the concept of > probabilistic logic programming to be super fun. When googeling miniKanren > and probabilistic logic programming the following came up: > https://githu

Re: Any chance of core.logic getting extended with probKanren?

2015-11-20 Thread David Nolen
ncept of > probabilistic logic programming to be super fun. When googeling miniKanren > and probabilistic logic programming the following came up: > https://github.com/webyrd/probKanren > > So my question now is what are the chances that something like probKanren > getting impleme

Any chance of core.logic getting extended with probKanren?

2015-11-20 Thread Henrik Larsson
something like probKanren getting implemented in core.logic and how advance is probKanren vs ProbLog2? What im after is the conditional probabilites that ProbLog2 can handle. There are some documentation on core.logic (https://github.com/clojure/core.logic/wiki/CLP(Prob)) but it is dated at 2013 and

Re: core.logic: Help with insertion sort

2015-08-02 Thread Tassilo Horn
Nicolás Berger writes: Hi Nicolás, >> I've simplified the code a bit so that I don't need the `cconso` > >> relation. > > That's great. It's easier to understand this way. To simplify a tiny > bit more, the `nf` lvar can also be removed: it's unified with `f`, so > f can be used instead of nf in

Re: core.logic: Help with insertion sort

2015-08-01 Thread Nicolás Berger
Hi Tassilo, > I've simplified the code a bit so that I don't need the `cconso` > relation. That's great. It's easier to understand this way. To simplify a tiny bit more, the `nf` lvar can also be removed: it's unified with `f`, so f can be used instead of nf in `(conso nf nr nl)` > Ok, and now t

Re: core.logic: Help with insertion sort

2015-07-30 Thread Tassilo Horn
Nicolás Berger writes: Hi Nicolás, > Sounds interesting :). I hope I get some time to take a look into it > soon. I appreciate your feedback! > In the meantime, have you tried playing with the log and trace > "goals"? I mean log, trace-s and trace-lvar. They might be of help > in trying to d

Re: core.logic: Help with insertion sort

2015-07-29 Thread Nicolás Berger
9/07/2015 11:40, "Tassilo Horn" escribió: > Hi all, > > I've just implemented insertion sort with core.logic: > > --8<---cut here---start->8--- > (declare inserto) > (defn isorto > "A relation where sl is a sorted versi

core.logic: Help with insertion sort

2015-07-29 Thread Tassilo Horn
Hi all, I've just implemented insertion sort with core.logic: --8<---cut here---start->8--- (declare inserto) (defn isorto "A relation where sl is a sorted version of the list l." ([l sl] (isorto l () sl)) ([l acc sl] (conde

Re: micrologic - A tiny, literate implementation of miniKanren/core.logic

2015-01-12 Thread Atamert Ölçgen
en changed to be more descriptive than that which is >> found in the literature, at least to my eye. >> - It's written in idiomatic Clojure. >> >> It should be a good introduction to the way miniKanren and core.logic >> work, especially if you're more software

Re: micrologic - A tiny, literate implementation of miniKanren/core.logic

2015-01-08 Thread David Nolen
t; > It should be a good introduction to the way miniKanren and core.logic > work, especially if you're more software engineer than computer scientist. > Is this useful, confusing? Wrong in places? please let me know if you have > any feedback! > > http://mullr.github.io/microl

micrologic - A tiny, literate implementation of miniKanren/core.logic

2015-01-08 Thread Russell Mull
have been changed to be more descriptive than that which is found in the literature, at least to my eye. - It's written in idiomatic Clojure. It should be a good introduction to the way miniKanren and core.logic work, especially if you're more software engineer than computer scient

Re: is there a shorter way to do this in core.logic ?

2015-01-04 Thread Ashton Kemerling
I'm no expert, but I think no, at least not in any way you'd want to maintain. Also, if that's all of your core.logic code, that's pretty damned short and clear. I can read and understand that right away. --Ashton Sent from my iPhone > On Jan 4, 2015, at 2:43 AM, r

is there a shorter way to do this in core.logic ?

2015-01-04 Thread rogergl
The following snippet works (fresh [?row ?col] (fd/+ row 1 ?row) (fd/+ col 1 ?col) (membero {:row ?row :col ?col} data)))] ; check existence of {:row (?row + 1) :col (?col + 1)} But I'm not sure if this isn't to verbose.

Re: How to find adjacent cells in a matrix with core.logic ?

2015-01-02 Thread rogergl
>>Also in this case I don't really see the value over writing the search directly - but your goals are not clear to me<< It's just an exercise to get a feel for what core.logic can be used for. Regards Roger > > -- You received this message because you are sub

Re: How to find adjacent cells in a matrix with core.logic ?

2015-01-02 Thread Tobias Kortkamp
Move membero to the beginning (just after fresh, like in succo), it runs in < 100 ms on my machine then. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members ar

Re: How to find adjacent cells in a matrix with core.logic ?

2015-01-02 Thread David Nolen
If you are going to optimize core.logic programs you really need to understand the implications of a Prolog-like system. The same optimization strategies tend to apply. Also in this case I don't really see the value over writing the search directly - but your goals are not clear to me. Davi

Re: How to find adjacent cells in a matrix with core.logic ?

2015-01-02 Thread rogergl
Ok, the execution time is about 3sec in a standalone repl. Much faster but imho still way to slow. Regards Roger -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from n

How to find adjacent cells in a matrix with core.logic ?

2015-01-02 Thread rogergl
I would like to find the entries with 4 adjacent cells (horizontally or vertically) ? Is this the right way to do this ? I don't think so, since my solution seems to be very slow. Evaluating in LightTable takes about 10 seconds. (def matrix [ {:row 1 :col 1}

Re: How to access nested structures with core.logic ?

2015-01-02 Thread rogergl
I didn't know that featurec supported this. BTW: If anyone is interested. The following works: (def my-data [ {:name 'peter :sales 1200 :nested { :value 123} :age 32} {:name 'paul :sales 200 :ag

Re: How to access nested structures with core.logic ?

2015-01-02 Thread David Nolen
This is what the `featurec` constraint is for. David On Fri, Jan 2, 2015 at 9:47 AM, rogergl wrote: > I have the following simple core.logic snippet: > > (def my-data [ >{:name 'peter > :some-data { > :some-value: 42 >

How to access nested structures with core.logic ?

2015-01-02 Thread rogergl
I have the following simple core.logic snippet: (def my-data [ {:name 'peter :some-data { :some-value: 42 } :sales 1200 :age 32} {:name 'paul :sales 200 :age 42} {:

Re: Hierarchical data core.logic

2014-11-13 Thread David Nolen
> > > > On Thu, Nov 13, 2014 at 5:28 PM, David Nolen wrote: >> >> There's no need to define the reverse relation - fooz can do it. Just >> supply bar and leave the foo fresh. >> >> David >> >> On Thu, Nov 13, 2014 at 12:26 PM, wrote: >>

Re: Hierarchical data core.logic

2014-11-13 Thread Daniel Stone
; I think this is a dummy question, but wondering whether this is possible > in > > core.logic? > > > > Lets say I have a set of relations > > > > (db-rel foo p) > > (db-rel bar p) > > (db-rel fooz p p2) > > > > and facts > > [foo 1] > >

Re: Hierarchical data core.logic

2014-11-13 Thread David Nolen
There's no need to define the reverse relation - fooz can do it. Just supply bar and leave the foo fresh. David On Thu, Nov 13, 2014 at 12:26 PM, wrote: > I think this is a dummy question, but wondering whether this is possible in > core.logic? > > Lets say I have a set of

Hierarchical data core.logic

2014-11-13 Thread dan . stone16321
I think this is a dummy question, but wondering whether this is possible in core.logic? Lets say I have a set of relations (db-rel foo p) (db-rel bar p) (db-rel fooz p p2) and facts [foo 1] [bar 2] [fooz 2 1] [bar 3] [fooz 3 1] See that the fooz relation is potentially describing bar as

Re: Recursive definition in core.logic

2014-09-22 Thread Joshua Ballanco
On Sunday, September 21, 2014 at 21:40, Tassilo Horn wrote: > I think instead of `conde' you can use `conda' here, because when the > first clause succeeds the second one cannot succeed and doesn't need to > Careful with the use of `conde` vs `conda`, as `conda` is an early cut. In other words

Re: Recursive definition in core.logic

2014-09-21 Thread Tassilo Horn
Casper writes: > For me that leads to the question, how do we then define the relationship > 'descendant' (which would be the generalisation of child, grandchild etc)? > > (defn child [x y] > (parent y x)) Ok, so you have a `child' relation already, so this should be easy (but it's not teste

Re: Recursive definition in core.logic

2014-09-21 Thread François Rey
: I have been looking through core.logic tutorials and while I "get it" I haven't had the big epiphany yet. One thing that keeps nagging me is how to make a relation that isn't "fixed". An example is https://github.

Recursive definition in core.logic

2014-09-21 Thread Casper
I have been looking through core.logic tutorials and while I "get it" I haven't had the big epiphany yet. One thing that keeps nagging me is how to make a relation that isn't "fixed". An example is https://github.com/swannodette/logic-tutorial in which there is

Re: Assigning Values in Core.Logic

2014-09-18 Thread Ashton Kemerling
Aha, I believe the "is" method has solved my dilemma. -- Ashton Kemerling On Thu, Sep 18, 2014 at 7:56 PM, Ashton Kemerling wrote: > I can't tell if I'm being silly, but I'm having issues figuring out how to > record the results of my computation in Core.Logic.

Assigning Values in Core.Logic

2014-09-18 Thread Ashton Kemerling
I can't tell if I'm being silly, but I'm having issues figuring out how to record the results of my computation in Core.Logic. The basic idea is that I'm trying to determine if a schedule a user has requested is solvable or not. I'm trying to find out how to assi

Re: Core.logic for boardgames

2014-08-11 Thread Robin Heggelund Hansen
Ok, thanks for all the answers :) kl. 15:11:39 UTC+2 mandag 11. august 2014 skrev Moritz Ulrich følgende: > > Robin Heggelund Hansen > writes: > > Implementing non-trivial game-logic in core.logic or any other > logic-programming system is likely harder than implementing th

Re: Core.logic for boardgames

2014-08-11 Thread Moritz Ulrich
Robin Heggelund Hansen writes: Implementing non-trivial game-logic in core.logic or any other logic-programming system is likely harder than implementing the validation in Clojure, as you'd have to learn many new idioms and a totally different programming style - but it's really mind-o

Re: Core.logic for boardgames

2014-08-11 Thread Kalina Todorova
Core.logic is just Clojure implementation of logic like programming and actually you can use logic programming for chess games (the example is in Prolog) http://stackoverflow.com/questions/9337074/what-is-the-neatest-prolog-implementation-for-conways-game-of-life On Mon, Aug 11, 2014 at 11:41

Re: Core.logic for boardgames

2014-08-11 Thread Robin Heggelund Hansen
The idea was to implement the game rules (validating a move) using core.logic, but I take it that isn't something core.logic would be suited for? kl. 11:42:18 UTC+2 mandag 11. august 2014 skrev puzzler følgende: > > I don't see how core.logic would apply here. > > You mi

Re: Core.logic for boardgames

2014-08-11 Thread Mark Engelberg
I don't see how core.logic would apply here. You might be interested in a Java-based general game playing engine which you can leverage from Clojure. Many take logical descriptions of the game rules in LISP form. http://www.ggp.org/ On Sat, Aug 9, 2014 at 3:51 AM, Robin Heggelund H

Re: Core.logic for boardgames

2014-08-11 Thread Henrik Eneroth
ey then can play together > online. > Does it make sense to implement the game logic using core.logic, and does > it transfer well to cljs (i'd like to share logic between backend and > frontend if i can)? > > I don't know core.logic, but would like to learn if it is

Core.logic for boardgames

2014-08-09 Thread Robin Heggelund Hansen
Hi. I'm starting a new project now, where users are presented with a set of boardgames (chess, checkers, othello...) which they then can play together online. Does it make sense to implement the game logic using core.logic, and does it transfer well to cljs (i'd like to share log

Re: core.logic API confusion

2014-06-13 Thread Norman Richards
On Mon, Jun 9, 2014 at 2:11 AM, JD wrote: > When I try to use core.logic's fact function I am getting a symbol not > found error. What is the idiomatic way to do something like: > > (logic/fact Orbits :mercury :sun) > > Orbits here was previously bound in a defrel, which I ended up replacing > w

core.logic API confusion

2014-06-09 Thread JD
ure's (2nd ed.) chapter on core.logic. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post.

Re: Core.logic appendo for string?

2014-05-05 Thread Tassilo Horn
David Nolen writes: > There's no easy way to do this beyond making your own relational > string type as you've suggested. FWIW, I had the same need as Adam and the poor-man's solution below is enough for my use-case. --8<---cut here---start->8--- (defn ground

Re: Core.logic appendo for string?

2014-05-04 Thread David Nolen
There's no easy way to do this beyond making your own relational string type as you've suggested. On Sunday, May 4, 2014, Adam Saleh wrote: > Hi, > > every once in a while I am toying with an idea of doing string > manipulation in core.logic. > > Naively trying t

Core.logic appendo for string?

2014-05-04 Thread Adam Saleh
Hi, every once in a while I am toying with an idea of doing string manipulation in core.logic. Naively trying to use appendo doesn't really work. As far as I understand, most of the magic, that enables core logic to work with lists is in the type LCons, that holds a sequence with tail th

Re: core.logic with functions

2014-04-29 Thread Phillip Lord
n Monday, April 28, 2014 3:36:10 PM UTC+2, Phillip Lord wrote: >> >> >> >> I can do this with core.logic (yes, I know that match-list isn't doing >> anything much here) >> >> (defn match-list [member list] >> (membero member list)) >> &

Re: core.logic with functions

2014-04-28 Thread Norman Richards
On Mon, Apr 28, 2014 at 8:36 AM, Phillip Lord wrote: > I want to do the same thing where the second argument is a list of > lists. So something like: [...] > > > Is there a way to do this with functions -- or do I need to macro it? As was already mentioned, everyg is probably the best way to app

Re: core.logic with functions

2014-04-28 Thread Jean Niklas L'orange
Hey Phillip, If you want to say "the goal g(x) shall succeed, for all x in this list", then use `everyg` from clojure.core.logic instead of map. I think it is exactly what you're looking for. On Monday, April 28, 2014 3:36:10 PM UTC+2, Phillip Lord wrote: > > > > I

core.logic with functions

2014-04-28 Thread Phillip Lord
I can do this with core.logic (yes, I know that match-list isn't doing anything much here) (defn match-list [member list] (membero member list)) (run* [q] (match-list 10 [1 10 100]) (== q "worked")) For q to come back with any values then 10 has to be part of the

Re: Solving allocation problems; code review and core.logic

2014-03-07 Thread Laurens Van Houtven
On Fri, Mar 7, 2014 at 3:50 AM, Mark Engelberg wrote: > On Thu, Mar 6, 2014 at 4:56 AM, Laurens Van Houtven <_...@lvh.cc> wrote: > >> Hm. I realize we're unlikely to change the nature of the problem, but >> would it help if we limit the search space? For example, if we only care >> about grants in

Re: Solving allocation problems; code review and core.logic

2014-03-06 Thread Mark Engelberg
On Thu, Mar 6, 2014 at 4:56 AM, Laurens Van Houtven <_...@lvh.cc> wrote: > Hm. I realize we're unlikely to change the nature of the problem, but > would it help if we limit the search space? For example, if we only care > about grants in increments of $50 or $100? Instead of working with dollars,

Re: Solving allocation problems; code review and core.logic

2014-03-06 Thread Laurens Van Houtven
On Thursday, March 6, 2014 12:19:25 PM UTC+1, puzzler wrote: > > Even though loco works on this small example, it doesn't scale well for > this kind of problem. I did a test on some randomly generated 3000 people, > and it's slow. (You can set the budget constraint to definitely spend the > wh

Re: Solving allocation problems; code review and core.logic

2014-03-06 Thread Mark Engelberg
Even though loco works on this small example, it doesn't scale well for this kind of problem. I did a test on some randomly generated 3000 people, and it's slow. (You can set the budget constraint to definitely spend the whole budget to speed things up, and set a timeout, but the quality of the s

Re: Solving allocation problems; code review and core.logic

2014-03-06 Thread Mark Engelberg
On Thu, Mar 6, 2014 at 12:21 AM, Laurens Van Houtven <_...@lvh.cc> wrote: > > Yep. A big part of the issue is that the *real* function that maps grant > fraction to probability of coming is of course unknowable. A linear > approximation is an excellent start. Once I have some test data I'll be > a

  1   2   3   4   5   6   7   >