Archive for January, 2008
@program = ::poem
La poesÃa no es algo. La poesÃa lo es todo.
Música con idea es poesÃa. Música sin idea es simplemente música.
Hoy vi algo en un blog del PLT que me dejó anonadado. Un pequeño programita, tan bello y hermoso que tuve que leerlo varias veces para asimilar la experiencia estética. Lo pongo aquÃ, con crédito a matthias en este post de un blog perdido por ahÃ.
;; [LISTOF X] -> ( -> X u 'you-fell-off-the-end-off-the-list) (define (generate-one-element-at-a-time a-list) ;; (-> X u 'you-fell-off-the-end-off-the-list) ;; this is the actual generator, producing one item from a-list at a time (define (generator) (call/cc control-state)) ;; [CONTINUATION X] -> EMPTY ;; hand the next item from a-list to "return" (or an end-of-list marker)' (define (control-state return) (for-each (lambda (an-element-from-a-list) (set! return ;; fixed (call/cc (lambda (resume-here) (set! control-state resume-here) (return an-element-from-a-list))))) a-list) (return 'you-fell-off-the-end-off-the-list)) ;; time to return the generator generator)1 comment