Ugur,<br><br>It would be very helpful for me if you would translate the tutorials into Scheme -- please do this, I would greatly appreciate it. I&#39;m using a few different applications that are all Scheme-based and it would be really nice to include Grace in that group and be able to just have my students stay in one standard programming environment (Scheme). That way, they only have to learn one language (which is also happily of very broad applicability.)<br>
<br>Tim<br><br><div class="gmail_quote">2009/10/27 Uğur Güney <span dir="ltr">&lt;<a href="mailto:ugurguney@gmail.com">ugurguney@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
# Hi!<div># After so much questions I asked, I wanted to share what I have learned. I translated the first 4 SAL tutorials to Scheme and attached them.</div><div># When a comment needs to be changed I erased it and put a &quot;...&quot;. I did not to try change them :-)</div>

<div># I you think that this maybe helpful I can complete the translation of the tutorials.</div><div># Have a nice day!</div><div>v.u.g<br><br><div class="gmail_quote">2009/10/26 Uğur Güney <span dir="ltr">&lt;<a href="mailto:ugurguney@gmail.com" target="_blank">ugurguney@gmail.com</a>&gt;</span><div>
<div></div><div class="h5"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"># Thank you very much! Now I understand the loop macro. I forgot &quot;do&quot; keywords.<div>
# And now I have another problem about sprouting process&#39;.</div>
<div># This is the SAL example of a process:</div><div><br></div>
<div><div><font face="&#39;courier new&#39;, monospace">define process simple()</font></div><div><font face="&#39;courier new&#39;, monospace">  run repeat 20</font></div>
<div><font face="&#39;courier new&#39;, monospace">    send &quot;mp:midi&quot;, key: between(60, 96)</font></div><div><font face="&#39;courier new&#39;, monospace">    wait .1</font></div>
<div><font face="&#39;courier new&#39;, monospace">  end</font></div><div><span style="font-family: &#39;courier new&#39;,monospace;">sprout simple()</span></div><div># Every time I evaluate sprout line, grace plays midi notes.</div>


<div><br></div><div># And here is my Scheme version:</div><div><span style="font-family: &#39;courier new&#39;,monospace;">(define simple2</span></div><div><div><font face="&#39;courier new&#39;, monospace">  (process repeat 20 do</font></div>


<div><font face="&#39;courier new&#39;, monospace">           (send &quot;mp:midi&quot; :key (between 60 96))</font></div><div><font face="&#39;courier new&#39;, monospace">           (wait 0.1)))</font></div>
<div><span style="font-family: &#39;courier new&#39;,monospace;">(sprout simple2)</span></div></div><div># The evaluation (by CTRL+Enter) of sprout line plays only for once. After that I have to evaluate the process definition again, to play it again.</div>


<div># I suspect that second evaluation does not create a new process but tries to use the old one. But I am not sure. Or I am making mistakes again :-)</div><div># Regards,</div><div>v.u.g</div></div><div><br><br><div class="gmail_quote">


2009/10/25 Heinrich Taube <span dir="ltr">&lt;<a href="mailto:taube@uiuc.edu" target="_blank">taube@uiuc.edu</a>&gt;</span><div><div></div><div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div>
<br>
On Oct 23, 2009, at 2:49 AM, Uğur Güney wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
# Dear list and Mr. Taube<br>
# I want to use Grace with Scheme rather than SAL. I am using version 3.3.0 svn:1769. I looked at the &quot;SAL tutorials&quot; and tried to convert them to Scheme code. But I think some SAL commands does not exist in Scheme version. Like:<br>



<br>
print &quot;Hello, world!&quot; -&gt; (print &quot;Hello, world!&quot;)<br>
# gives &quot;print: unbound variable&quot; error. I can just evaluate<br>
&quot;Hello, world!&quot;<br>
# or try<br>
(display &quot;Hello, world!&quot;)<br>
# But the output of (display) is yellow, not green and does not have &quot;\n&quot; character at the end.<br>
</blockquote>
<br></div>
you can use s7&#39;s  &#39;format&#39;  function. that function will both print the message to the terminal and return the string it printed:<br>
<br>
<br>
cm&gt; (format #t &quot;hello world~%&quot;)<br>
hello world<br>
&quot;hello world<div><br>
&quot;<br>
<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
print &quot;my key number: &quot;, between(60, 90) -&gt; (display &quot;my key number: &quot;  (between 60 90))<br>
# gives &quot;display argument 2, 66, is an integer, but should be an output port&quot; error. I have to write<br>
(string-append &quot;my key number: &quot; (number-&gt;string (between 60 90)))<br>
</blockquote>
<br></div>
(format #t &quot;my key number: ~S~%&quot; (between 60 90))<div><br>
<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
# Another component I could not find (which is, I think, more important) is the loop macro.<br>
loop repeat 5<br>
  print &quot;a random keynum: &quot;, random(128)<br>
end<br>
---&gt;<br>
(loop re peat 5<br>
      (random 128))<br>
# gives: &gt;&gt;&gt; Error: Found &#39;re peat&#39; where operator expected.<br>
clause context: &#39;re peat 5 (random 128)&#39;<br>
</blockquote>
<br></div>
(loop repeat 5 do (format #t &quot;a random keynum: ~S~%&quot; (random 128))<div><br>
<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
# and<br>
<br>
loop for c in {a b c d e f g }<br>
  print c<br>
end<br>
---&gt;<br>
(loop for c in &#39;(a b c d e f g)<br>
      (display c))<br>
# gives: &gt;&gt;&gt; Error: Expression expected but source code ran out.<br>
<br>
</blockquote>
<br></div>
(loop for c in &#39;(a b c d e f g) do (format #t &quot;~S~%&quot; c))<br>
<br>
or better<br>
<br>
(loop for c in &#39;(a b c d e f g) collect c)<div><br>
<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
# Similarly,<br>
loop for x from 1 to 10<br>
  print &quot;x=&quot;, x<br>
end<br>
----&gt;<br>
(loop for x from 1 to 10<br>
      x)<br>
# gives the same error.<br>
<br>
</blockquote>
<br></div>
(loop for i from 1 to 10 collect i)<div><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
# Of course a recursive approach using car&#39;s and cdr&#39;s works.<br>
(define (play-chord chd)<br>
  (if (not (equal? chd &#39;()))<br>
    (begin (send &quot;mp:midi&quot; :key (car chd))<br>
           (play-chord (cdr chd)))))<br>
(play-chord &#39;(50 55 60))<br>
</blockquote>
<br></div>
(define (play-chord chd)<br>
  (loop for x in chd do (send &quot;mp:midi&quot; :key x)))<div><br>
<br>
(play-chord &#39;(50 55 60))<br>
<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
# But I think that the loop macro is not implemented in Grace. Am I correct or making a mistake?<br>
</blockquote>
<br></div>
you&#39;re making mistakes (plural)  ;)<br>
<br>
read the common lisp documentation on loop, most of it is supported.<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
# Best regards,<br>
-ugur guney-<br>
_______________________________________________<br>
Cmdist mailing list<br>
<a href="mailto:Cmdist@ccrma.stanford.edu" target="_blank">Cmdist@ccrma.stanford.edu</a><br>
<a href="http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist" target="_blank">http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist</a><br>
</blockquote>
<br>
</blockquote></div></div></div><br></div>
</blockquote></div></div></div><br></div>
<br>_______________________________________________<br>
Cmdist mailing list<br>
<a href="mailto:Cmdist@ccrma.stanford.edu">Cmdist@ccrma.stanford.edu</a><br>
<a href="http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist" target="_blank">http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Dr. Timothy Ernest Johnson<br>