Re: Avoiding local variable declarations?
On Mon, 17 Nov 2008 10:10:16 +0000, Jorgen Grahn wrote:
That's (also?) Haskell syntax and I agree that it is useful to write
readable code.
I think it's called variable and works like variables work in
mathematics, i.e. you can assign only once. Not such illogical crap like
``a = a + 1`` which must be obviously false unless 1 is defined as the
neutral element for the definition of ``+`` here. :-)
Ciao,
Marc 'BlackJack' Rintsch
On Mon, 17 Nov 2008 10:10:16 +0000, Jorgen Grahn wrote:
On Thu, 13 Nov 2008 12:49:02 -0800 (PST), dpapathanasiou
<denis.papathan asiou@gmail.com wrote: ...
>>
>I come from a functional programming school of thought, where you avoid
>local variable declarations if at all possible.
>
I'm not sure that's universal. Using Standard ML at Uni, it was often
useful to use "let name = expr in expr" (or whatever the syntax was) to
simplify an expression. Directly borrowed from mathematics, I assume.
<denis.papathan asiou@gmail.com wrote: ...
>>but what's wrong with you original code?
>I come from a functional programming school of thought, where you avoid
>local variable declarations if at all possible.
I'm not sure that's universal. Using Standard ML at Uni, it was often
useful to use "let name = expr in expr" (or whatever the syntax was) to
simplify an expression. Directly borrowed from mathematics, I assume.
readable code.
'name' is not a variable, of course; there are no variables in
functional programming. Can't remember what it's called -- named
expression, maybe?
functional programming. Can't remember what it's called -- named
expression, maybe?
mathematics, i.e. you can assign only once. Not such illogical crap like
``a = a + 1`` which must be obviously false unless 1 is defined as the
neutral element for the definition of ``+`` here. :-)
Ciao,
Marc 'BlackJack' Rintsch
Comment