[Ometa] Logo Demo

Chris Cunnington brasspen at gmail.com
Wed Dec 30 16:17:01 PST 2009


Hi Alex,

The bottom of the Logo Demo says:

smiley =3D new Turtle()
translateCode =3D function(code) { smiley.eval(code); return "undefined" }

to spiral :size :angle
  if :size < 100 [
    fd :size
    rt :angle
    spiral :size + 2 :angle
  ]
end

spiral 0 89

I don't know what translateCode is for, or how the Logo code gets into the
"code" variable to be eval'd by smiley.
So, I adapted the code from your Old OMeta JS example thusly:

smiley =3D new Turtle()
smiley.eval('

to spiral :size :angle
  if :size < 100 [
    fd :size
    rt :angle
    spiral :size + 2 :angle
  ]
end

spiral 0 89')

Now I can see how the Logo code gets into smiley to be eval'd. The result
produces a spiral on the canvas.
I'm quite pleased with my hack. But I'd like to know how it's supposed to
work with translateCode.
How was the Logo code supposed to get into the "code" variable for smiley to
execute?

Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://vpri.org/pipermail/ometa/attachments/20091230/d419c51c/attachme=
nt.htm


More information about the OMeta mailing list