1 answer

WARMR (ACE suite): eliminate “connected” terms from frequent patterns

i am using the WARMR frequent pattern algorithm in the ACE data mining suite. here is a toy example illustrating my problem. imagine you have, say, 20 examples (example(ex1)),...,example(ex20))) and ...

1 answer

Arithmetic operations in the head of a clause

I am a writing Prolog predicate that would compare some point (myPosition(2,2)) in Cartesian coordinate system with some other point in the neighbourhood. As a result, it should show the direction ...

1 answers | Dec 12 '15 at 18:24 by Zaslon on Stack Overflow stackoverflow.com
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, ...

1 answers | Dec 9 '15 at 15:19 by charqus on Stack Overflow stackoverflow.com
4 answers

How is this context free grammar using difference lists in Prolog functioning?

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 ...

1 answer

Prolog minimum value in a list

I'm working on defining a predicate min_in_list/2 that would find the smallest value on a list. If there is less than 2 elements in the list the program should output "Error: There are not enough ...

2 answers

Are regular expressions an example of logic programming?

I'm just wondering if regular expressions fit into the definition of what Logic Programming is. It is a set of rules which given a set of facts yields a result depending on how the query is asked. To ...

2 answers | Nov 30 '15 at 16:44 by user10628 on Stack Overflow stackoverflow.com
2 answers

Prolog multiply all elements of a list

I want to define a predicate in Prolog, prod_list/2 that multiplies every element of a list. I'm having problem with the empty list wish the product should be zero, instead i get false. My code is ...

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 '15 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 answers | Oct 17 '15 at 12:17 by Dschehuti Nefer on Stack Overflow stackoverflow.com
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? ...

1 answers | Oct 16 '15 at 13:20 by Leonardo Lima on Stack Overflow stackoverflow.com
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 '15 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 '15 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 '15 at 11:52 by shink on Stack Overflow stackoverflow.com
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 '15 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 '15 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 '15 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 ...

1 answers | Jul 4 '15 at 8:19 by Mischa Arefiev on Stack Overflow stackoverflow.com
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 '15 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 '15 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 ...

15 30 50 per page
1 2 3