Main Page | Report this Page
Computers Forum Index  »  Computer Languages (Smalltalk)  »  Lazy evaluation...
Page 1 of 1    

Lazy evaluation...

Author Message
vlas01...
Posted: Sat Aug 08, 2009 7:51 am
Guest
I have come up with an interesting implementation for the lazy
evaluation.
A sample code to show how to use it follows:


|lazy toRun temp result|

"****************************************begin lazy
implementation************"
lazy := [ :myFun| |myRun|
myRun := [ |res| res := myFun value.
myRun := [res].
res] .
[myRun value]
].
"***********************end lazy implementation
******************************

toRun := [ |sum| sum := 0. 1 to: 2 do:[:i| sum := sum + 1]. sum].

temp := lazy value: toRun.

result := temp value .

result := temp value .
 
vlas01...
Posted: Sat Aug 08, 2009 7:54 am
Guest
On Aug 8, 3:51 am, vlas01 <vla... at (no spam) yahoo.com> wrote:
Quote:
I have come up with an interesting implementation for the lazy
evaluation.
A sample code to show how to use it follows:

|lazy toRun temp result|

"****************************************begin lazy
implementation************"
lazy := [ :myFun| |myRun|
myRun := [ |res| res := myFun value.
myRun := [res].
res] .
[myRun value]
].
"***********************end lazy implementation
******************************

toRun := [ |sum| sum := 0. 1 to: 2 do:[:i| sum := sum + 1]. sum].

temp := lazy value: toRun.

result := temp value .

result := temp value .

I forgot my name
 
Jeff M....
Posted: Sat Aug 08, 2009 1:13 pm
Guest
On Aug 8, 2:54 am, vlas01 <vla... at (no spam) yahoo.com> wrote:
Quote:
On Aug 8, 3:51 am, vlas01 <vla... at (no spam) yahoo.com> wrote:





I have come up with an interesting implementation for the lazy
evaluation.
A sample code to show how to use it follows:

|lazy toRun temp result|

"****************************************begin lazy
implementation************"
lazy := [ :myFun| |myRun|
myRun := [ |res| res := myFun value.
myRun := [res].
res] .
[myRun value]
].
"***********************end lazy implementation
******************************

toRun := [ |sum| sum := 0. 1 to: 2 do:[:i| sum := sum + 1]. sum].

temp := lazy value: toRun.

result := temp value .

result := temp value .

I forgot my name

Twice Smile
 
 
Page 1 of 1    
All times are GMT
The time now is Thu Nov 26, 2009 3:27 pm