|No such thing as a small change|
Re: [OT] Perl / Computer Science Science Fair Projectsby tilly (Archbishop)
|on Sep 09, 2008 at 05:30 UTC||Need Help??|
A reasonable project might be to write a web page that will put up an $n*$m grid of squares that are black or white. If you click on one, it will flip the color of that square and the one to the north, south, east and west. Also have a button that says "Find Solution". Then once found it will say how many moves are left, will ask you if you wish to see it, and then can proceed to step you through that solution.
Now what the heck are closures? Well closures are just functions that keep a reference to the environment that it was created in. If you want to twist your brain, try to figure out how Re (tilly) 1 (perl): What Happened...(perils of porting from c) works. If you figure it out, then you probably understand closures.
How annoying. You need to arrange to have a function call. The ugly, gross, but effective syntactic trick to do the right thing looks like this:
Blech. Double blech. Ick. Double ick. But it works. And thanks to me you don't have to learn it the hard way.
You could try the same project without using closures. However doing so is probably a good way to find out why I recommended using closures. :-)