[plt-scheme] graphics states and Scheme

From: Henk Boom (lunarc.lists at gmail.com)
Date: Wed Jul 4 09:45:46 EDT 2007

On 04/07/07, Dave Griffiths <dave at pawfal.org> wrote:
> (push)                    ; push the state stack
> (translate (vector 0 1 0)); move up in y axis by 1
> (build-cube)              ; makes a red rotated cube, translated up by 1
> (pop)                     ; pop the state stack


> (grab mycube)             ; following commands now set to mycube's state
> (rotate (vector 1 0 0))   ; rotate it a bit in the x axis
> (ungrab)                  ; grabs can be nested

First thing I did when I started using opengl in scheme was eliminate
this sort of explicit parenthesizing. I found it really ugly, because
if we are using these hordes of parentheses anyways, we may as well
leverage them for all they're worth. Compare:

(translate (vector 0 1 0))


  (translate (vector 0 1 0))

This also helps prevent problems which would be caused by unmatched
push and pop calls. The indentation will also improve readability with
nested calls. Just my $0.02. =)

Hope this helps,
    Henk Boom

Posted on the users mailing list.