>>5
It can be rather useful. If a language lets you implement currying yourself(preferably, within a couple of lines of code), it means it's worth using.
Why exactly is currying an important aspect of programming or algorithm creation?
Currying is just a form of method specialisation, and hope I don't have to tell you why method specialisation is useful.
Name:
Anonymous2010-04-29 14:10
>>1
I'd say the output'll be 2 1 3.
Is this a trick question?
>>1
It would output 2 and then shout about something involving not being able to use a function as a function.
Name:
Captain Obvious2010-04-29 15:46
1 2 3 And now back to /b/!
Name:
Anonymous2010-04-29 22:25
f(y=2)(1)(3)
What output will be generated?
the same output as if you do f(y=2,1,3).
Name:
Anonymous2010-04-30 13:08
If Python were a language where assignments counted as expressions (any procedural language worth its bits), this would assign y to 2 in the current scope and then call f(1 2 3). Perl gets it right by using => for this kind of thing.
Name:
Anonymous2010-04-30 14:02
>>17 where assignments counted as expressions (any procedural language worth its bits)
THIS IS WHAT PERL PROGRAMMERS ACTUALLY BELIEVE
Seriously this is a horrible misfeature and only serves to make programs "clever" at the extreme expense of readability and maintainability. I'd wager that in any sane application (i.e. not deliberately obfuscated) using the value of an assignment in an expression is 90% of the time a typo.
>>18 while ((c = getchar()) != EOF) is a common idiom in C, and it's useful to be able to do things like a = b = c = 0.
Those two are pretty much the only legitimate uses, though.
Name:
Anonymous2010-04-30 14:36
>>21
I agree with the first part, if (tmp = try_get_some_value()) is rather common idiom.
I want to note, however, that a = b = c = 0 is valid Python.
Name:
Anonymous2010-04-30 14:58
>>22
Yes, because it was specifically added as an exception to the usual syntax, when it could just elegantly be a consequence of the way things should work anyway. Python's artificial and useless distinctions between expressions and statements is a conceptual eyesore.
If you're fighting with the language on intentional and rational parts of the syntax, maybe instead of bitching about it you should go use another language instead. Ruby might be more your thing, if you're into slow-as-fuck languages.
>>24 It's not an "exception", it's a part of the syntax.
He never said it wasn't a part of the syntax, but of course, if you could actually read, you would know that already.
If you're fighting with the language on intentional and rational parts of the syntax
His point was that it isn't rational, as it doesn't fit in with the rest of the syntax. No-one disputes that it was intentional.
Ruby might be more your thing, if you're into slow-as-fuck languages.
He already uses Python, so that's a given.