Comments (4)
freeze/2
is one of the simplest constraints and comparatively easy to implement in C, so this may seem tempting.
dif/2
is already considerably harder to implement correctly, at least if you want it to be in some sense "clever". For example, even after several rounds of correction and rewrites, SWI-Prolog still has elementary mistakes in its (Prolog-based) dif/2
implementation. It stands to reason that a C-based implementation would be a lot harder still to get right and maintain.
Writing clpz
and clpb
in C will most likely end in a system that, even if you manage to implement it correctly, will be immune to large-scale improvements and rewritings due to its extreme code size. The situation will be similar to Gecode, where implementing significant improvements "is not hard, it is just very tedious" (https://www.gecode.org/users-archive/2017-August/004989.html), and hence not done.
Attributed variables, in addition to enabling the implementation of constraint solvers, also provide O(1) destructive access to terms, and that can be useful to implement graph-based algorithms efficiently.
Personally, I recommend to implement an (ideally: SICStus-compatible) interface for attributed variables as early as possible in a Prolog system, so that its implementation is taken into account at all stages during development. Doing this later may lead to unanticipated complications. Once the interface is available, more and more components (freeze/2
, dif/2
, when/2
etc. which you mentioned) can be written in Prolog itself, and that keeps the code of the system small and maintainable, and also provides motivation to make the interpreter itself fast. The more you write in C, the less important the Prolog-aspect of the system becomes: Doing as much as possible in C may result in a nice and very large C program, though one that will likely not be very good at running Prolog code.
I say "ideally" SICStus-compatible because SICStus provides correct implementations of dif/2
, CLP(B), CLP(FD) and CLP(Q) based on its interface, and this shows that the interface is general enough to implement a wide range of constraint solvers correctly and efficiently.
from trealla.
Native freeze/2, dif/2, when/2 sounds cool. Tau Prolog doesn't support them at all, which is one of the big motivations to work on the WASM stuff for Trealla. After working with Tau a lot, I've been longing to use dif/2 :)
Attributed variables would be great to keep, of course, maybe for experimental stuff — but I'd consider these predicates a little more practical.
from trealla.
Dropping atvs means probably that there will never be a clpz
nor clpq
. Also, as a general remark on "native" built-in implementations, this has in my view often contributed to more instability than in other implementations. Finding an optimal tiny kernel to start with is certainly not obvious. My armchair advice...
from trealla.
from trealla.
Related Issues (20)
- top_level/0 Aborted (core dumped)
- json(true) isn't always JSON sympathetic HOT 8
- call/N aberration HOT 4
- when/2 misperceives the past HOT 1
- Frozen rain smashes variable HOT 4
- String leak? HOT 17
- Using displayed answer produces dissatisfying result HOT 4
- Reloading the same Logtalk file with Trealla as the back-end causes unexpected failure. HOT 9
- Feature request: (=@=)/2 or variant/2 builtin HOT 7
- Segmentation fault (core dumped) HOT 8
- How use the dialect flag for flexible directives HOT 2
- Trealla performance core dump HOT 18
- Trail not recovered on TCO HOT 4
- include/1 from ISO core standard missing HOT 3
- Top-level call issue HOT 8
- Syntax error message unclear
- Read term discrepancy in reported term position while running Logtalk predicate_property/2 tests HOT 12
- Segmentation fault (core dumped)
- Error message not in phase HOT 1
- Performance blackout (killed) HOT 9
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 trealla.