Older blog entries for tampe (starting at number 109)

A parallel brain is more expressive then an unparallel one

Assume that we have deduced a state S and there are two possible choices S1 and S2 to go from there how to zip them together?

One idea is to assume S1 outputs z1 and S2 outputs z2 and just combine these outputs e.g.

(zip-1 (z1 z2)
     (subshell S1 z1)
     (subshell S2 z2))
Here we create z1 and z2 on an outer stack, then run S1, it produces a value into z1 that are deduced on an inner stack. Then it will keep z1 and revert back to the initial state but store a continuation that are reinstated at back-tracking. This will be able to mimic generator behavior through back tracking. It is safe code because the interface is clear and has a potential performance bottleneck in that we need to reinstall the state of S1 and S2 at back tracking.

The other idea is to consider the stack as a DAG and use two branches of the stack describing the deduction S1 and then deduction S2. First S1 is done, then S2. and the state will be done on-top of each other but the action will be stored in branches e.g. a storage of a variable pointer and a value. But at backtracking, then we will just first backtrack S2 and by doing this not touch the other stack branch. Then we will backtrack S1 and not do the undos on the S2 stack branch. If there are a variable touched in both S1 and S2, with backtracking touching it only in S1 or only in S1 unpredictable things can happen. So this method is faster but can produce strange bugs.

Again parallel generation of sequences can be simulated using this trick.

In all, zip patterns call's for a more delicate stack engine then the common stack implementation one need to manage a forest of DAG's that should support continuation style of separation and storage. linked structures are attractive here due to it's simplicity in these situations, on the other hand the speed of allocations from a stack represented by an array is also attractive. Maybe a combination.

Life on a t-shirt

Oh and now over to that jolly song from all of yo together on that crucifix hill in easter time, one two three ...

One of my favorite t-shirt ideas is to have all the religious celebrities together on crucifixes, (mohammed pained as a cloud with perheps lips showing that he sings along) and all of them singing and smiling :-) And the song should of cause be the one from the life of brian - Always look on the bright side ...)

This picture tell the simple minded theo/philo-egoists in the world to fuck off to some deep cave and keep us hard working people to continue with what we are good at, or, Hey teacher, We don't need your silly religious war, leave them kids alone, or simply C.U. cooperate stupid.

Over to some cool mathematical play. Did you know that the fundamental law's of force physics is non-linear? This have a kind of cool direction, let's call it the twilight direction. The thing is that a common theme to express solution to non-linearity, especially when the nonlinear part is weak, is to first just solve for the linear solution X, then solve for the twighlight solution T, which we get by solving the linear equations again but with a source that represent the nonlinear part applied to X and construct the solution as X + T. Similarly this technique can under a fix-point theorem result in an infinite expansion that lead to a solution to the nonlinear equation.

So, basically T is small ripples that lives on top of the real fat and dirty reality called X. And if the connection is really weak we would never detect T. We should have seen it already if that was the case right! Now over to crystallography. What's cool with this technology is that if you can build a crystal of say hemoglobin, (e.g. the same molecule is reproduced over and over again in a periodic lattice), then you can sort of overlay picture signals of all entities in the crystal and by statistical laws the details get many times more clear then by just looking at one single entity with some kind of microscope. So consider some kind of periodic twighlight ripple T. and consider sensors in billions of places throught a volume, wouldn't that magnify the probability of detection considerable, I wonder if humans have build any similar device to try detect the twilight zone, I know the homo crackpottus have tried it in another universe somewhere.

Oh, I put a little "easter egg" somewhere in _this_ universe so that you can perhaps understand my math (yes a little prose attached to the math) ;-) ... happy reading


Alex Shinn, has written a library for scheme that does formatting tasks in a functional style, the fmt library. In this library there is a package for outputting c code. Let's play with that.

A next step might be to be able schemify c code. e.g. introduce <define>, <let*>, <begin>, <if> and <recur> + the operators. The innovation needed to do this is to make sure that everything return values and are able to be composed together with some kind of "sewing" mechanism.

The idea of attacking this is to try keep everything functional as far as possible and then at the final step add syntactic sugars in the form of macros. When trying to do this one realizes that we need two phases of evaluation. The reason are this, consider a function application:

int f(int),
f((<let*> ((a (+ b c))) (<if> q a b)) + b)?
Now the idea of modelling is to let the statments evaluate to a lambda that takes as an argument #f or a symbol. The lambda applied to a symbol will mean that the result of that expression will generate c-code where the tail expressions will set the symbol to the return result. so we do stuff like,
(define (f-if p x y)
    (lambda (ret)
       (let ((pred (gensym "pred"))
           (c-var 'int pred)   ; define pred integer
           (p pred)            ; execute p expression
                               ; pred is the result
           (c-if pred (x ret) (y ret))))))
This will illustrate the technique (we are using autoquoting features in the macro package). Over to the function application. Here we conclude that in order to be general we need to use
   (int arg)
   (c= ret `(f ,arg))
E.g. we introduce an arg symbol to be able to set it. Doing this we need to know about the function signature. Designing the <define> as a function means that we are not able to register the function signature before the body is evaluated and the function signature needed in case of recursion. So one need one extra lambda dereference. I thught that was too complicated though and used macros in stead to accomplish correct registration order.

The function example lack some wow factor. But for the loop construct in clambda, the <recur> statement, it's a must. Here is how the idea of this works

(<recur> loop ((int n 100) (int s 0)
    (<if> (< n 0)
          (<next> loop (+ s 314))))
Aproximate translation
 int n = 100;
 int s = 0
 if (n < 0)
    ret = s;
    s = s + 314;
    goto loop;

This is kind of handy loop construct and again one need to register the loop symbols this time in order to be able to expand the <next> statement later on.

This is about 300 lines of code. For 600 I guess you would be able to introduce a good enough c to produce workable code with syntax line numbers introduced as well to be able to debug after gcc has found your bugs.

Now this is not that complicated and everything is just a quite simple idea of syntactic sugars. But this will enable scheme macro facilities to your c-code (for one thing you will be able to track source code line numbers to be able to debug your macros correctly. Also going between clambda and pure scheme is a smaller step then between c and scheme this means that you can keep a large part of say guile c-code both in c and scheme at the same time.

Have fun


Can strange things happen, that matters. I don't know, but strange indeed are the day's I live in. To keep sane is a big struggle and without ears plugged with music. I would not know where I would be.

Anyhow here is a spooky story.

I met an old woman a couple a weeks back and she talked about many things, fools and queens, high and low. But what I previously did not remember was how she spoke about a book, her exact words I don't know, but she talked about an o and a dot.

Then I forget about her, and a week later I sat down and thought a poem on a piece of math would be so perfect. Thinking about my old ford and the day's back when I was young I got into the right mood of writing the poem. And the dance went on. At the end I saw that it was not perfect. I wanted to move the text to the right and wrote "o." at the beginning without knowing why, I just did it cause writing a poem is to express feelings and then I just relax and let the hand walk across the keyboard. So, focus! It struck me, just struck me, don't ask me why,..., why don't write "o.o" instead of "o." and so I did. And so I did.

And so I did, I need to keep that python syntax correct, don't I.

And time passes, life went boring and I took a walk to the library. I stood there just feeling empty and pointed the finger at a shelf of books, letting the finger wander from book to book, reading the titles without thinking, and then I picked, as it felt, randomly, the Illusionist by Fowler.

This is a kind of cool book and in the beginning the character of importance move to a lonely place, becomes depressed and decide to shoot himself with a shotgun. And at the moment the trigger is supposed to go off, Fowler writes the characters o and dot. Probably, to make an illusion of end of life.

The effect of this happening to me is tremendous. I had a brother you know, and his life did not end with an illusion. I took a long walk and did not calm down until I met a family of deers that just stood there about 10m in front of me, relaxing, and reminded me about how life goes on.


When thoughts flow too fast





Play it again Sam!

Dream on folks!

A flow of thoughts

So, I start as usually with my bad prefix.



A huge hug to you all

New year's mini search.






Have fun!








Have fun


Compress that for me, please


(def sum-of-leaves
   (()           0)
   ( X           X))



So consider destructuring


we could do this with a stack machine like,

(push A)         ;; Stack -> (A)
(cdddr A)))
(set U)          ;; Stack -> ()
(list X L U)
;;; reset and the next pattern will be tried.




What's growing on your head old moose







(18) (19) (20) (21)
(22) (15) (16) (17)
(14) (11) (12) (13)
(8)  (9)  (10) (7)
(6)  (4)  (5)  (3)
(2)  (1)




Have fun

100 older entries...

New Advogato Features


