Guile has the ability to define a soft port e.g. create a port with scheme code handlers that are executed in stead of C code when basic operations on the port is done. This works quite ok as long as one does not trip up due to the continuation …
We are going to play with an idea how to implement prolog programs using one shot continuation or simply where we allow a stack-code unit to be attached and detached to the active stack at will.
So the building blocks are that each predicate, \(f\), is defined as a vector …
We did some series of benchmarking between the fast assoc taking advantage of SIMD, the fast hash taking advantage of SIMD, normal assoc and normal guile hash. The keys used was integers and we performd tests for different sizes (N) with a differnt sizes subsample (M).
For small numbers of elements in an assoc list we know that a simple list assoc search is faster than a hash table lookup. The question is can we improve on the association list? First of all we could search a vector in stead of a list or even lay …
Hash tables are a real workhorse for programmers and is essentially a quite effective way to store an association between a key and a value. For small number of pairs a simple association list is quite efficient. But for larger numbers of elements, a hash table is usually best until …
Guile has adjustable stacks and one thing that struck me when implementing generators in python on guile with the help of delimited continuations are that the overhead is pretty high as one need to tear down store, reload and tear up the stack for it. If you apply the continuation …
In functional programming we pass the state as arguments to functions. It can be tedious to track all funciton arguments and not only this when we want to add an extra state parameter to a huge codebas you end up in an never ending work of updating function arguments and …
Considering associate meta information to functions. Closures are at your service but the question I had is if we could make it more functional. The idea is that at each time the value of a handle is unique and cloning is done through copying. Also we would like this to …
To compile scheme to native code natively how would we go about? Generating assebler and have a native compiler is kind of difficult if we want to reach a system that can compile to many different targets. What we would like is to take a scheme file and output byte …
This is a short discussion about how to model a flow of data enabling sharing and moving trough the datastructure in a left to right fashion. We ould like to cut out objects and insert them in other places and maintain everything in a prolog like datastructure.
This is a continuation of the paralell conjunction ideom i've been working on. Previously the system could not handle variables that is located in many branches at the same time e.g. if you set X=1 in one branch and X=2 in another you would get into troubles …
Execution of prolog code is sequential in nature, but one would like to be able to execute multiple algorithm in paralell. Turns out that swi's engine's are quite good att performing this task for us, we can fire up one engine per algorithm and generate answers back and let them …
My next task for guile-log is to make paralell engines store and restorable. This does not work before. In order to see how one can solve this with the already implemented framework, lets first recap paralell engines.
By issuing paralell engines e1,...en we device a scheme where we manually …
Check out wingo's fibers. I added support for fibers in guile-log and guile-log prolog. Fibers are an attempt to model multitasking, like in erlang, with cooperative scheduling (meaning that you need to enter a sleep now and then to allow other threads to run. Currently the interface is very simplistic …
A recent addition to swi prolog is engines. These objects are self contained prolog engines with their own stack that maintaines the computation state and will generate each answer back stepwise. Guile log have implemented the same API and is reachable from the library (logic guile-log guile-prolog engine). A good …
Having had a taste for executing things in paralell in kanren let's move over to guile-log. Executing stuff in paralell is similar but we can take advantage of variable binding beeing done directly on the variable and not bound in a binding data structure. The idea is for each engine …
We will discuss here a kanren version that will modify just partial results and not redo the whole datastructure in order change an underlying value. This means that we are considering paralell executions of code that only modify the data relevant to their code section the solution is a combination …
Swi prolog recently got predicate continuation and knowing of extearamly functional minkanren/microkanren is, one should be able to construct such a beast. Now in most languages you would need to make sure that a cach throw mechanism is working in the return values and somehow knit that together. But …
When coding my prolog VM I noticed that the overhead of a prolog call is in the order of 2M execution per second, and this is typically what I see when executing simple prolog perdicates in swi prolog as well. So all complexity that one need to care for simply …
Consider a variables, a box with a value. Guile-log has the notion of a state. At any point in time all the prolog varibales are bound. And this information can be stored in a state. The guile-log variables are more general than pure prolog variables in that they can be …
Prolog passes all in,out,in/out values as arguments to the predicate. This has the drawback, for out variables, that the variables need to be allocated from the heap and adds complexity and overhead to the predicate. If in stead the out variables could be passed over without making …
Let's consider the task to match something that has a type. We could use the extended matcher and :<, :, :>, as a default. If we don't like it it is possible to redefine it. So what to expect. We genereally constrain types to be of a
certain type.