Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
zmonx
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
18 ms
·
91.
▲
by
zmonx
9y ago
To reason about dates and times in a purely declarative way with Prolog, the best way I have seen is library(julian) by Michael Hendricks: http://mndrix.github.io/julian/ For example: ?- form_time([2014-5-1], T).
92.
▲
by
zmonx
9y ago
Prolog indeed seems eminently suitable for this use case. For example, let us consider the first use case shown on the page: graql>> match $x isa movie; $y isa person; $z isa movie value "Avatar"; (
93.
▲
by
zmonx
9y ago
To express "I expect input that, when sorted, has this porperty", you have to use slightly more modern language features that are called constraints . For example, let us describe sorted lists of integers : sorted([]).
94.
▲
by
zmonx
9y ago
Whom and who are we to judge!
95.
▲
by
zmonx
9y ago
No, whom! Prolog killed him, not Prolog killed he. To get the reference, you have to follow some HN submissions on Prolog...
96.
▲
by
zmonx
9y ago
This is a very good summary of the situation, thank you for posting this. However, one critical issue is omitted in the above: The suggested approach (SegWit), albeit probably more by coincidence than by intention, also corrects a shortcomi
97.
▲
by
zmonx
9y ago
Whom killed Prolog? Answer: It killed counter-strike agents not based on Prolog. A few quotes from the paper that I found especially interesting: Prolog is a general-purpose declarative programming language, which bases strongly on a fir
98.
▲
by
zmonx
9y ago
Thank you for this! Interestingly, the cases you mention cannot arise in Prolog, because Prolog terms are never evaluated implicitly. They are just terms, and you write predicates that reason over them. In pure Prolog, there is no way t
99.
▲
by
zmonx
9y ago
Yes, I agree with this. In SWI-Prolog, in addition to library(persistency), there are already some published results on transaction support for the internal database, which will give you some features that facilitate such use cases. This is
100.
▲
by
zmonx
9y ago
I am referring here to the fact that first-order logic is sufficiently expressive to describe how a Turing machine works, making FOL Turing-complete and thus, as a special case, making every computation you can carry out on a computer expre
101.
▲
by
zmonx
9y ago
SMT solvers typically only support decidable theories, and since first-order logic is not decidable (only semi-decidable), such solvers are not as expressive as Prolog. In Prolog, the more natural approach that closely corresponds to SM
102.
▲
by
zmonx
9y ago
SAT is about a very special case of logic, namely propositional logic, where every variable stands for exactly one of only two possible truth values. Finding satisfying assignments in propositional logic is indeed already a computationall
103.
▲
by
zmonx
9y ago
It is of course completely true that the order matters a great deal in this case. In fact, in this case, the order of goals matters much more than students typically realize! In my experience, students who write down and then run the firs
104.
▲
by
zmonx
9y ago
Thank you for your explanation! I do not in the least dispute that the goal of PHP was to help people, or that people managed to build web sites for the intended use cases. In fact, if one of PHP's goals was to allow a great number of
105.
▲
by
zmonx
9y ago
Why are you downvoting what I wrote? You are arguing against statements I did not make. PHP worked for many people in what I can only consider a quite generous definition of "worked", in tandem with countless security problems tha
106.
▲
by
zmonx
9y ago
A language like PHP greatly increases the chance of security problems. There is ample evidence of such issues in practice. This is one consequence of the quite low-level way to reason about the available data, and a class of problems that d
107.
▲
by
zmonx
9y ago
This is not the case: Prolog has several higher order constructs like the call/N family of predicates, maplist/[3,4] and foldl/N. Your particular example of transitive relations is one of the most elementary examples that
108.
▲
by
zmonx
9y ago
I once asked a retired Japanese computer scientist why the 5th generation project had failed. He said: "What do you mean 'failed'? All my former colleagues who had worked on this project went on to become full professors!&quo
109.
▲
by
zmonx
9y ago
Thank you for your interest! Since Prolog is now gaining more traction, I am adding to my favourites all Prolog links which I consider noteworthy or recommended reading. Please see my profile for more information, and also for future update
110.
▲
by
zmonx
9y ago
The naming trick makes clear what each position means: The order of arguments follows that of the name's components. So, if the name contains id_user_text, then the arguments are also in this order: ID of comment, ID of user, and the t
111.
▲
by
zmonx
9y ago
Picat is a very interesting development. Note though that it, at least currently, omits some key features of Prolog such as the homoiconic syntax, and definite clause grammars (DCGs).
112.
▲
by
zmonx
9y ago
... for a quite generous definition of "worked". In comparison, writing web applications with SWI-Prolog is quite safe also thanks to the powerful quasi-quotation mechanism.
113.
▲
by
zmonx
9y ago
I second this. When writing Prolog programs, the more you think procedurally, the more specific your programs will become in the sense that you can then typically only use them in specific directions . To make your Prolog code as general a
114.
▲
by
zmonx
9y ago
I definitely agree that a sufficiently smart compiler and/or fast interpreter is an extremely important asset when working with Prolog, and also that it takes almost superhuman effort to write such compilers. However, at least in my ex
115.
▲
by
zmonx
9y ago
There are several ways to do it. One straight-forward way is as follows: We can represent comments by facts like: comment_id_user_text_points(3, 1, 'hello!', []). I do not know what exactly you mean by "points"
116.
▲
by
zmonx
9y ago
Thank you! Indeed, the question was "how" would I do it, so let us consider it: Operating system in Prolog: Non-trivial, i.e., like in Java. Command-line tool: Pretty simple: My main predicate receives command line arguments. Ther
117.
▲
by
zmonx
9y ago
These are good questions! As a simple control, I have asked myself these questions with Java in mind, which enjoys notable popularity. Would I write an operating system in Java? No. A Unix command-line too? No. A video game? Probably not. I
118.
▲
by
zmonx
9y ago
Have you been exposed to more recent research on Prolog language constructs? In particular, I recommend the following publication: https://arxiv.org/abs/1607.01590 if_/3 and other declarative predicates like dif&#
119.
▲
by
zmonx
9y ago
First of all, I fully agree that it is hard to start with Prolog initially. However, let us take a look at these particular examples: As to opening a file and reading its contents as a string : I find it best to use Ulrich Neumerkel's
120.
▲
by
zmonx
9y ago
Please don't take the following as "lazy programmers unwilling to learn a simple build-and-install process": Please consider filing this as an issue with the SWI-Prolog team, to benefit everyone who runs SWI-Prolog as such an
More ›