Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

seriose lisp programming

Name: Anonymous 2008-01-23 12:53

How/what libs?
Mainly sockets and SDL stuff.
Please tell me i can use these in scheme. I don't want to read steeles book on common lisp it's huge ;_;
currently i am using MIT/scheme.

Name: Anonymous 2008-01-24 13:57

>>15
Real Scheme code. Note the hilarious hack and the manually passed random state.
(map (lambda x
           (let ((idx (random 12 random-state)))
            (make-music 'EventChord
             'elements (list (make-music 'NoteEvent
                              'duration (ly:make-duration 2 0 1 1)
                              'pitch (ly:make-pitch (quotient idx 7)
                                      (remainder idx 7)
                                      0))))))
       (make-list 32)))))

How it would look in CL. Notice the improvement in every way.
(loop
  for i below 32
  for note = (random 12)
  for octave = (truncate note 7)
  for class = (mod note 7)
  collect (make-music
           'EventChord
           'elements
           (list
            (make-music
             'NoteEvent
             'duration (ly:make-duration 2 0 1 1)
             'pitch (ly:make-pitch octave class 0)))))

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List