Using SWI-Prolog 7.1 or later:
?- pack_install('https://github.com/TeamSPoon/gvar_syntax.git').
Source code available and pull requests accepted at http://github.com/TeamSPoon/gvar_syntax
?- use_module(library(gvar_syntax)).
true.
?- $foo.unify() = 1.
true.
?- $foo.unify() = 2.
false.
?- writeln($foo.get()).
1
true.
?- writeln($foo.get()).
1
true.
?- $foo.clear().
true.
?- writeln($foo.get()).
_8350
?- writeln($bar.set(2).get()).
2
?- $foo.set() = xxxxxxxx.
true.
?- $baz.set(point{ x: ($foo.get()) , y:vy, z:vz}).
true.
?- writeln($baz.get().x).
xxxxxxxx
true.
?- writeln($baz.x). % will error as you havent accessed the get()
Another Pack called dictoo adds better OO API on these values
Document this pack!
Write tests
Untangle the 'pack' install deps (Moving predicates over here from logicmoo_base)
Dislike having tons of forks that are several commits behind the main git repo?
Be old school - Please ask to be added to TeamSPoon and Contribute directly !
Still, we wont stop you from doing it the Fork+PullRequest method
Copyright (c) 2017, TeamSPoon and Douglas Miles logicmoo@gmail.com All rights reserved.