At 4/26/09 12:14 PM, Toast wrote:
I was hesitating between Python and Ruby. I'll give both a try. And btw how come I never see you on msn anymore?
It's really no big deal to understand different programming languages unlike with human languages.
Imperative languages have the same 'grammar', programs are a list of commands that consist of function calls that can have a side effect and/or return a value (this includes numeric calculations and manipulating data like arrays, though it's a different kind of function).
You have your assignment, your function calls and array access the same way as in Actionscript. You know how to use these easily, so I think it's plenty to go from when learning new languages.
Steve Yegge used this command to print the squares of 1 to 5 to illustrate something (I think it was how much Java sucks).
Ruby:
(1..5) .collect {|x| x*x} .join ' '
Python:
' '.join ([str (x*x) for x in range (1,6)])
Actionscript:
Array.range (1,5).map (function (x) { return x*x; }).join (' ');
assuming:
Array.range = function (a,b) { var array = []; for (var i=a; i<=b; i++) array.push (i); return array; };
Array.prototype.map = function (f) { var maparray = []; for (var i=0; i<this.length; i++) maparray.push (f (this [i])); return maparray; };
Yeah. Actionscript sucks.
(Note though that structurally the AS example is exactly the same as the Ruby one.)
So y'see? These scripting languages are all the same thing. I wish you script kids would expand your knowledge a bit, seeing multiple languages would help you understand technicalities in programming that you're struggling with in Actionscript because next to the code window you have a frigging stickman to finish drawing so you could add a hittest.
..Hm. Oh yeah!
haXe plug:
Lambda.map (1..5, function (x) return x*x).join (' ');
MSN? I don't feel like chatting lately. Mail me if you want.