in reply to Re: RFC: Language::Logo
in thread RFC: Language::Logo

Thanks for the enthusiastic comments!

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!


s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/

Replies are listed 'Best First'.
Re^3: RFC: Language::Logo
by eric256 (Parson) on Feb 04, 2007 at 01:33 UTC

    I had an itch and had to scratch it so I implemented brackets, a repeat command, and a rudimentary ability to define user functions. In order to do most of this I moved the command parsing code to the server itself which means user defined functions are available to any connected clients! ;)

    Drawing a circle now:

    pendown; repeat 35 [left 10; forward 10;];

    Making a circle function:

    to circle [ repeat 35 [ left 10; forward 10;]]; circle;

    I'm not sure what the best way is to get you the changes so I've attached the entire modified version.


    ___________
    Eric Hodges