clojure-core.logic

Can anyone explain me about the sh in clojure in order to execute the system command?

筅森魡賤 提交于 2021-02-05 12:24:55
问题 I'm using Mac OS. I want to execute a system command using (use '[clojure.java.shell :only [sh]]) , like in How to execute system commands?. I have read https://clojuredocs.org/clojure.java.shell/sh but wasn't able to understand things like how many parameters can be passed in one syntax, etc. In windows I have tried (sh "cmd" "/C" "dir") and it was working but in Mac OS, how do I execute the above syntax? Moreover I want to pass more parameters than just dir . For example, I want to execute

core.logic stackoverflow when using sets

非 Y 不嫁゛ 提交于 2021-01-03 02:14:14
问题 It seems that clojure.core.logic has a problem walking sets. The minimal failing example: (run* [q] (== q #{})) produces java.lang.StackOverflowError at clojure.core.logic.Substitutions.walk(logic.clj:344) at clojure.core.logic$walk_STAR_$fn_ 2633.invoke(logic.clj:216) at clojure.core.logic$eval2838$fn _2839.invoke(logic.clj:956) at clojure.core.logic.protocols$eval1389$fn_ 1390$G _1380__1397.invoke(protocols.clj:55) at clojure.core.logic$walk_STAR_.invoke(logic.clj:214) at clojure.core.logic

core.logic stackoverflow when using sets

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-03 02:09:19
问题 It seems that clojure.core.logic has a problem walking sets. The minimal failing example: (run* [q] (== q #{})) produces java.lang.StackOverflowError at clojure.core.logic.Substitutions.walk(logic.clj:344) at clojure.core.logic$walk_STAR_$fn_ 2633.invoke(logic.clj:216) at clojure.core.logic$eval2838$fn _2839.invoke(logic.clj:956) at clojure.core.logic.protocols$eval1389$fn_ 1390$G _1380__1397.invoke(protocols.clj:55) at clojure.core.logic$walk_STAR_.invoke(logic.clj:214) at clojure.core.logic

core.logic stackoverflow when using sets

放肆的年华 提交于 2021-01-03 02:08:39
问题 It seems that clojure.core.logic has a problem walking sets. The minimal failing example: (run* [q] (== q #{})) produces java.lang.StackOverflowError at clojure.core.logic.Substitutions.walk(logic.clj:344) at clojure.core.logic$walk_STAR_$fn_ 2633.invoke(logic.clj:216) at clojure.core.logic$eval2838$fn _2839.invoke(logic.clj:956) at clojure.core.logic.protocols$eval1389$fn_ 1390$G _1380__1397.invoke(protocols.clj:55) at clojure.core.logic$walk_STAR_.invoke(logic.clj:214) at clojure.core.logic

core.logic stackoverflow when using sets

寵の児 提交于 2021-01-03 02:06:12
问题 It seems that clojure.core.logic has a problem walking sets. The minimal failing example: (run* [q] (== q #{})) produces java.lang.StackOverflowError at clojure.core.logic.Substitutions.walk(logic.clj:344) at clojure.core.logic$walk_STAR_$fn_ 2633.invoke(logic.clj:216) at clojure.core.logic$eval2838$fn _2839.invoke(logic.clj:956) at clojure.core.logic.protocols$eval1389$fn_ 1390$G _1380__1397.invoke(protocols.clj:55) at clojure.core.logic$walk_STAR_.invoke(logic.clj:214) at clojure.core.logic

Core.logic finite domain with -ve values

≯℡__Kan透↙ 提交于 2020-02-03 10:21:44
问题 I am not sure why the below code doesn't return any result when using -5 as one of the domain value user=> (run* [q] (infd q (domain -5 5)) (*fd q q 25)) () user=> (run* [q] (infd q (domain 0 5)) (*fd q q 25)) (5) NOTE: This code refers to behavior in the core.logic 0.8.0 betas. 回答1: There is no support currently in the core.logic 0.8.0 betas for domains with negative values at all. If it works it's completely by accident. I don't intend on personally working to add support for this in the

What does non-relational mean in practice for core.logic?

孤街醉人 提交于 2020-01-03 20:57:04
问题 When trying to understand core.logic throgh the API docs I come across Non-Relational goals and relational goals. I have no idea what this means in practice and why it is important to annotate goals if they are relational or not. Can you explain with example how the goals are used differently depending on if they are relational or not? 回答1: In order to explain what non-relational means we need to revisit what relational means. If you consider pure functions in functional programming, they

Clojure core.logic CLP(FD) projecting FD variables

拜拜、爱过 提交于 2019-12-20 01:59:20
问题 I'm working on a naive square-packing algorithm using Clojure's core.logic CLP(FD) library (core.logic version 0.8.3). Squares are represented like so: [[[x11 y11] [x12 y12]] [[x21 y21] [x22 y22] ...]] with each square represented as the coordinates of its top-left and bottom-right corners. Coordinates are FD variables, within a certain interval. I want to define the size of a solution as the distance between the top-right corner and bottom-right corners of the closest and farthest squares to

Prolog matching vs miniKanren unification

橙三吉。 提交于 2019-12-06 02:39:52
问题 In Prolog - Programming for Artificial Intelligence, Bratko says the following on page 58. "Matching in Prolog corresponds to what is called unification in logic. However, we avoid the word unification because matching, for for efficiency reasons in most Prolog systems, is implemented in a way that does not exactly correspond to unification. Proper unification requires the so-called occurs check: does a given variable occur in a given term? The occurs check would make matching inefficient."

conda, condi, conde, condu

a 夏天 提交于 2019-11-26 18:45:10
I'm reading the Reasoned Schemer . I have some intuition about how conde works. However, I can't find a formal definition of what conde / conda / condu / condi do. I'm aware of https://www.cs.indiana.edu/~webyrd/ but that seems to have examples rather than definitions. Is there a formal definition of conde , conda , condi , condu somewhere? In Prolog's terms, condA is "soft cut" , *-> , and condU is "committed choice" – a combination of once and a soft cut, so that (once(A) *-> B ; false) expresses the cut in (A, !, B) : A *-> B ; C %% soft cut, condA once(A) *-> B ; C %% committed choice,