
Show HN: Forward − a scheme front end framework inspired from elm - amirouche
https://framagit.org/forward/website/blob/fs-pages/index.md
======
amirouche
In the most recent version create-app procedure looks like the following:

    
    
      (define (create-app+ container init view)
      (let ((state (init)))
        (letrec ((spawn (lambda (proc)
                          (set-timeout (lambda () (proc state spawn)) 1000)))
                 (make-action (lambda (action)
                                (lambda args
                                  (let ((new (apply (action state spawn) args)))
                                    (set! state new)
                                    (render)))))
                 (render (lambda ()
                           (set! container (patch container
                                                  ((sxml->h* make-action) (view state)))))))
          render)))
    

Basically it says that instead returning two values (first value being the new
state and the second value being the intended side effect) it will only return
the new state. But, it will take another argument with the state called spawn.
The signature of actions is now state -> spawn -> dom-event -> state. Spawn
will schedule the lambda passed as argument. I will change spawn to look more
like apply, so that it takes the arguments of the lambda as argument. This
will make testing easier.

