in reply to Re: RFC: Language::Logo
in thread RFC: Language::Logo
Don't worry -- I know it needs to implement more programming options. But I wanted to create something workable first, get feedback on that, and then go from there.
There's a lot of of fun you can have driving it around the way it is, even if you have let Perl do the steering. And you can even write code that looks a lot like Logo. For instance, using the Spiral example at Wikipedia as a starting point, you could implement a reasonably similar Perl subroutine that provides the same drawn output:
use strict; use warnings; use Language::Logo; my $l = new Logo(bg => 'white'); $l->cmd("co black; pd"); spiral(10); # # From http://en.wikipedia.org/wiki/Logo_programming_language # (Example_8) "A spiral drawn using recursion" # # to spiral :size # if :size > 30 [stop] ; a condition stop # fd :size rt 15 ; many lines of action # spiral :size *1.02 ; the tailend recursive call # end sub spiral { my $size = shift; if ($size > 30) { return } # a condition stop $l->cmd("fd $size; rt 15"); # many lines of action spiral($size * 1.02); # the tailend recursive call }
So now that I have the basics working, I will concentrate on what needs to be done to provide more of the Logo language.
Any constructive feedback is, of course, very welcome!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: RFC: Language::Logo
by eric256 (Parson) on Feb 04, 2007 at 01:33 UTC |