Josef Svenningsson writes:
> On Dec 28, 2007 11:40 PM, Mitar <[EMAIL PROTECTED]> wrote:
> > Would not it be interesting and useful (but not really efficient) to
> > have patterns something like:
> >
> > foo :: Eq a => a -> ...
> > foo (_{4}'b') = ...
> >
> > which would match a list with fo
On Dec 28, 2007 11:40 PM, Mitar <[EMAIL PROTECTED]> wrote:
> Would not it be interesting and useful (but not really efficient) to
> have patterns something like:
>
> foo :: Eq a => a -> ...
> foo (_{4}'b') = ...
>
> which would match a list with four elements ending with an element 'b'. Or:
>
> foo
> > Parser combinators basically provide generalized regexes, and they all
> > take lists of arbitrary tokens rather than just Chars. I've written a
> > simple combinator library before that dispenses with all the monadic
> > goodness in favor of a group combinator and returning [Either [tok]
> >
So a simple thing occured to me today. Rather than worry about the
correct behavior for a join/split pair, we should just add
unintercalate to the library. A bit verbose as a name, but at least
there's no ambiguity.
--s
On Dec 29, 2007, at 2:18 PM, David Roundy wrote:
On Fri, Dec 28, 200
On Fri, Dec 28, 2007 at 04:24:38PM +0100, Benja Fallenstein wrote:
> On Dec 28, 2007 3:55 PM, David Roundy <[EMAIL PROTECTED]> wrote:
> > On Dec 28, 2007 9:51 AM, Benja Fallenstein <[EMAIL PROTECTED]> wrote:
> > > If you use intercalate to join, I would presume that you would want to
> > > use an i
Hi!
On Dec 29, 2007 12:13 AM, Evan Laforge <[EMAIL PROTECTED]> wrote:
> Maybe you could use view patterns?
>
> foo (regex "(.*);(.*);(.*)") -> [c1, c2, c3] = ...
Oh. Beautiful. :-)
> Parser combinators basically provide generalized regexes, and they all
> take lists of arbitrary tokens rather th
> Would not it be interesting and useful (but not really efficient) to
> have patterns something like:
>
> foo :: Eq a => a -> ...
> foo (_{4}'b') = ...
>
> which would match a list with four elements ending with an element 'b'. Or:
>
> foo (_+';'_+';'_) = ...
Maybe you could use view patterns?
f
On Fri, Dec 28, 2007 at 11:40:24PM +0100, Mitar wrote:
> Hi!
>
> On Dec 28, 2007 5:51 PM, Lihn, Steve <[EMAIL PROTECTED]> wrote:
> > Since regex is involved, it is specific to (Byte)String, not a generic
> > list.
>
> Oh, this gives me an interesting idea: making regular expressions more
> gener
Hi!
On Dec 28, 2007 5:51 PM, Lihn, Steve <[EMAIL PROTECTED]> wrote:
> Since regex is involved, it is specific to (Byte)String, not a generic
> list.
Oh, this gives me an interesting idea: making regular expressions more generic.
Would not it be interesting and useful (but not really efficient) t
Mitar wrote:
I am really missing the (general) split function built in standard
Haskell. I do not understand why there is something so specific as
words and lines but not a simple split? The same goes for join.
Don't forget Text.Regex.splitRegex.
___
Programmer with perl background would think split like:
= split
Since regex is involved, it is specific to (Byte)String, not a generic
list. Also it appears one would need help from Text.Regex(.PCRE) to do
that.
> intercalate a (split a xs) = a
This identity rule does not hold for perl's
On Dec 28, 2007 4:24 PM, Benja Fallenstein <[EMAIL PROTECTED]> wrote:
> Right; I misspoke. What I meant was that you would want a split such that
>
> intercalate a (split a xs) = a
>
> for finite, total (a,xs) (and, since it's achievable, even for
> infinite xs). Of course, (split a xs = [xs])
On Dec 28, 2007 3:55 PM, David Roundy <[EMAIL PROTECTED]> wrote:
> On Dec 28, 2007 9:51 AM, Benja Fallenstein <[EMAIL PROTECTED]> wrote:
> > If you use intercalate to join, I would presume that you would want to
> > use an inverse of it to split. I'd write it like this:
>
> Of course, there is no i
On Dec 28, 2007 9:51 AM, Benja Fallenstein <[EMAIL PROTECTED]> wrote:
> If you use intercalate to join, I would presume that you would want to
> use an inverse of it to split. I'd write it like this:
But alas, words and lines differ on how properly to split, so there's
no hint from the standard li
Hi all,
On Dec 28, 2007 12:38 PM, Andrew Coppin <[EMAIL PROTECTED]> wrote:
> For joining you probably want some combination of intersperse and
> concat, e.g.
>
> unlines = concat . intersperse "\n"
And that's what we have :-)
Data.List.intercalate :: [a] -> [[a]] -> [a]
Data.List.intercalate x
Mitar wrote:
Hi!
I am really missing the (general) split function built in standard
Haskell. I do not understand why there is something so specific as
words and lines but not a simple split? The same goes for join.
Yes, I can of course define them but ... in an interactive mode it
would be quit
16 matches
Mail list logo