Programming Challenges.

the_impaler
Posts: 61
Joined: Wed Apr 30, 2008 3:31 am

Post by the_impaler »

I solved some of the challenges with perl and some in C . There is a certain requirement for some of the challenges - the challange itself would be a piece of code. I have seen code in python, C and scheme (or was it Lisp) so far. While you don't have to know those languages you better know more than one programming language. In some of the challenges you would need to do reverse engineering or disassembly,
I started to learn groovy and it was so much fun - now I try to solve all the challanges in groovy.
gfoot
Posts: 269
Joined: Wed Sep 05, 2007 11:34 pm
Location: Brighton, UK

Post by gfoot »

I actually like the explicit "self" in Python. The lack of scoping seems more troublesome in cases like list comprehensions, where I just assume that variables defined in the comprehension won't overwrite globals.

Does Ruby have sensible scoping but still no variable declarations? How does it work?
sigi
Posts: 37
Joined: Sun Oct 26, 2008 4:58 pm

Post by sigi »

gfoot wrote:I actually like the explicit "self" in Python. The lack of scoping seems more troublesome in cases like list comprehensions, where I just assume that variables defined in the comprehension won't overwrite globals.
I don't see the benefit of the explicit "self". It's something you have to mention in your method's argument list only because there is no lexical scoping that could provide you with an implicit "self" (if I understand things correctly). Thus, it clutters your source code, and that's it.
Does Ruby have sensible scoping but still no variable declarations? How does it work?
I'm not sure if I understand the question. Ruby has lexical (static) scoping, which means that a variable is in scope if it lexically is visible at that point in the code. Variables spring into existence when you use them (just as in Perl), so you never have to declare anything.

The Wikipedia has a good explanation of static vs. dynamic scoping with some Perl examples among others (Perl provides both, so it's a good language to explain the concept).
the_impaler
Posts: 61
Joined: Wed Apr 30, 2008 3:31 am

Post by the_impaler »

gfoot wrote:I actually like the explicit "self" in Python. The lack of scoping seems more troublesome in cases like list comprehensions, where I just assume that variables defined in the comprehension won't overwrite globals.

Does Ruby have sensible scoping but still no variable declarations? How does it work?
If you are looking for Ruby and you have good java knowledge I would recommend groovy - it was a very short learning curve for me. Groovy has closures with dynamic scope and default "it" variable. It also has "self" and "super" etc.
Allosentient
Posts: 273
Joined: Thu Apr 10, 2008 9:47 pm

Post by Allosentient »

I actually prefer C#, though if you are not using Windows I wouldn't recommend it. You can download Visual C# 2008 Express for free from Microsoft. I achieved some decent scores on this site with it.
Post Reply