Comments (5)
I just check the tests/lists, and member
defined there as follows;
clauses = @julog [
member(X, [X | Y]) <<= true,
member(X, [Y | YS]) <<= member(X, YS),
append([], L, L) <<= true,
append([X | XS], YS, [X | ZS]) <<= append(XS, YS, ZS),
reverse(X, Y) <<= reverse(X, [], Y),
reverse([], YS, YS) <<= true,
reverse([X | XS], Accu, YS) <<= reverse(XS, [X | Accu], YS)
]
and, a test case as follows;
resolve(@julog(member(banana, [avocado, banana, coconut])), clauses)[1] == true
It only works when member
explicitly defined in the clauses
. I thought it was a default feature?
from julog.jl.
I believe member
is a default feature of most variants of Prolog, but it's not implemented that way in Julog! Currently the only built-in predicates that Julog supports are those that can't really be defined as clauses (cut
, apply
, etc.). This could change in the future, but I would like to have a more modular and performant way for users to load libraries of clause definitions (as is done in Prolog), rather than building everything in.
from julog.jl.
I see, that's a good design approach. Actually, I was confused by the docs, where I read "member(b, [a, b, c]), are parsed in the same way as Prolog." I though member
is there by default. I believe stating it explicitly could be better.
Other than that, loading user defined types could also be good. Such as units from Unitful.jl. So that constant can be defined with a generic type such as Constant{T}
?
using Unitful
using Julog
w = @julog [ meter(1u"m") ]
from julog.jl.
Happy to change the README to make that more clear!
As for user-defined types like units, this is definitely possible if you manually construct constants using Const
. However, the parser defined by the @julog
macro doesn't really support calling other macros within it, and supporting this would take a fair amount of work. You're welcome to try and make that change if you would like!
(Note that making Const
a parametric types seems to slow things down for some reason, so it's something I haven't done in this library.)
from julog.jl.
Added the clarification to the README in 07bb2f1. I'm marking this issue as closed -- feel free to open a separate issue or PR to extend the parser to support user-defined types!
from julog.jl.
Related Issues (13)
- Resolve does not check for valid optional arguments HOT 1
- More Documentation or Examples HOT 3
- Enhancement proposal: use Metatheory.jl HOT 5
- Engine does not run through all available variants HOT 3
- Use of Julog to parse first order formulas in usual binary logic HOT 12
- Error: LoadError: $Expr(:incomplete, "...") & How to extend `builtins`? HOT 10
- References on breadth-first logic programming HOT 1
- Parsing for equivalence rules? HOT 9
- Parsing dot character Issue in `convert_prolog_to_julog` HOT 1
- License? HOT 1
- Term construction via template? HOT 7
- Too large an expression? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from julog.jl.