Other articles


  1. Printing Doubles

    Printing reals in guile head has the following characteristics.

    > (define x (make-vector 10000000 0.8888888888888888888888))
    > (define p (open-file "/dev/null" "w"))
    > time (begin (write x p) 1)
    
    15.812557s real time, 15.808950s run time.  0.000000s spent in GC.
    

    Now with my heavily optimized SCM/C …

    read more
  2. Suspendable Soft Ports

    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 …

    read more
  3. One Shot Prolog

    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 …

    read more
  4. Association Performans Test

    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).

    Here is the table …

    read more
  5. Association List

    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 …

    read more
  6. Hash tables

    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 …

    read more
  7. One Shot Continuations

    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 …

    read more
  8. Call And Define

    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 …

    read more
  9. functool

    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 …

    read more
  10. Native Compilation

    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 …

    read more
  11. Tables

    As soon as you see a table most computer programmers probably think about databases. And that's probably right, many times. But always?

    In a table we manage a set of rows with a key or id field. If the table is small, say less than 10.000 the science of …

    read more
  12. Text Data Structure

    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.

    The idea of …

    read more
  13. Paralell 2 Ideom

    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 …

    read more
  14. Paralell Ideom

    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 …

    read more
  15. Store The State Of Multiple Paralell Engines

    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 …

    read more
  16. Guile fibers

    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 …

    read more
  17. Swi Engines in Guile Log

    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 …

    read more
  18. Dependency and Guile Log

    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 …

    read more
  19. Dependency and Kanren

    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 …

    read more
  20. Continuations in Minikanren

    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 …

    read more
  21. Fast Looping in Prolog

    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 …

    read more
  22. Set Mania

    We are going to explore how set's are handled in guile-log prolog. Lets start off simple.

    To define a set just do:

    X is {1,2,3}.
    
    X = {1,2,3}
    

    We have added common set operators e.g.

    % union e.g. all combined elements (cup in latex).
    ?- X is …
    read more
  23. Versioning

    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 …

    read more
  24. Return Values

    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 …

    read more
  25. Type Magic

    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.

    f(X :< number, Y …
    read more

links

social