Re: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Luke Palmer
2009/8/18 Dusan Kolar : > Dlists maybe good it all the app is written using them. Probably not good > idea to switch to them in the middle of project... I have a different criterion for DLists. I think they are best to use in small scopes (I think the same of monads), as opposed to interfacing be

Re: Re[2]: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Sean Leather
On Tue, Aug 18, 2009 at 18:23, Bulat Ziganshin wrote: > Hello Sean, > > Tuesday, August 18, 2009, 7:49:21 PM, you wrote: > > > writeFile "/dev/null" $ show $ [1 .. 10001000] > > it may be dominated by show+writeFile. i suggest you to compute, say, > sum of all elements instead > Thank you, Bula

Re[2]: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Bulat Ziganshin
Hello Sean, Tuesday, August 18, 2009, 7:49:21 PM, you wrote: >   writeFile "/dev/null" $ show $ [1 .. 10001000] it may be dominated by show+writeFile. i suggest you to compute, say, sum of all elements instead -- Best regards, Bulatmailto:bulat.zigans...@gmail.com

Re: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Sean Leather
> >>> During a small project I'm trying to develop a small application. It > >>> becomes quite often that I need a function mapapp: > >>> > >>> mapapp _ [] ap = ap > >>> mapapp f (a:as) ap = f a : map f as ap > > >> Of course, > >>> (map f list) ++ append > >>> would do the same as > >>> > >>>

Re: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Eugene Kirpichov
module Main where mymap f xs = m xs where m [] = [] m (x:xs) = f x:m xs mymapp1 f xs ys = m xs where m [] = ys m (x:xs) = f x:m xs mymapp2 f [] ys = ys mymapp2 f (x:xs) ys = f x:mymapp2 f xs ys mapp1 f xs ys = (f`map`xs) ++ ys mapp2 f xs ys = (f`mymap`xs)

Re: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Artem V. Andreev
Clemens Fruhwirth writes: > 2009/8/18 Dusan Kolar : >> Hello all, >> >>  During a small project I'm trying to develop a small application. It >> becomes quite often that I need a function mapapp: >> >> mapapp _ [] ap = ap >> mapapp f (a:as) ap = f a : map f as ap >> >>  I tried hoogle to find suc

Re: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Artem V. Andreev
Dusan Kolar writes: > Dlists maybe good it all the app is written using them. Probably not good > idea to switch to them > in the middle of project... > > I know it is lazy, but I don't think it is able to eliminate operations, is > it? > > At least intuitively, the map f list takes n*C ticks (

Re: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Clemens Fruhwirth
2009/8/18 Dusan Kolar : > Hello all, > >  During a small project I'm trying to develop a small application. It > becomes quite often that I need a function mapapp: > > mapapp _ [] ap = ap > mapapp f (a:as) ap = f a : map f as ap > >  I tried hoogle to find such a function with no success. Is there

Re: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Dusan Kolar
Dlists maybe good it all the app is written using them. Probably not good idea to switch to them in the middle of project... I know it is lazy, but I don't think it is able to eliminate operations, is it? At least intuitively, the map f list takes n*C ticks (C is for application of f and lis

RE: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Bayley, Alistair
> > mapapp _ [] ap = ap > > mapapp f (a:as) ap = f a : map f as ap > > What does mapapp do? What is its type? Never mind, I've got it now. Alistair * Confidentiality Note: The information contained in this message, and any attachmen

Re: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Bulat Ziganshin
Hello Dusan, Tuesday, August 18, 2009, 2:50:38 PM, you wrote: > but with less efficiency. Or am I wrong? probably wrong. haskell is lazy language also there is differential lists (dlist) implementation on hackage -- Best regards, Bulatmailto:bulat.zigans...@gma

Re: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Tony Morris
Dusan Kolar wrote: > Hello all, > > During a small project I'm trying to develop a small application. It > becomes quite often that I need a function mapapp: > > mapapp _ [] ap = ap > mapapp f (a:as) ap = f a : map f as ap > > I tried hoogle to find such a function with no success. Is there any >

RE: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Bayley, Alistair
> From: haskell-cafe-boun...@haskell.org > [mailto:haskell-cafe-boun...@haskell.org] On Behalf Of Dusan Kolar > > During a small project I'm trying to develop a small > application. It > becomes quite often that I need a function mapapp: > > mapapp _ [] ap = ap > mapapp f (a:as) ap = f a : m

Re: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Eugene Kirpichov
Hi. Have you done any measurements that prove that such a function would indeed increase performance noticeably? 2009/8/18 Dusan Kolar : > Hello all, > >  During a small project I'm trying to develop a small application. It > becomes quite often that I need a function mapapp: > > mapapp _ [] ap =

[Haskell-cafe] Library function for map+append

2009-08-18 Thread Dusan Kolar
Hello all, During a small project I'm trying to develop a small application. It becomes quite often that I need a function mapapp: mapapp _ [] ap = ap mapapp f (a:as) ap = f a : map f as ap I tried hoogle to find such a function with no success. Is there any function/functions built-in "st