Bill Kerr wrote: > 1) Most elegant but difficult: > > to factorial :no > if :no = 1 [op 1] > op (product :no factorial :no - 1) > end > Yehuda Katz wrote: >This level of programming is suitable for students (kids or grownups alike) who know already what's a function, and what is a recursive function. > In other words its unrealistic for a teacher taking a group of kids in their first semester of using MicroWorlds (or any version of Logo), 30 kids, 22 computers, always 2 or 3 computers not working, at a disadvantaged school (60% + on school card). In that environment its best to maximise your chances of keeping the majority engaged, which is why the purely visual (ToonTalk) and MicroWorlds visual / textual combination interest me in the first place. The visual component helps engagement and understanding for the majority; only a small minority will understand the functional / recursive / abstract solution and the others will be up the wall. [YK] >A "simpler" solution might be, to take an iterative approach, instead of a recursive one: > > to main > ct > factorial readword 1 > end > to factorial :num :total > if :num<2[pr :total stop] > factorial :num-1 :num*:total > end > >It's basically your third MW program, I think, stripped off from graphics and animation, in standard Logo. [BK] Thanks, I hadn't thought of that one! That reinforces my point about MicroWorlds allowing multiple solutions better than ToonTalk. 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). [YK] >Please verify that any version of the program "knows" that 0!=1 (your recursive program above has to be slightly modified for this). > [BK] Oh dear, that drags up a dim memory from my neglected mathematical past! Please tell me why 0!=1. I can't remember if I've forgotten or maybe I never knew! mmm .... would that come out correctly in the ToonTalk version, must try it? -- Bill Kerr --------------------------------------------------------------- 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