>> > printastable :: [([Int],Word)] -> String
>> >
>> > printastable l = concat $ map (\(xs,w) -> (show xs) ++ " " ++ w ++
>> > "\n") l
>>
>> I'd use
>>
>> [ c | (xs,w) <- l, c <- (show xs) ++ " " ++ w ++ "\n" ]
>>
>> instead -- after all, list comprehensions provide a much nicer
>> syntax for map,
On 09 December 2004 16:37, Malcolm Wallace wrote:
> Robert Dockins <[EMAIL PROTECTED]> writes:
>
>>> Prelude> [1..5] `zipWith (+)` [7..]
>>> :1: parse error on input `('
>>
>> is there a technical reason for this or did it just happen?
>
> If you are asking why general expressions are prohi
Henning Thielemann wrote:
>I try to stay away from list comprehension because I can't memorize in
>which order the conditions are processed [...]
I remember it as being slowest-changing-to-the-left, just like the
positional notation for integers. E.g.
[[x,y] | x <- ['1'..'4'], y <- ['0'..'9']]
On Fri, 10 Dec 2004, Thomas Johnsson wrote:
> > printastable :: [([Int],Word)] -> String
> >
> > printastable l = concat $ map (\(xs,w) -> (show xs) ++ " " ++ w ++
> > "\n") l
>
> I'd use
>
> [ c | (xs,w) <- l, c <- (show xs) ++ " " ++ w ++ "\n" ]
>
> instead -- after all, list comprehensions
Thomas Johnsson wrote:
>>printastable :: [([Int],Word)] -> String
>>
>>printastable l = concat $ map (\(xs,w) -> (show xs) ++ " " ++ w ++
>>"\n") l
>
>
> I'd use
>
> [ c | (xs,w) <- l, c <- (show xs) ++ " " ++ w ++ "\n" ]
>
> instead -- after all, list comprehensions provide a much nicer
> synt
> printastable :: [([Int],Word)] -> String
>
> printastable l = concat $ map (\(xs,w) -> (show xs) ++ " " ++ w ++
> "\n") l
I'd use
[ c | (xs,w) <- l, c <- (show xs) ++ " " ++ w ++ "\n" ]
instead -- after all, list comprehensions provide a much nicer
syntax for map, filter and concat.
-- Thomas
Oops, please ignore, I just replied to the wrong emaiL!
Keean.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
At the moment the unix encrypted passwords are downloaded using
sov_slave (an application written by ICT that talks directly
to the SOV database)... As far as I am aware all unix cluster
in college that are part of ICTs single sign-on us this method
unless you have recently changed them...
I am su
On Thu, 09 Dec 2004 10:18:12 -0500, Robert Dockins
<[EMAIL PROTECTED]> wrote:
> > And I thought that most programmers used "zipWith", which has to be
> > prefix.
>
> Is this true? Can you not use backticks on a partially applied
> function? If so, it seems like such a thing would be pretty use
David Menendez wrote:
Now that I think about it, you can generalize the trick I mentioned
elsewhere to work over any
Idiom/Sequence/more-than-a-functor-not-yet-a-monad thingy.
Just to fill in the genealogy: the numeral thing is from Daniel
Fridlender and Mia Indrika's 'Do we need dependent types?',
Conor McBride writes:
> Jan-Willem Maessen - Sun Labs East wrote:
> > Tomasz Zielonka wrote:
> >
> >>I found it useful recently, when I needed zip functions for Trees -
> >>this way I didn't have to define functions for 3 trees, 4 trees,
> >>and so on.
> >
> >
> > Note also that:
> >
> > repeat
Tomasz Zielonka writes:
> On Thu, Dec 09, 2004 at 10:02:39AM -0500, Jan-Willem Maessen - Sun
> Labs East wrote:
> >
> > And I thought that most programmers used "zipWith", which has to be
> > prefix.
>
> You can also use zipWith to simulate zipN, for any N (however, the
> following code uses inf
Tomasz Zielonka wrote:
> On Thu, Dec 09, 2004 at 05:55:09PM +, Conor McBride wrote:
>
>>Funny you should choose that word:
>>
>> http://www.mail-archive.com/haskell@haskell.org/msg15073.html
>>
>>saves me banging the same old drum.
>
>
> Is ap alias <# alias <%> for [] really the same as zwApp
On Thu, Dec 09, 2004 at 05:55:09PM +, Conor McBride wrote:
> Funny you should choose that word:
>
> http://www.mail-archive.com/haskell@haskell.org/msg15073.html
>
> saves me banging the same old drum.
Is ap alias <# alias <%> for [] really the same as zwApply? Probably
I am missing someth
Malcolm Wallace wrote:
> > > Prelude> [1..5] `zipWith (+)` [7..]
> > > :1: parse error on input `('
> >
> > is there a technical reason for this or did it just happen?
>
> If you are asking why general expressions are prohibited between
> backticks, yes, there is a reason. The expression c
Hi
Jan-Willem Maessen - Sun Labs East wrote:
Tomasz Zielonka wrote:
I found it useful recently, when I needed zip functions for Trees - this way I
didn't have to define functions for 3 trees, 4 trees, and so on.
Note also that:
repeat f `zwApply` xs = map f xs
When cooking up my own collection-y
> Robert Dockins writes:
>
> > > And I thought that most programmers used "zipWith", which has to
> > > be prefix.
>
> > [1..5] `zipWith (+)` [7..]
>
> You don't have a computer at your end of the internet? :-)
>
> Prelude> [1..5] `zipWith (+)` [7..]
> :1: parse error on input `('
> Pr
Tomasz Zielonka wrote:
> On Thu, Dec 09, 2004 at 10:02:39AM -0500, Jan-Willem Maessen - Sun Labs East
> wrote:
>
>>And I thought that most programmers used "zipWith", which has to be
>>prefix.
>
>
> You can also use zipWith to simulate zipN, for any N (however, the following
> code uses infix n
Robert Dockins <[EMAIL PROTECTED]> writes:
> > Prelude> [1..5] `zipWith (+)` [7..]
> > :1: parse error on input `('
>
> is there a technical reason for this or did it just happen?
If you are asking why general expressions are prohibited between
backticks, yes, there is a reason. The express
On Thu, Dec 09, 2004 at 10:02:39AM -0500, Jan-Willem Maessen - Sun Labs East
wrote:
>
> And I thought that most programmers used "zipWith", which has to be
> prefix.
You can also use zipWith to simulate zipN, for any N (however, the following
code uses infix notation):
Prelude> let l = words "H
On Thu, 9 Dec 2004, Robert Dockins wrote:
> > And I thought that most programmers used "zipWith", which has to be
> > prefix.
>
> Is this true? Can you not use backticks on a partially applied
> function? If so, it seems like such a thing would be pretty useful
> (although I've never actua
Ketil Malde wrote:
Robert Dockins <[EMAIL PROTECTED]> writes:
> And I thought that most programmers used "zipWith", which has to be
> prefix.
[1..5] `zipWith (+)` [7..]
You don't have a computer at your end of the internet? :-)
Yes, but I'm at work, and I try to limit the amount of time I spend
Robert Dockins <[EMAIL PROTECTED]> writes:
> > And I thought that most programmers used "zipWith", which has to be
> > prefix.
> [1..5] `zipWith (+)` [7..]
You don't have a computer at your end of the internet? :-)
Prelude> [1..5] `zipWith (+)` [7..]
:1: parse error on input `('
Prelude
> And I thought that most programmers used "zipWith", which has to be
> prefix.
Is this true? Can you not use backticks on a partially applied
function? If so, it seems like such a thing would be pretty useful
(although I've never actually had occasion to need it, so) I'll dig
out the rep
Keith Wansbrough wrote:
> zip stops when it reaches the end of the shorter list, so you can just say
>
> zip [1 ..] lines
>
> In fact, most programmers use the infix version of zip, like this:
>
> [1..] `zip` lines
>
> which is nicely readable. (any function can be turned into an infix by
> numLines :: [Line] -> [(Int, Line)]
> numLines lines -- list of pairs of
> = zip [1 .. length lines] lines -- line no. & line
>
zip stops when it reaches the end of the shorter list, so you can just say
zip [1 ..] lines
In fact, most programmers us
I'd just like to thank everyone for helping. Its now working great!
I really appreciate your help. I only wish I'd discovered the mailing
list sooner.
All the best.
Doug
On Thu, 9 Dec 2004 10:31:52 +, Jules Bean <[EMAIL PROTECTED]> wrote:
> To amplify on the other replies you already had,
To amplify on the other replies you already had, don't use show here:
makeIndex :: Doc -> Doc -- changed so output can be written to file
makeIndex
= show .
shorten .-- [([Int], Word)] -> [([Int], Word)]
amalgamate . -- [([Int], Word)] -> [([Int], Word)]
makeLists . -- [(Int, Word)]
Douglas Bromley <[EMAIL PROTECTED]> writes:
> I've show(n) a particular data type and it shows up as:
> [([2,6],"British"),([1],"Charles"),([1,8],"Clarke"),([2,6],"Council"),([2],"Edinburgh"),([1],"Education"),([4],"Increasingly")]
Let me guess: type [([Integer],String)]?
> What I want to do is
Hi Everyone
My first post to the mailing list is a cry for help. Apologies for that.
I've seen an example of how this is done in the archives but I'm
afraid I'm a bit more behind than the person who seemed to understand
the answer so if someone could help me??
The problem is this:
I've show(n)
30 matches
Mail list logo