POV-Ray : Newsgroups : povray.off-topic : Really epic : Re: Really epic Server Time
11 Oct 2024 03:15:30 EDT (-0400)
  Re: Really epic  
From: Orchid XP v7
Date: 14 Feb 2008 14:59:43
Message: <47b49daf$1@news.povray.org>
nemesis wrote:
> Invisible <voi### [at] devnull> wrote:
>> (g,s) = (\x -> x, \x -> x*x)
>>
>> That last line is the best. I didn't even realise you could *do* that!
> 
> yes!  very cool!  Looks like Perl/Python 2 way assignment, but of course there's
> no assignment here, it's 2 functions defined in the same line by 2 tuples!
> Haskell is amazing...

I should have realised that this was possible - I've just never seen it 
at the top-level before.

It's kinda nice to be able to write things like

   (a',b',c',d') = (b,c,d,a)

to do a rotation. All those C programmers are sitting there defining 
temporary variables to handle the shuffle, while I can just tell the 
compiler exactly what I want the end result to be, and it just does it...

Interestingly, the compiler infers some rather strange types for those 
functions. Clearly \x -> x is id, yet the compiler infers a less general 
type than this - presumably due to the tupling. Or perhaps to the other 
call sites in the program, I'm not sure...

>> Very odd...
>>
>> Right, so, let's do some analysis here.
> 
> man, just run this madness and see what it does...

And how do you suggest I do that, given that there's no obvious "entry 
point"?

-- 
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.