RE: Help: Stack-overflow and tail-recursive functions

2003-06-20 Thread Hal Daume
GHCi didn't have any problem even with the original code. mine didn't either, until I increased the 200 to around 1500...it's probably OS/memory specific. ___ Haskell-Cafe mailing list [EMAIL PROTECTED]

Using an accumulator, iterating...

2003-06-20 Thread Brett Kelly
Hello all, I'm trying to write a function that takes a list and a element (same type) and returns the index of the first instance of the element in the list. like: getindex brett 'e' would return 2, etc. i'm trying to accomplish this using an accumulator, here's what i've got: pyindex :: Eq a

Re: Using an accumulator, iterating...

2003-06-20 Thread mike castleman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Fri, Jun 20, 2003 at 06:23:42PM -0700, Brett Kelly wrote: now, i know i've got a syntax problem, because i'm pretty sure my logic is correct (or at least MOSTLY correct). Try: pyindex :: Eq a = a - [a] - Maybe Int pyindex c l = pyindex' 0 l

Re: Using an accumulator, iterating...

2003-06-20 Thread Glynn Clements
Brett Kelly wrote: I'm trying to write a function that takes a list and a element (same type) and returns the index of the first instance of the element in the list. like: getindex brett 'e' would return 2, etc. i'm trying to accomplish this using an accumulator, here's what i've got:

Re: Using an accumulator, iterating...

2003-06-20 Thread Brett Kelly
Awesome, thanks! Sometime around Fri, Jun 20, 2003 at 09:47:54PM -0400, mike castleman said: On Fri, Jun 20, 2003 at 06:23:42PM -0700, Brett Kelly wrote: now, i know i've got a syntax problem, because i'm pretty sure my logic is correct (or at least MOSTLY correct). Try: pyindex :: Eq

Re: Help: Stack-overflow and tail-recursive functions

2003-06-20 Thread Koji Nakahara
On Fri, 20 Jun 2003 07:54:50 -0700 Hal Daume [EMAIL PROTECTED] wrote: mine didn't either, until I increased the 200 to around 1500...it's probably OS/memory specific. Only 600 causes the stack overflow in my environment(FreeBSD, 640MB). Interestingly, on GHCi, the program shows the elements