"Bill Kerr" <kerrb@senet.com.au> writes: >In my MW semi-visual solution I iterated upwards rather than downwards, >because I was copying what Ken did in ToonTalk. In ToonTalk thats an >important point because the procedure stops when the scale equalises. ie. >its driven by the visual component, whereas its just a luxury add on in the >MicroWorlds version. But in MicroWorlds it is possible also to do a >semi-visual solution by iterating downwards as well (one again illustrating >that multiple solutions are easier in MicroWorlds). I don't think this is true. I bet in TT you could put a zero in a box, leave it there unchanged all the time, and then put your scale between that zero and the variable you're counting down. It's just that in TT you have to take the extra step of building a box and putting a zero in it, whereas in MW (or any Logo) you say IF :N=0 ... and it doesn't feel like an extra step. >Please tell me why 0!=1. All of the computer programs we've been considering are based on the recurrence relation n! = n * (n-1)! Plug in n=1 in that equation: 1! = 1 * 0! So 0! = 1!. Another argument: n! is the number of ways to rearrange n things. So for example the three things A,B,C can be arranged 3!=6 ways: ABC, ACB, BAC, BCA, CAB, CBA. Imagine representing this as a Logo list of words: [ABC ACB BAC BCA CAB CBA]. So, how many ways are there to arrange zero things? There's one way, the empty word. (If one arrangement of three things is a three-letter word, then one arrangement of zero things will be a zero-letter word.) So we'll represent the complete set as a list containing the empty word. In Logo this is printed just like an empty list, but its count is 1, not 0: ? make "zf (list ") ? show :zf [] ? print count :zf 1 --------------------------------------------------------------- Please post messages to the Logo forum to logo-l@gsn.org. Mail questions about the list administration to logofdn@gsn.org. To unsubscribe send unsubscribe logo-l to majordomo@gsn.org.
Global SchoolNet Foundation -
Linking Kids Around the World!
Copyright GSN - All Rights Reserved
- Comments
& Questions
Visit GSN's
Global
Schoolhouse for more exciting learning resources!
Search our Site
-
Home