On 2006-07-20 at 18:31BST I wrote:
On 2006-07-13 at 10:16BST I wrote:
Hooray! I've been waiting to ask Why aren't we asking what
laws hold for these operations?
Having thought about this for a bit, I've come up with the
below. This is intended to give the general idea -- it's not
On 2006-07-13 at 10:16BST I wrote:
Hooray! I've been waiting to ask Why aren't we asking what
laws hold for these operations?
Having thought about this for a bit, I've come up with the
below. This is intended to give the general idea -- it's not
polished code, and I'm not at all wedded to the
On 2006-07-12 at 23:24BST Brian Hulley wrote:
Christian Maeder wrote:
Donald Bruce Stewart schrieb:
Question over whether it should be:
splitBy (=='a') aabbaca == [,,bb,c,]
or
splitBy (=='a') aabbaca == [bb,c]
I argue the second form is what people usually want.
Yes,
Evan Laforge wrote:
splitBy :: (a - Bool) -- ^ whether element is a seperator
- [a] -- ^ list to split
- [[a]]
P.S. inspecting more than one element looks like an over-generalization
to me and should be left to parsers or regexp libs.
It's more generally useful if you
simonmarhaskell:
I guess the problem with the splitWith thing is that it's a slippery
path that leads right up to full-on parsers.
Exactly, and this is why we didn't reach a concensus last time.
Would someone like to make a concrete proposal (with code!) for 2-3
functions we could
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Donald
Bruce Stewart
I vote for this, currently implemented in Data.ByteString:
-- | split on characters
split:: Char - String - [String]
-- | split on predicate *
splitBy :: (Char -
Donald Bruce Stewart schrieb:
No parsers!
I agree,
I vote for this, currently implemented in Data.ByteString:
from which package comes Data.ByteString?
-- | split on characters
split:: Char - String - [String]
the type for lists should then be:
split :: Eq a = a -- ^
Hello Donald,
Wednesday, July 12, 2006, 12:55:50 PM, you wrote:
Question over whether it should be:
splitBy (=='a') aabbaca == [,,bb,c,]
or
splitBy (=='a') aabbaca == [bb,c]
I argue the second form is what people usually want.
1) at least for 'lines' people prefer first
2)
On Wed, 12 Jul 2006, Donald Bruce Stewart wrote:
I vote for this, currently implemented in Data.ByteString:
-- | split on characters
split:: Char - String - [String]
-- | split on predicate *
splitBy :: (Char - Bool) - String - [String]
and
--
Jared Updike wrote:
split is... unconcatIntersperse.
How about separate? (split or splitBy is better but
it is used
all over the place in many libs)
And for strings I definitely would use split :: [a] - [a]
- [[a]] a
lot, just like Python's split function. And words works
great for
2006/7/12, [EMAIL PROTECTED] [EMAIL PROTECTED]:
Jared Updike wrote:
split is... unconcatIntersperse.
How about separate? (split or splitBy is better but
it is used
all over the place in many libs)
And for strings I definitely would use split :: [a] - [a]
- [[a]] a
lot, just like
Christian Maeder wrote:
Donald Bruce Stewart schrieb:
Question over whether it should be:
splitBy (=='a') aabbaca == [,,bb,c,]
or
splitBy (=='a') aabbaca == [bb,c]
I argue the second form is what people usually want.
Yes, the second form is needed for words, but the first form is
On Wed, 12 Jul 2006, Evan Laforge wrote:
Also, my version of the split but don't drop the delimiter is
breakAll, since it's like a recursive break.
words/unwords and lines/unlines have one argument, so a 2 argument
fielts/unfields would break that convention. Maybe:
fields = csv
fields = csv `separateWith` ,
csv = fields `joinWith` , -- equivalent to concatIntersperse
Hence I would much rather have the split condition be the first
parameter -- the infix notation looks good, but it will need a
flip to get the parameters in the right order.
This also goes along with
Quoth Jared Updike [EMAIL PROTECTED]:
(... quoting me)
| Hence I would much rather have the split condition be the first
| parameter -- the infix notation looks good, but it will need a
| flip to get the parameters in the right order.
|
| This also goes along with join in python, i.e.
|
|
Quoth John Meacham [EMAIL PROTECTED]:
...
| just a note: I find splitBy a much nicer routine to provide.
|
| splitBy :: (a - Bool) -- ^ whether char is a separator
| - [a] -- ^ list to split
| - [[a]]
Starting from the assumption that in most cases the list to be split
will be
John Meacham schrieb:
just a note: I find splitBy a much nicer routine to provide.
I would support this, if it helped to find a consensus. It's more
difficult to decide if empty lists as elements of the result list (at
the beginning, at the end or in the middle) should be returned. I would
say
splitBy :: (a - Bool) -- ^ whether element is a seperator
- [a] -- ^ list to split
- [[a]]
P.S. inspecting more than one element looks like an over-generalization
to me and should be left to parsers or regexp libs.
It's more generally useful if you don't drop the separators
I personally use
split :: Eq a = [a] - [a] - [[a]]
all the time, much more often than
splitBy :: (a - Bool) - [a] - [[a]]
But I don't call it split. By analogy with
concatMap, the Haskell analogue of Perl/Python
join is concatIntersperse. Then, by analogy
with lines/unlines, the Haskell
split is... unconcatIntersperse.
How about separate? (split or splitBy is better but it is used
all over the place in many libs)
And for strings I definitely would use split :: [a] - [a] - [[a]] a
lot, just like Python's split function. And words works great for
breaking on multiple spaces,
Hello Donald,
Monday, July 10, 2006, 11:48:48 AM, you wrote:
Anyone rememeber what the result of the let's get split into the base
library movement's work was?
it will be even better to ask permission from John Goerzen and move to
Data.List the whole stringlist beastiary from MissingH
--
Simon Marlow schrieb:
Donald Bruce Stewart wrote:
Hacking up your own custom split (or a tokens/splitOnGlue) must be one
of the most common questions from beginners on the irc channel.
Anyone rememeber what the result of the let's get split into the base
library movement's work was?
On Mon, Jul 10, 2006 at 02:26:23PM +0200, Christian Maeder wrote:
Our current (special) version is:
{- |
A function inspired by the perl function split. A list is splitted
on a seperator element in smaller non-empty lists.
The seperator element is dropped from the resulting list.
-}
23 matches
Mail list logo