Phillip Trelford's blog... evidently
when your only tool is an analogy, everything looks like a simile.

Logo

October 4, 2009 18:22 by Phil

On Sunday, I thought I’d try and show my son the fun side of programming and Logo seemed a good place to start. Using a Logo Interpreter written in JavaScript, in seconds we were drawing pentagons.

to pentagon repeat 5 [ fd 100 rt 72 ] end

That jogged my memory to a cool sample Logo Interpreter written by Adam Granicz in less than 400 lines, posted on HubFS back in 2006. The code didn’t run straight away due to some subtle changes in the language, but after some worthwhile coercion I was able to resurrect the code, which I have attached.

Try executing:

canvas 300 300
to pentagon :x repeat 5 [ fd :x rt 72 ]
pentagon 100

canvas 400 500
to spiral :x repeat :x [fd 4 lt * repcount 1.1]
spiral 10000

spiral

 

Logo.zip (5.80 kb)


Tags:
Categories: F#
Actions: E-mail | Permalink | Comments (1) | Comment RSSRSS comment feed

Comments

January 21. 2010 10:07

alex

Thank you!

alex

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading