POV-Ray : Newsgroups : povray.off-topic : Games programmers : Re: Games programmers Server Time
10 Oct 2024 19:23:21 EDT (-0400)
  Re: Games programmers  
From: Invisible
Date: 12 Sep 2008 09:37:05
Message: <48ca7081$1@news.povray.org>
>> Really? I mean, it's a little perplexing that the computer is actually 
>> able to unravel it without getting stuck, but once you understand what 
>> the machine is doing internally, it's not so hard.
>>
> You mean that you not only understands how it works, but it even helped 
> you understand how compilers work?

Well I mean *notionally*, the way Haskell executes is fairly simple. In 
the case of the magic tail-chasing fibs definition, fibs starts out as a 
list where some list cells are defined, and some haven't been computed 
yet. And the ones that haven't been computed yet refer to the ones that 
have. (If it were the other way round, you WOULD have a problem.) As you 
ask for list cells, they get computed, one by one, until you get the one 
you want.

It's a nice example of how lazy evaluation allows you to program in 
unusual ways, but it's probably not terrifically practical unless you 
only need a handful of Fibonacci numbers.

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.