Not logged in
Log in now
Create an account
Subscribe to LWN
LWN.net Weekly Edition for May 23, 2013
An "enum" for Python 3
An unexpected perf feature
LWN.net Weekly Edition for May 16, 2013
A look at the PyPy 2.0 release
How does this differ from the Haskell (or Python version)
ghci> [ x+y | x <- [1,2,3], y <- [4,5,6] ]
which seems cleaner.
In Haskell, that can also deal with lazy lists etc
Should be: Goodnight, Perl 6.
Posted Feb 14, 2013 17:41 UTC (Thu) by hummassa (subscriber, #307)
> 1, 2, 3 X+ 4, 5, 6
5 6 7 6 7 8 7 8 9
Posted Feb 14, 2013 18:22 UTC (Thu) by raiph (guest, #89283)
That's the same.
One issue is whether you prefer, from an expressivity point of view, x+y or something like add(x,y). I usually prefer x+y. It looks like, for the "familar" function/operator add/+, we all agree: x+y is generally preferable.
So what about "unfamiliar" functions/operators? I'm going to guess at the haskell syntax for a zipped string concat:
zipwith (++) ["foo", "bar"] ["sing", "song"].
Perl 6 uses ~ instead of ++ and supports infix notation so one can write:
["foo", "bar"] Z~ ["sing", "song"]
It seems alankila and k8to (and you?) consider the Z~ infix notation for zipped string concat to be less clear.
Let's assume for a moment that this is just a syntax sugar issue. (Regardless of whether the sugar seems sweet or not to any given writer/reader.) Given that Perl 6 is aiming at (among other things) being a metaDSL (a language for easily expressing and combining DSLs) then sugar matters and it's potentially important to make it trivial to use a wide range of expressivity, including infix notation, for user defined functions/operators (as well as builtins of course).
Posted Feb 14, 2013 19:34 UTC (Thu) by nybble41 (subscriber, #55106)
infixr 6 ++~
(++~) = zipWith (++)
["foo", "bar"] ++~ ["sing", "song"]
Posted Feb 14, 2013 21:40 UTC (Thu) by fatrat (subscriber, #1518)
I think my issues is that the [ ... ] list/monad comprehension approach is very general, and, as nybble41 points out, can be specialised as needed.
The Perl6 approach seems to lead to a proliferation of operators, and consequent maintenance issues.
Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds