Syndicate

Houston We Have Circles

Today, we have the first successful eval of a Klee program!

(begin
  (define (map f l)
      (if (null? l)
          (list)
          (cons (f (car l)) (map f (cdr l)))))
  (stroke 1 (rgb 1 1 1)    
      (map (lambda (x) 
              (circle (point (* 8 x) (* 8 x)) (* x (/ x 25.0)))) 
              (range 100))))

When you load this program into a Klee interpreter, and evaluate it, it produces a series of draw commands that when encoded and passed to the GPU, evaluate to the following image:

Devlog

Apr 25, 2025

The Circle is Moving!

We’re now animating the screen at 60fps using wayland’s frame callbacks:

here is the associated program that is driving that animation:

(stroke 1 (rgb 1 0.1 0.1) 
  (circle (point 
            (+ 200 (* 50 (sin (/ (now) 600.0)))) 
            (+ 200 (* 77 (cos (/ (now) 533.0))))) 
    50))

Worm

(stroke 10 (rgb 1 0.1 0.1) 
  (path (moveto (point 50 50)) 
        (curveto 
          (point 200 (+ 200 (* 100 (sin (/ (now) 100.0)))))
          (point 300 (+ 300 (* (- 0 100) (sin (/ (now) 100.0)))))
          (point 450 450)))

Syntax Experiments

One way I’ve been working on Klee, is to sketch out example programs and explain how they should behave, before the implementation can sufficiently execute the commands I’m drawing out.

During

The during keyword is used in proper syndicate implementations, and plays the same roll in Klee. It takes the default form:

(during P <E_b> <E> <E_r>)
  • P is the pattern we are matching the dataspace against

  • E_b denotes “expression before” and is the expression run for a defined amount of time “before” the assertion appears. The idea here is to have three dedicated lifetimes of a shape “before” “during” and “after”. Because we cannot predict the future, before instead needs to start when the assertion is first asserted, and as mentioned previously, lives for a defined amount of time in this state. One major use case for this is fade-in animations.

Overview

A diagram of 2 actors, A and B asserting fragments of a klee program to a third actor, K.

Two Syndicate actors, A and B, make assertions into a Klee dataspace.

Background

The problem: We have an actor that has a rich internal model of some domain, and we want to use this model to generate a graphic design and render it to the user, how do we do this?

Ambient Dataspaces

hello

Work-in-progress for now. Will be similar in functionality to the tuplespaces in AmbientTalk