Re: Quantification in free theorems (Was: [Haskell-cafe] Exercise in point free-style)

2006-09-04 Thread ajb
G'day all. Quoting Janis Voigtlaender <[EMAIL PROTECTED]>: > I find the omission of quantifications in the produced theorems > problematic. I agree. Indeed, if you look at the source code, the quantifications _are_ generated, they're just not printed. The reason is that the output was (re-)des

Re: Quantification in free theorems (Was: [Haskell-cafe] Exercise in point free-style)

2006-09-04 Thread Lennart Augustsson
I'd like to see a mix of the two systems. Top level quantifiers should be optional; they often don't improve readability. -- Lennart On Sep 4, 2006, at 04:21 , Janis Voigtlaender wrote: [EMAIL PROTECTED] wrote: G'day all. Quoting Donald Bruce Stewart <[EMAIL PROTECTED]>: Get some

Quantification in free theorems (Was: [Haskell-cafe] Exercise in point free-style)

2006-09-04 Thread Janis Voigtlaender
[EMAIL PROTECTED] wrote: G'day all. Quoting Donald Bruce Stewart <[EMAIL PROTECTED]>: Get some free theorems: lambdabot> free f :: (b -> b) -> [b] -> [b] f . g = h . f => map f . f g = f h . map f I finally got around to fixing the name clash bug. It now reports: g . h = k . g

Re: [Haskell-cafe] Exercise in point free-style

2006-09-03 Thread ajb
G'day all. Quoting Donald Bruce Stewart <[EMAIL PROTECTED]>: > Get some free theorems: > lambdabot> free f :: (b -> b) -> [b] -> [b] > f . g = h . f => map f . f g = f h . map f I finally got around to fixing the name clash bug. It now reports: g . h = k . g => map g . f h = f k .

Re[2]: [Haskell-cafe] Exercise in point free-style

2006-09-02 Thread Bulat Ziganshin
Hello Udo, Friday, September 1, 2006, 10:14:44 PM, you wrote: > The general process is called "lambda elimination" and can be done > mechanically. Ask Goole for "Unlambda", the not-quite-serious > programming language; since it's missing the lambda, afaik, FP proposed by Backus was serious lamb

Re: [Haskell-cafe] Exercise in point free-style

2006-09-01 Thread Donald Bruce Stewart
haskell: > Julien Oster wrote: > > >But I'm having problems with one of the functions: > > > >func3 f l = l ++ map f l > > While we're at it: The best thing I could come up for > > func2 f g l = filter f (map g l) > > is > > func2p f g = (filter f) . (map g) > > Which isn't exactly point-_fre

Re: [Haskell-cafe] Exercise in point free-style

2006-09-01 Thread Donald Bruce Stewart
haskell: > Hello, > > I was just doing Exercise 7.1 of Hal Daum?'s very good "Yet Another > Haskell Tutorial". It consists of 5 short functions which are to be > converted into point-free style (if possible). > > It's insightful and after some thinking I've been able to come up with > solution

Re: [Haskell-cafe] Exercise in point free-style

2006-09-01 Thread Julien Oster
Julien Oster wrote: > = ((.) (filter f)) . map g l > = (.)((.) . filter f)(map) g l -- desugaring > = (.map)((.) . filter f) g l -- sweeten up > = (.map) . (.) . filter g l-- definition of (.) By the way, I think from now on, when doing point-free-ify

Re: [Haskell-cafe] Exercise in point free-style

2006-09-01 Thread Julien Oster
Udo Stenzel wrote: Thank you all a lot for helping me, it's amazing how quickly I received these detailed answers! > func2 f g l = filter f (map g l) > func2 f g = (filter f) . (map g) -- definition of (.) > func2 f g = ((.) (filter f)) (map g) -- desugaring > func2 f = ((.) (filter f)) . m

Re: [Haskell-cafe] Exercise in point free-style

2006-09-01 Thread Udo Stenzel
Julien Oster wrote: > While we're at it: The best thing I could come up for > > func2 f g l = filter f (map g l) > > is > > func2p f g = (filter f) . (map g) > > Which isn't exactly point-_free_. Is it possible to reduce that further? Sure it is: func2 f g l = filter f (map g l) func2 f g = (

Re: [Haskell-cafe] Exercise in point free-style

2006-09-01 Thread Robert Dockins
On Friday 01 September 2006 11:44, Neil Mitchell wrote: > Hi > > > func2 f g l = filter f (map g l) > > is > > func2p f g = (filter f) . (map g) > > func2 = (. map) . (.) . filter > > Again, how anyone can come up with a solution like this, is entirely > beyond me... To answer part of the OP's que

Re: [Haskell-cafe] Exercise in point free-style

2006-09-01 Thread Neil Mitchell
Hi func2 f g l = filter f (map g l) is func2p f g = (filter f) . (map g) func2 = (. map) . (.) . filter Again, how anyone can come up with a solution like this, is entirely beyond me... Thanks Neil ___ Haskell-Cafe mailing list Haskell-Cafe@haskel

Re: [Haskell-cafe] Exercise in point free-style

2006-09-01 Thread Neil Mitchell
Hi Julien, func3 f l = l ++ map f l func3 f = ap (++) (map f) func3 = ap (++) . map Looks pretty clear and simple. However, I can't come up with a solution. Is it even possible to remove one of the variables, f or l? If so, how? I have no idea how to do this - the solution is to log into #ha

Re: [Haskell-cafe] Exercise in point free-style

2006-09-01 Thread Julien Oster
Julien Oster wrote: But I'm having problems with one of the functions: func3 f l = l ++ map f l While we're at it: The best thing I could come up for func2 f g l = filter f (map g l) is func2p f g = (filter f) . (map g) Which isn't exactly point-_free_. Is it possible to reduce that furth

[Haskell-cafe] Exercise in point free-style

2006-09-01 Thread Julien Oster
Hello, I was just doing Exercise 7.1 of Hal Daumé's very good "Yet Another Haskell Tutorial". It consists of 5 short functions which are to be converted into point-free style (if possible). It's insightful and after some thinking I've been able to come up with solutions that make me understa