Arc Forumnew | comments | leaders | submitlogin
ArcCells: Dataflow/Reactive Programming Implementation (smuglispweeny.blogspot.com)
8 points by kennytilton 6071 days ago | 3 comments


4 points by almkglor 6070 days ago | link

I think Arc!Cells would really appreciate it if we could create assignable functions:

  (= some-function (fn () ...))
  (= (some-function parm parm) x)
My first idea is primarily to just transform code of the form

  (= (some-function . body) x)
to:

  (some-function ,@body ,x)
Thus, you can differentiate reader and writer modes via:

  (p-m:fn
    (param param) (reader ...)
    (param param val) (writer ...))
If you want to stick with arc1:

  (fn (param param . possible-value)
    (if possible-value
      (let val (car possible-value)
         (writer ...))
      (reader ...)))
The instantiation of Arc!Cells objects would then return a function with a closure containing cell formulae and values.

However, this won't work with variable-arity functions.

-----

2 points by kennytilton 6070 days ago | link

You made me look again at defset, looks promising:

  (mac defset (name parms . body)
    (w/uniq gexpr
      `(sref setter 
           (fn (,gexpr)
             (let ,parms (cdr ,gexpr)
               ,@body))
           ',name)))
An example being:

  (defset car (x)
    (w/uniq g
      (list (list g x)
          `(car ,g)
          `(fn (val) (scar ,g val)))))
I'll try it when I wake up. :)

-----

3 points by kennytilton 6070 days ago | link

Done and committed to CVS. Thx for the push!

-----