|
|
Warp wrote:
> Invisible <voi### [at] devnull> wrote:
>>> If I'm not mistaken, for example assignment produces a side-effect.
>>> Even I/O causes side-effects.
>
>> Assignment and I/O are both side-effects. Accessing an indexed array
>> does not. There is absolutely no reason why a pure functional language
>> cannot have arrays.
>
> Are you telling me in Haskell you can't modify the contents of an array
> in-place? (By "indexable array" I implied that it can be assigned to,
> although I should have perhaps stated it more explicitly.)
Haskell provides a kind of array that you cannot modify in-place. (It's
useful e.g. for pre-computed lookup tables.)
Haskell also provides another kind of array which can be modified
in-place in the same sense that files can be written to - i.e., your
program returns a set of instructions to the runtime that says "hey,
create this array and modify its contents like this". Which makes sense
really. After all, what is a "file"? It's a named array of bytes that
can be modified [and reised] in-place! :-D
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
|