On Tue, Mar 3, 2009 at 2:27 PM, David MacQuigg <span dir="ltr">&lt;<a href="mailto:macquigg@ece.arizona.edu" target="_blank">macquigg@ece.arizona.edu</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


<div>At 10:00 AM 3/2/2009 -0800, michel paul wrote:<br>
<br>
&gt;&gt;Before I discovered Python a couple of years ago I was experimenting with a pseudo-code approach for expressing math concepts.  I had this kind of stuff in mind:<br>
&gt;&gt;<br>
&gt;&gt;factorial(n):<br>
&gt;&gt;    if n &lt; 2 ---&gt; 1<br>
&gt;&gt;    else ---&gt; n*factorial(n-1)<br>
<br>
</div>&gt;I like the feeling of action in ---&gt;, but I also like the self-explanatory &quot;return&quot;.  Any other suggestions?  Strong preferences?</blockquote><div><br>Oh no, not at all.  My only point in even bringing this up was that I had been trying to formulate something like a CTL awhile ago, and then I discovered Python.  Wow!  What I found so delightful is that the kind of pseudo-code I was contemplating looked a whole lot like Python!  I thought that was a really good sign.  Yeah, Python is pseudo-code that runs!  It already is a CTL.<br>

<br>I think the most useful CTL for integration in math education should be as close to ordinary algebra as possible.  That&#39;s what I had been trying to get at.  Kids in algebra classes initially get confused by this &#39;return&#39;.  It doesn&#39;t look like what they usually see in math.  So I thought an arrow might correspond to mapping notation for functions:  f: x ---&gt; y vs. Euler notation: f(x) = y.  So that&#39;s why I originally opted for the arrow.  However, once they&#39;ve had even a little experience, the use of &#39;return&#39; isn&#39;t all that strange to them.  And then, the other day when I had them create generators for their HW assignment on sequences, wow!  I was really pleased that they got the idea that &#39;yield&#39; just meant that the function was on hold until called again.  They seemed OK with that.<br>

 </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">&gt;It would be nice to avoid in CTL the complexities of precedence and associativity rules (very non-fundamental knowledge).  How about we just do all operations in the order they occur, unless you force a different order with parens.<br>

</blockquote><div><br>In terms of integration into math classes, I think it would be better to maintain the traditional order of operations.  (I realize here that I&#39;m emphasizing math/CS fusion at a secondary level, and you&#39;re talking about CS0.)  But using parentheses to clarify order - definitely!  And then from there, it&#39;s easy to create functional compositions.  Now, I wouldn&#39;t emphasize functional composition for ALL simple arithmetic expressions - that would just be silly.  But I think doing that is an excellent kind of exercise.  And then beyond that - turn the functional compositions into binary expression trees!  I&#39;ve had kids do that in math classes as exercises in order of operations.  Take a typical arithmetic expression that has several things going on and turn it into a binary expression tree.<br>

<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>&gt;&gt;By the way, we started studying sequences today in class.  What&#39;s a really good Pythonic tool for studying sequences ---&gt; generators!<br>


<br>
</div>&gt;Should we include generators in CTL?  Seems like students at this level should have graduated to a full-featured language.  </blockquote><div><br>Right, I&#39;m not sure generators would need to be in a CTL.  Again, in terms of math education, I would see the role of a CTL simply as providing a bridge between traditional static algebra and a more dynamic computational algebra.  Since Python is already so close to a CTL, by the time we started including generators, we might as well just be using Python.<br>
 </div>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">&gt;# function returning a tuple (sneaky introduction to objects)<br>
&gt;f(a,b): (a, (a+b)/2, b)</blockquote><div><br>Yes, tuples as proto-objects!  I&#39;ve thought about that a lot.  I think that would be very practical in the math curriculum.  Tuples, ordered lists, can very easily represent all kinds of mathematical objects.  I think a good computational math route starting in traditional algebra would be to develop the idea of tuples as representing various kinds of mathematical objects and to write functions that operate on these tuples and then to integrate this functionality into the &#39;tuples&#39; themselves.<br>
<br>- Michel<br></div></div><br>