I really like functional, it's what Python should have been to start with. Too bad Guido is taking the language in the complete wrong direction.
If I had the inclination, I'd make a fork of Python, get rid of the FIOC, classes, and all that other crap, make print etc. into real functions, and turn it into a real functional programming language.
>>1 make print etc. into real functions
This is coming in Python 3: from __future__ import print_function
Name:
Anonymous2008-04-27 6:29
>>2
And that's the one good thing that's coming out of py3k. Guido's still hellbent on making OO the one and only way to do most things, so you have to write all sorts of lambda a: a.something() crud if you want to use functional constructs like map(). Sure, list comprehensions and generator expressions work sometimes, but what if you want to parallelize? With the traditional map(func, list) you can just replace the map. Not so with list comprehensions; the mapping has been moved behind the curtain.
Really, all I want is Haskell without all the excessive punctuation, Lisp without all the screwy function names... Python without all the OO-anvils weighing it down.
Name:
Anonymous2008-04-27 8:29
>>3
You mean function.lambda variables.a: a.something().
Haskell without all the excessive punctuation,
Example?
Lisp without all the screwy function names...
Example?
Python without all the OO-anvils weighing it down.
anvils.oo_anvils.weigh_down(languages.python)
Name:
Anonymous2008-04-27 8:29
>>1
FIOC is one of the best things to come out of Python.
Name:
Anonymous2008-04-27 8:50
>>4
>>Lisp without all the screwy function names...
>Example?
set! instead or !, lambda instead of \.
Name:
Anonymous2008-04-27 10:00
>>1
Perl6 will be much closer to Haskell than Python.
See the error of your ways and convert.
>>19
I know what I'm talking about: my preference for a clean-looking language with alphanumeric functions and variable names, with little excess punctuation. Putting $ and @ in front of all my variables isn't my idea of fun. To be honest I think Python has too much punctuation, but it's better than Perl, and it's certainly better than Haskell.
Name:
Anonymous2008-04-28 9:20
>>23
Two words, you still have no idea what you're talking about, thread over.
Name:
Anonymous2008-04-28 9:33
>>23
God damn, show me that horrid Haskell punctuation already.
I'm talking about all the crap like <- -> => >> >>= !! \ ++ :: : . | ||, rather than functions with sensible names. If you want some examples in context, here's a bit from the official Haskell website: the third function is known as "bind" but is written ">>=" (>>=) :: m a -> (a -> m b) -> m b
What the fuck, why not just call the goddamn thing "bind". Instead of three meaningless-looking punctuation characters, you'd be typing four actual letters, which you can actually fucking read and make sense of at first glance. If nothing else, you can at least infer then that it BINDS something.
Incidentally, this is why I like Python so much: typically it's extremely easy to jump into a program and get an idea of what's going on. Haskell coders love to take advantage of the fact that you can express practically everything without even typing any letters.
I've been continually told that xmonad is "really easy to understand" and that "you don't need to know any Haskell, you can just figure everything out by looking at it". These are actual statements made by xmonad users, mind.
, ((modMask , xK_b ), modifyGap (\i n -> let x = (XMonad.defaultGaps conf ++ repeat (0,0,0,0)) !! i in if n == x then (0,0,0,0) else x))
Or how about this: [((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f)) | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..] , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
Where does that .|. come from? I don't think I've ever encountered a penis operator before.
Haskell is full of shit like that, and if you somehow think it's even nearly as straightforward to read as typical Python (or even Perl) code, you're only fooling yourself.
Name:
Anonymous2008-04-29 0:31
is Guido a guido?
Name:
Anonymous2008-04-29 2:40
>>29
Think of learning about Haskell syntax like learning effective VI -- it has a steep learning curve but you'll be really productive once you've been through the learning process.
Name:
Anonymous2008-04-29 2:42
>>29 <- -> => \ :: | aren't even operators, they're syntax built into the language; i.e. you can't just replace them with functions. You might as well complain that Python uses = or : instead of words (also, def del len are not sensible names). !! is an indexing operator. I don't see how [] is more sensibly named. ++ is list concatenation. Python uses +, which is much more misleading (also, since when is % a string formatting operator?).
>>= can be seen as "shift into"; that interpretation should be obvious to anyone who knows C/C++/Java/Perl/etc. Oh, I see Python uses << >> for bit shifts too! How unreadable. Why not shiftL shiftR like Haskell?
You could call >>=bind[/bind], but in typical (infix) usage that would make it twice as long. But hey, if it really bothers you that much, just say [code]bind m f = m >>= f and use bind.
Haskell is full of shit like that, and if you somehow think it's even nearly as straightforward to read as typical Python (or even Perl) code, you're only fooling yourself.
In my experience a language is easier to read if you actually know it. Also, visually parsing Haskell is pretty trivial, especially compared to Perl. The main difficulty in understanding Haskell code lies in its high informational density IMHO: just three lines of code can encapsulate rather abstract and complex concepts. However, I don't think using more verbose identifiers instead of punctuation would help with that.
Here's your keybinding example with words instead of (most of the) punctuation: concatMap
(lambda (key, sc):
concatMap
(lambda (f, m):
((m `bitwiseXor` modMask, key),
screenWorkspace sc `bind` flip whenJust (windows `compose` f)))
((W.view, 0) `Cons` (W.shift, shiftMask) `Cons` Nil))
(zip (xK_w `Cons` xK_e `Cons` xK_r `Cons` Nil) (enumFrom 0))
Somehow it doesn't look better to me.
Name:
Anonymous2008-04-29 3:10
(also, def del len are not sensible names)
I'd like to know what would be sensible. Would it be define, removeFromList, and length?
del and len seem like fairly intuitive abbreviations to me; I was abbreviating "length" as "len" long before I got into Python. I think it would make more sense, though, to use func rather than def (as well as lambda -- many other languages use the same keyword for both anonymous and named functions; why can't Python?)
Name:
Anonymous2009-03-06 6:51
Now some of the gods just sit it out with your project here unless you paid for it you crawled out of my C courses now in College on Eclipse with CDT But then I discovered regexes and this followed.
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy