Re: Counting Constructors

2001-07-17 Thread Gertjan Kamsteeg
Unless I misunderstood the problem, the following code will 'almost' do the (first) job (misusing the first argument of showsPrec): instance Show a => Show (Bind a) where showsPrec n Zero = showInt n showsPrec n (Succ x) = showsPrec (n+1) x Works fine in Hugs 98 (with -98 as well as with

Re: using less stack

2002-03-23 Thread Gertjan Kamsteeg
You don't have to define cpsfold explicitly recursively since it can be expressed in terms of foldr: cpsfold f a xs = foldr (\x k y -> f x y k) id xs a The following definition would even be better (but not equivalent): cpsfold' f a xs = foldr (\x k y -> f y x k) id xs a The list members are

Re: using less stack

2002-03-24 Thread Gertjan Kamsteeg
From: "Alastair Reid" <[EMAIL PROTECTED]> > > Gertjan Kamsteeg <[EMAIL PROTECTED]> writes: > >> You don't have to define cpsfold explicitly recursively since it > >> can be expressed in terms of foldr: > > Hal Daume III <[EMAIL PROT

Re: diff in Haskell: clarification

2002-12-15 Thread Gertjan Kamsteeg
Ok, here is an attempt. I don't have time to explain, but it's not Myer's algorithm. Try for example diff "abcabba" "cbabac" Gertjan Kamsteeg data In a = F a | S a | B a diff xs ys = steps ([(0,0,[],xs,ys)],[]) where steps