[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [school-discuss] Re: ISO: Good programming language to teach an 8yr old



On 20 Mar 2004 at 15:29, Darren Smith wrote:

> > Maybe geeks still get a kick out of printing "Hello World" and
> > printing out the fibonacci sequence.
> 
> Hope so :-)

Maybe not a fibonacci sequence but...


http://www.cs.berkeley.edu/~bh/logo-sample.html

> Sample Logo program
> 
> Here is a short but complete program in Berkeley Logo: 
> 
> to choices :menu [:sofar []]
> if emptyp :menu [print :sofar stop]
> foreach first :menu [(choices butfirst :menu sentence :sofar ?)]
> end
> 
> And here's how you use it. You type 
> 
> choices [[small medium large]
>          [vanilla [ultra chocolate] lychee [rum raisin] ginger]
>          [cone cup]]
> 
> and Logo replies 
> 
> small vanilla cone
> small vanilla cup
> small ultra chocolate cone
> small ultra chocolate cup
> small lychee cone
> small lychee cup
> small rum raisin cone
> small rum raisin cup
> small ginger cone
> small ginger cup
> medium vanilla cone
> medium vanilla cup
> medium ultra chocolate cone
> medium ultra chocolate cup
> medium lychee cone
> medium lychee cup
> medium rum raisin cone
> medium rum raisin cup
> medium ginger cone
> medium ginger cup
> large vanilla cone
> large vanilla cup
> large ultra chocolate cone
> large ultra chocolate cup
> large lychee cone
> large lychee cup
> large rum raisin cone
> large rum raisin cup
> large ginger cone
> large ginger cup
> 
> The program doesn't have anything about the size of the 
> menu built in. You can use any number of categories, and 
> any number of possibilities in each category. Let's see you 
> do that in four lines of C++!


Daniel