swi-prolog

Proper unify_with_occurs_check/2 in SWI-Prolog?

余生颓废 提交于 2021-01-16 01:13:52
问题 Got this strange behaviour. I was running these test cases: s1 :- Q=[[lambda,symbol(_3026),[cons,[quote,_3434], [quote,_3514]]],[quote,_3206]], P=[_3434|_3514], freeze(_3434, (write(foo), nl)), unify_with_occurs_check(P, Q). s2 :- Q=[[lambda,symbol(_3026),[cons,[quote,_3434], [quote,_3514]]],[quote,_3206]], P=[_3434|_3514], freeze(_3434, (write(foo), nl)), freeze(_3514, (write(bar), nl)), unify_with_occurs_check(P, Q). Now I get these results, where the outcome of s2 is wrong. The outcome is

Proper unify_with_occurs_check/2 in SWI-Prolog?

北慕城南 提交于 2021-01-16 01:09:28
问题 Got this strange behaviour. I was running these test cases: s1 :- Q=[[lambda,symbol(_3026),[cons,[quote,_3434], [quote,_3514]]],[quote,_3206]], P=[_3434|_3514], freeze(_3434, (write(foo), nl)), unify_with_occurs_check(P, Q). s2 :- Q=[[lambda,symbol(_3026),[cons,[quote,_3434], [quote,_3514]]],[quote,_3206]], P=[_3434|_3514], freeze(_3434, (write(foo), nl)), freeze(_3514, (write(bar), nl)), unify_with_occurs_check(P, Q). Now I get these results, where the outcome of s2 is wrong. The outcome is

Proper unify_with_occurs_check/2 in SWI-Prolog?

好久不见. 提交于 2021-01-16 01:08:47
问题 Got this strange behaviour. I was running these test cases: s1 :- Q=[[lambda,symbol(_3026),[cons,[quote,_3434], [quote,_3514]]],[quote,_3206]], P=[_3434|_3514], freeze(_3434, (write(foo), nl)), unify_with_occurs_check(P, Q). s2 :- Q=[[lambda,symbol(_3026),[cons,[quote,_3434], [quote,_3514]]],[quote,_3206]], P=[_3434|_3514], freeze(_3434, (write(foo), nl)), freeze(_3514, (write(bar), nl)), unify_with_occurs_check(P, Q). Now I get these results, where the outcome of s2 is wrong. The outcome is

Proper unify_with_occurs_check/2 in SWI-Prolog?

戏子无情 提交于 2021-01-16 01:08:46
问题 Got this strange behaviour. I was running these test cases: s1 :- Q=[[lambda,symbol(_3026),[cons,[quote,_3434], [quote,_3514]]],[quote,_3206]], P=[_3434|_3514], freeze(_3434, (write(foo), nl)), unify_with_occurs_check(P, Q). s2 :- Q=[[lambda,symbol(_3026),[cons,[quote,_3434], [quote,_3514]]],[quote,_3206]], P=[_3434|_3514], freeze(_3434, (write(foo), nl)), freeze(_3514, (write(bar), nl)), unify_with_occurs_check(P, Q). Now I get these results, where the outcome of s2 is wrong. The outcome is

Can higher order Prolog help closure expansion?

自作多情 提交于 2021-01-05 07:28:29
问题 If I enter this code in SWI-Prolog: goal_expansion(println(X), (write(X), nl)). test :- call(println, 'Hello World!'). Listing shows me this result: test :- call('__aux_wrapper_8a89205eca9a6ffb31dd01cc968a2aa022fa1f49', 'Hello World!'). '__aux_wrapper_8a89205eca9a6ffb31dd01cc968a2aa022fa1f49'(A) :- write(A), nl. Would a higher order Prolog do the same? Are there higher order Prologs that have goal expansion and/or closure expansion? 来源: https://stackoverflow.com/questions/65289298/can-higher

Can higher order Prolog help closure expansion?

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-05 07:28:18
问题 If I enter this code in SWI-Prolog: goal_expansion(println(X), (write(X), nl)). test :- call(println, 'Hello World!'). Listing shows me this result: test :- call('__aux_wrapper_8a89205eca9a6ffb31dd01cc968a2aa022fa1f49', 'Hello World!'). '__aux_wrapper_8a89205eca9a6ffb31dd01cc968a2aa022fa1f49'(A) :- write(A), nl. Would a higher order Prolog do the same? Are there higher order Prologs that have goal expansion and/or closure expansion? 来源: https://stackoverflow.com/questions/65289298/can-higher

Prolog: Murder Mystery

做~自己de王妃 提交于 2020-12-15 01:59:28
问题 I found the following murder mystery puzzle. Since I don't know much about Prolog except the basics, I cannot really evaluate the solution, however, it didn't seem particularly nice to me. My solution is not enough to generate the correct answers so I'm looking for some pointers as to how to get there or if it's at all possible to get there with my approach. Here's the puzzle just in case the link goes down: jean was killed on Tuesday; the only suspects are: Luc, Paul, Alain, Bernard and

Prolog: Murder Mystery

狂风中的少年 提交于 2020-12-15 01:55:15
问题 I found the following murder mystery puzzle. Since I don't know much about Prolog except the basics, I cannot really evaluate the solution, however, it didn't seem particularly nice to me. My solution is not enough to generate the correct answers so I'm looking for some pointers as to how to get there or if it's at all possible to get there with my approach. Here's the puzzle just in case the link goes down: jean was killed on Tuesday; the only suspects are: Luc, Paul, Alain, Bernard and

Prolog: Murder Mystery

时光毁灭记忆、已成空白 提交于 2020-12-15 01:53:34
问题 I found the following murder mystery puzzle. Since I don't know much about Prolog except the basics, I cannot really evaluate the solution, however, it didn't seem particularly nice to me. My solution is not enough to generate the correct answers so I'm looking for some pointers as to how to get there or if it's at all possible to get there with my approach. Here's the puzzle just in case the link goes down: jean was killed on Tuesday; the only suspects are: Luc, Paul, Alain, Bernard and

foreign library can't be loaded

青春壹個敷衍的年華 提交于 2020-12-14 23:54:29
问题 A C library contains this code: /* * Custom specific code here... * several static functions. */ /** * receiveMessages( +Socket, ?DoorsAreOpen, ?DoorsAreClosed, ?CabinRequests, ?CabinLocation, ?LandingRequests ) */ static foreign_t receiveMessages( term_t Socket, term_t doorsAreOpen, term_t doorsAreClosed, term_t cabinRequests, term_t cabinLocation, term_t landingRequests ) { int sockfd; return PL_get_integer_ex( Socket, &sockfd ) && sockfd && udpReceive( sockfd, doorsAreOpen, doorsAreClosed,