Git Product home page Git Product logo

Comments (2)

guregu avatar guregu commented on July 28, 2024

Reduced it further:

:- module(js_toplevel, [js_ask/1]).

:- use_module(library(lists)).

js_ask(Input) :-
	read_term_from_chars(Query, [variable_names(Vars)], Input),
	query(Query, Status),
	write(Vars), nl, write(Status), nl,
	call_any_predicate(Status). % deleting this fixes it?

call_any_predicate(_).

query(Query, Status) :-
	% weird:
	catch(Query, Error, true),
	% ok:
	% call(Query),
	query_status(true, Error, Status).

query_status(_OK, Error, error) :- nonvar(Error), !.
query_status(true, _, success).
query_status(false, _, failure).

person(socrates).
person(plato).
mortal(X) :- person(X).

I think optimization is the culprit:

$ ./tpl --version
Trealla Prolog (c) Infradig 2020-2022, v2.2.15

# weird
$ ./tpl js_toplevel.pl -g 'js_ask("mortal(X)")' --ns
[X=socrates]
success
   true
;

# ok
$ ./tpl js_toplevel.pl -O0 -g 'js_ask("mortal(X)")' --ns
[X=socrates]
success
   true
; [X=plato]
success
 true
; 

from trealla.

infradig avatar infradig commented on July 28, 2024

from trealla.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.