1 answer

Generating a parser with `inverse`, with constraints on the grammar

I recently followed through A Taste of Curry, and afterwards decided to put the trivial arithmetic parser example to test, by writing a somewhat more substantial parser: a primitive but correct and ...

2 answers

Compact vs full/verbose definition of the inverse combinator/operator in Curry

The rather fascinating 2013 introductory post to the Haskell based KiCS2 implementation of Curry by Wolfgang Jeltsch, A Taste of Curry, provides the following definition for the inverse combinator: ...

1 answer

How to limit search space in Curry?

Below is my first program in Curry. It prints sequence of steps required for reaching a desired solution (walking through a closed door). Evaluating expression: main Done (Just [Open,Walk,Close]) ...

1 answers | Nov 2 at 21:51 by Rumca on Stack Overflow stackoverflow.com
1 answer

Zero of a quadratic function using Racket's logic paradigm

First of all, I want to apologize for the following question. I am a total noob with Racket, but I was quite interested after I have learned about its logic programming feature. Sadly there is only a ...

1 answer

How do I implement my own list in Prolog?

I am learning Prolog and I know there is a data structure already implemented to handle Lists, but I was wondering and if for some reason I want to implement my own data structure, how can I do that? ...

7 answers

Relational/Logic Programming in Python?

I'm a longtime python developer and recently have been introduced to Prolog. I love the concept of using relationship rules for certain kinds of tasks, and would like to add this to my repertoire. ...

7 answers | Oct 6 at 20:48 by AJ. on Stack Overflow stackoverflow.com
1 answer

Prolog: Symmetric Rules

I'm following a Prolog tutorial that asks to define a symmetric relation. Say for instance you have the following fact in the knowledge base: colleague(john,bob). You also want ...

1 answers | Oct 2 at 14:38 by Wolff on Stack Overflow stackoverflow.com
2 answers

Documentation for the Prolog dialect Prova

I would like to switch from SWI-Prolog to Prova - but it seems to be harder than expected: Predicates like succ() are not available and operations like Var1+Var2>Var3 do not work (obviously it ...

2 answers | Oct 2 at 11:52 by shink on Stack Overflow stackoverflow.com
4 answers

How is this context free grammar using difference lists in Prolog functioning? It's completely over my head

I'm reading this tutorial on context free grammars in Prolog, and they mention at the bottom of the page implementing a context free grammar in Prolog using difference lists, with the following code ...

0 answers

How do I view how Prolog got to its result/the path it took?

I have a simple Prolog predicate that spits accepts a variable, Result, that calculates a result then stores it in Result to be viewed. Sometimes I'm unsure how it comes to the answer it stores in ...

1 answer

WARMR algorithm in ALEPH (SWI-Prolog)

i am trying to use WARMR to find frequent relational patterns in my data; for this i am using ALEPH in SWI-Prolog. however, i am struggling to figure out how to do this and why my previous attempts ...

1 answer

How do I get a list from an association list in Prolog, and then either append to it or create it if it doesn't exist?

Apologies for the convoluted title, but the gist of what I'm trying to do is I have a hash table/association list with a bunch of keys, each corresponding to a list. My issue lies with the fact I ...

1 answer

Why is this contradictory clojure.core.logic/featurec result being returned?

...and how can I avoid it? (run* [q] (featurec q {:a 1}) (featurec q {:a 2}))) returns ((_0 :- (clojure.core.logic/featurec _0 {:a 2}) (clojure.core.logic/featurec _0 {:a 1}))) which ...

4 answers

Prolog : Enumerate All Elements of Countably Infinite Results

Are there any prolog implementations that are able to enumerate all elements of countably infinite results? Let's consider to enumerate all pairs of natural numbers. If we enumerate pairs in order ...

4 answers | Aug 22 at 17:22 by egi on Stack Overflow stackoverflow.com
13 answers

Embedded Prolog Interpreter/Compiler for Java

I'm working on an application in Java, that needs to do some complex logic rule deductions as part of its functionality. I'd like to code my logic deductions in Prolog or some other logic/constraint ...

2 answers

Is the `append` predicate tail-recursive?

A typical code example of list processing in Prolog is append: append([], Ys, Ys). append([X | Xs], Ys, [X | Zs]) :- append(Xs, Ys, Zs). My question is whether this program is tail recursive or ...

2 answers | Aug 12 at 22:50 by day on Stack Overflow stackoverflow.com
0 answers

how Sets and Relations are useful and related to logic programming?

i am getting started with logic programming, but i am forced to do contents of discrete mathematics first. but i don't see the relation here. Sets however is used in predicate logic but Relations, how ...

1 answer

Modelling recipes and available ingredients with constraint logic

Imagine I have a number of recipes for different dishes and a larder containing various ingredients in my kitchen. I want to construct a model using core.logic which will enable me to answer the ...

0 answers

Restriction of resolution - logic programming-horn clause

I am confused about restriction of resolution especially input resolution. In one of the input resolution exercise, we began to resolve the clauses with negative horn clause. Question 1: Do we have ...

2 answers

Can pyDatalog be used to check if all data dependencies are satisfied?

I am trying to use pyDatalog to determine if the dependencies for various features are satisfied. Some library (lA,lB,...) provides outputs (1,2,...) which are needed by features (fX,fY,...). For ...

2 answers | Jul 6 at 11:39 by kerblogglobel on Stack Overflow stackoverflow.com
1 answer

Logic programming: how to distribute resources among consumers?

I have a task in which I must distribute unique resources among consumers. Rules are: each consumer has a set of resource types they can use, each resource is unique, each consumer must receive n>0 ...

3 answers

Prolog XOR on elements of list

I am new in Prolog and I would like to apply XOR operation on elements of given list of length n. The predicate should return True if list contains some false elements in the first n-1 element or if ...

3 answers | Jun 29 at 17:44 by user3074510 on Stack Overflow stackoverflow.com
3 answers

Logic programming in Lua?

Is there a way to do logic programming (think of Prolog) in Lua? In particular: is there any Lua module for logic programming (miniKanren implemenatation will be the best, but it isn't strictly ...

3 answers | Jun 24 at 22:16 by mnicky on Stack Overflow stackoverflow.com
1 answer

SWI Prolog pass a goal with non-zero arity through the command line arguments

SWI Prolog allows the execution of a goal before top level with non zero arity as follows swipl -s consultingfile.pl -g start however when a predicate with non zero arity is specified as follows ...

3 answers

Swapping consecutive items of a list in Prolog

I'm trying to write Prolog code that can swap two elements of a list, but only if they are consecutive to each other. That is, conseq_swap(d, e, [a, g, d, e, f], X). should give: X = [a, g, e, d, ...

1 answer

Finding similar sets with clojure's core.logic / minikanren

this is my first question on Stack Overflow. I’m new to logic programming and are trying to evaluate if it can be used to solve some matching problems I’m working on. Problem: Lets say we have a ...

1 answer

Prolog combinatorics

Is there any way to generate all possibilities like 9 letters to be divided in 3 teams, like this: - 1st team: 2 letters - 2nd team: 3 letters - 3rd team: 4 letters ? Example: find([a, b, c, d, e, ...

1 answers | May 22 at 20:12 by charqus on Stack Overflow stackoverflow.com
1 answer

Dijkstra path (not only distance)

I have the code that calculates the minimum distance of Dijkstra path. Can you help me edit my code in order to not only print the minimum distance, but the full path too? % ...

1 answers | May 22 at 19:23 by charqus on Stack Overflow stackoverflow.com
1 answer

Fixed Point and Proof theory

For any given logic program, proof theory of it uses SLD (Selective Linear Definite) resolution to find the satisfiablity of the query. For the same logic program, we can apply fixed point theorem to ...

1 answer

Community resources for the Maude Language

Where do I go for interactive help when learning the Maude Language? I've found books, tutorials, and webpages with excellent instruction. I can't find any sort of interaction such as an IRC ...

1 answers | May 3 at 2:07 by MRocklin on Stack Overflow stackoverflow.com
15 30 50 per page
1 2 3