[CM] Grace: Scheme and SAL differences

Uğur Güney ugurguney at gmail.com
Fri Oct 23 00:49:14 PDT 2009

# Dear list and Mr. Taube
# I want to use Grace with Scheme rather than SAL. I am using version 3.3.0
svn:1769. I looked at the "SAL tutorials" and tried to convert them to
Scheme code. But I think some SAL commands does not exist in Scheme version.

print "Hello, world!" -> (print "Hello, world!")
# gives "print: unbound variable" error. I can just evaluate
"Hello, world!"
# or try
(display "Hello, world!")
# But the output of (display) is yellow, not green and does not have "\n"
character at the end.

print "my key number: ", between(60, 90) -> (display "my key number: "
 (between 60 90))
# gives "display argument 2, 66, is an integer, but should be an output
port" error. I have to write
(string-append "my key number: " (number->string (between 60 90)))

# Another component I could not find (which is, I think, more important) is
the loop macro.
loop repeat 5
  print "a random keynum: ", random(128)
(loop repeat 5
      (random 128))
# gives: >>> Error: Found 'repeat' where operator expected.
clause context: 'repeat 5 (random 128)'

# and

loop for c in {a b c d e f g }
  print c
(loop for c in '(a b c d e f g)
      (display c))
# gives: >>> Error: Expression expected but source code ran out.

# Similarly,
loop for x from 1 to 10
  print "x=", x
(loop for x from 1 to 10
# gives the same error.

# Of course a recursive approach using car's and cdr's works.
(define (play-chord chd)
  (if (not (equal? chd '()))
    (begin (send "mp:midi" :key (car chd))
           (play-chord (cdr chd)))))
(play-chord '(50 55 60))
# But I think that the loop macro is not implemented in Grace. Am I correct
or making a mistake?

# Best regards,
-ugur guney-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ccrma-mail.stanford.edu/pipermail/cmdist/attachments/20091023/091b61f6/attachment.html 

More information about the Cmdist mailing list