[Fluxus] proof of concept

Kassen signal.automatique at gmail.com
Mon Aug 30 06:48:21 PDT 2010


Dear list,

Below is a *very* simple fluxus editor, in fluxus that depends on the
debug-printing script I send before.
Run this. Hide the editor text with ctrl+h. Type something like
"(build-cube)". You do get enter to get a newline and backspace to remove
mistakes but no other editing functions. You also don't get to use strings
because otherwise my list of characters got confused.

Hit "f1" to execute your script.

next step; parenting all of the printed stuff to a locator so we can have
self-referential code that changes it's own colour and rotates and generally
makes it impossible to get anything done.

Yours,
Kas.


(clear)
(define all_characters (string->list "abcdefghijklmnopqrstuvwxyz 1234567890
()[]{}+-=<>/!@#$%^&*|"))
(define my_text "")

(define (eval-string input)
     (eval (read (open-input-string input))))

(define (keyb-out)
    (let ((output null))
        (map (lambda (x) (when (key-pressed-this-frame (string x))
                        (set! output (cons (string x) output))))
all_characters)
        output))

(define (typing)
    (let ((newchars (keyb-out)))
        (for ((x (in-range 0 (length newchars))))
            (set! my_text (string-append my_text (list-ref newchars x)))))
    (when (and (key-pressed-this-frame (string #\backspace))
            (> (string-length my_text) 0))
        (set! my_text (substring my_text 0 (- (string-length my_text) 1))))
    (when (key-pressed-this-frame (string #\return))
        (set! my_text (string-append my_text "\n")))
    (when (key-special-pressed-this-frame 1) (eval-string my_text))
    (if (> (string-length my_text) 0)
        (display my_text)
        (clear-print)))

(every-frame
    (typing))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pawfal.org/pipermail/fluxus-pawfal.org/attachments/20100830/956aa7ad/attachment-0001.htm>


More information about the Fluxus mailing list