Questions tagged [logic-programming]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
-2 votes
1 answer
52 views

System design to present live query results over realtime data

Question What is a good storage layer, coding paradigm, and query language for computing over realtime data? Use-case For example, stock and options prices are (essentially) realtime data streams. I ...
geofflittle's user avatar
1 vote
1 answer
25k views

How to use Try/catch and database transaction in PHP and laravel [closed]

I'm planing to use Try/Catch and Database Transaction in Laravel5 and my own PHP project to validate any errors occurs then rollback avoiding lost my transaction or information during user do their ...
Heng Sopheak's user avatar
2 votes
3 answers
811 views

Logic Programming(Unification) vs List Comprehensions (in Functional Programming)

I found this answer on StackOverflow very clear to explain the difference beween the Logic Programming paradigm and the Functional Programming paradigm: The thing that makes logical append ...
Qqwy's user avatar
  • 4,789
0 votes
1 answer
767 views

Creating algorithms [closed]

I am a relatively new programmer. I can pick up languages and learn syntax at a speed that I consider good, but I can't figure out how to solve problems logically using algorithms very well. I know ...
jklsfdgs's user avatar
2 votes
0 answers
120 views

What makes the functional and logic programming paradigms well suited for programming AI? [duplicate]

I have been researching different programming paradigms. I have found a lot of people saying that one of the areas where logic and functional programming are particularly good is programming AI, but I ...
user3787574's user avatar
4 votes
1 answer
149 views

Multivariable decisions

I am running into a situation where my program can have different outcomes depending on the state of some variables. 4 variables are involved and they can all have different ( 3 to 4 different states)....
mbashir's user avatar
  • 143
0 votes
1 answer
198 views

Calculating WPM given a variable stream of input

I'm creating an application that sits in the background and records all key presses (currently this is done and working; an event is fired every keydown/keyup). I want to offer a feature for the user ...
Scott's user avatar
  • 123
-1 votes
1 answer
701 views

Trying to break elements which are lists in a list? [closed]

I am trying to write a program which make the following: ?- g([2,3, [22,[3],9] ,4,[5],99],X). X= [2,3,22,[3],9 ,4,5,99] so it searches for lists in the given list and replace it by their elements ...
user avatar
20 votes
2 answers
5k views

How to implement interactive programs (like games/simulations) using logic programming?

I've heard that logic programming can serve as a general-purpose alternative to other programming paradigms such as OO or functional programming. (Since Prolog is Turing-complete, this must be so!) ...
Alex D's user avatar
  • 1,308
2 votes
1 answer
271 views

Given a situation, and some conditions, verify is that situation is possible

Well it's a problem me and my friend had thought of, and well, haven't come up with anything to solve the following problem(I'll try to phrase it in the best way I can): Given that there are n ...
pradyunsg's user avatar
  • 245
9 votes
2 answers
3k views

How would I combine 'Command' and 'Composite' to simulate a time delay?

As a learning exercise (I am not in school - just an old guy trying to learn something new), I am trying to write a logic gate simulation that incorporates propagation delay. The user should also be ...
Neil Mussett's user avatar
8 votes
8 answers
2k views

AND is better or using Internal "IF" [duplicate]

In a situation like this:" if ((metadata != null) && (metadata.TypeEnum != VariantInfoMetadata.CellTypeEnum.Status)) do you recommend to keep the code as it is above? Or is it better to ...
Blake's user avatar
  • 839
5 votes
3 answers
1k views

Is saying "if ( $a != null && $a == 5)" the same as "if ($a == 5)"

First off, sorry if this is answered somewhere else. I did a brief search, but wasn't sure how to ask in search terms. I'm looking at some code and came across lot's of statements like this: if ( ($...
user127379's user avatar
0 votes
1 answer
2k views

Strategy for writing a logic program

I have had a hard time learning logic programming thus far, and my request for outside resources on this site was met with some opprobrium, so perhaps this question better addresses both my needs and ...
Ben's user avatar
  • 101
15 votes
1 answer
5k views

Is the Mercury Programming Language used in the field?

I've strong interests in Functional and Logic programming and Mercury seems like a good blend of the two. Is it used in industry at all? I'm one to learn a language just for the fun of it but it would ...
user avatar
218 votes
18 answers
108k views

How can one manage thousands of IF...THEN...ELSE rules?

I am considering building an application, which, at its core, would consist of thousands of if...then...else statements. The purpose of the application is to be able to predict how cows move around in ...
3 votes
1 answer
963 views

Good introduction to metaprogramming in Prolog?

I would like to make for example imperative programs as output of Prolog (shaders of graphic card) and also event-driven programs (game logic) ... also I would like to learn how to metaprogram in ...
user712092's user avatar
  • 1,412
7 votes
4 answers
3k views

Data Structures to represent logical expressions

Here is a logical statement: term1 AND (term2 OR term3) OR term4 What is an effective way of storing this information in a data structure? For example, should I use a graph, with a property on each ...
Trindaz's user avatar
  • 195
3 votes
3 answers
729 views

Scheme and Functional programming is to "Structure and Interpretation of Computer Programs" as Prolog and Logic programming is to what book? [closed]

I'm looking for some advice how to get started with Logic programming, and I am really enjoying working through the Scheme book "Structure and Interpretation of Computer Programs." Is there a similar ...
Joshua Aresty's user avatar
12 votes
3 answers
6k views

Why (not) logic programming?

I have not yet heard about any uses of a logical programming language (such as Prolog) in the software industry, nor do I know of usage of it in hobby programming or open source projects. It (Prolog) ...
Anto's user avatar
  • 11.2k