7 ms·
There are a bunch of libraries that will do this - here's one example of a python one: https://github.com/yuce/pyswip https://github.com/yuce/pyswip - and a rub
by dflock 10mo ago
There are a bunch of libraries that will do this - here's one example of a python one: https://github.com/yuce/pyswip https://github.com/yuce/pyswip - and a ruby one: https://github.com/preston/ruby-prolog https://github.com/preston/ruby-prolog
- ramses0 10mo agoThanks for the reference! `pyswip` is the closest I've seen so far: pl.consult("some-facts.pl") pl.assertz("new(fact)") while pl.Query(...).nextSolution(): print( X.value ) ...will definitely keep it in my back pocket!
- dragonwriter 10mo agopyswip is a one-way python-to-SWI-prolog interface; there's also a first-party (maintained as part of SWI-prolog), two-way one called janus-swi. https://pypi.org/project/janus-swi/ https://pypi.org/project/janus-swi/ https://www.swi-prolog.org/pldoc/man?section=janus-call-prolog https://www.swi-prolog.org/pldoc/man?section=janus-call-prol...