Re: Using an accumulator, iterating...

2003-06-21 Thread Artie Gold
Brett Kelly wrote: 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:

Re: Using an accumulator, iterating...

2003-06-21 Thread Wolfgang Jeltsch
On Saturday, 2003-06-21, 03:23, CEST, Brett Kelly wrote: 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

Assembling lists start-to-end

2003-06-21 Thread Mark Carroll
I am assembling a list from start to end. I can add elements to the end with previous ++ [current] or I can add them with current : previous and reverse it when I'm done. Or, maybe I should use some other data structure. (I don't know the length in advance.) Any thoughts? -- Mark

Re: Assembling lists start-to-end

2003-06-21 Thread Wolfgang Jeltsch
On Saturday, 2003-06-21, 14:38, CEST, Mark Carroll wrote: I am assembling a list from start to end. I can add elements to the end with previous ++ [current] or I can add them with current : previous and reverse it when I'm done. Or, maybe I should use some other data structure. (I don't know

Re: IO system

2003-06-21 Thread Glynn Clements
naudts guido wrote: Take following function: f::Array Int Char - (Array Int Char, Char) f array = (array1, c) where c = array!1 array1 = array//[(2,'b')] and also following function: f::Direct_access_file - (Direct_access_file, Char) f daf = (daf1, c) where c =

Re: IO system

2003-06-21 Thread Duncan Coutts
On Sat, 21 Jun 2003 17:34:59 +0100 Glynn Clements [EMAIL PROTECTED] wrote: I do not see why the location of data should have an influence here. Haskell values are private to the program, while file contents may be read and written by other processes. Haskell computations can be