[Haskell-cafe] Functions are first class values in C
Cristian Baboi
cristian.baboi at gmail.com
Sat Dec 22 09:51:08 EST 2007
On Sat, 22 Dec 2007 16:26:18 +0200, Miguel Mitrofanov
<miguelimo38 at yandex.ru> wrote:
>> Lazy constant in C:
>>
>> int C1 (){
>> return 7;
>> }
>> C1 is computed only when you apply the operator () to it.
> But that's not the point of lazyness. Lazy value is computed only ONCE.
Ok. I guess I cannot be sure I'll call C1 only once.
How about this
int C1(){
static c1=-9999;
if(c1==-9999){
c1=7
}
return c1
}
More information about the Haskell-Cafe
mailing list