POV-Ray : Newsgroups : povray.off-topic : Really epic : Re: Really epic Server Time
14 Nov 2024 18:23:05 EST (-0500)
  Re: Really epic  
From: Invisible
Date: 14 Feb 2008 10:35:15
Message: <47b45fb3$1@news.povray.org>
OK, so I had a go at unscrambling this...



cox n = foldr (\x y -> 128 * y + x) 0 n

de n = un (\x -> (x `mod` 128, x `div` 128), (==0)) n

coll = un (\zs -> (take 35 zs, drop 35 zs), (==""))

pe (n,m) x = s (p (n `div` 2, m) x) `mod` m

p (n,m) x = if n==0
               then 1
               else (if even n then pe (n,m) x else po (n,m) x)

po (n,m) x = (x * p (n-1, m) x) `mod` m

un (f,p) n = if p n then [] else (let (a,b) = f n in a : un (f,p) b)

(g,s) = (\x -> x, \x -> x*x)



That last line is the best. I didn't even realise you could *do* that! 
Very odd...

Right, so, let's do some analysis here.

- "g" is the identity function, and "s" is the square function.

- Apparently "un" is a list unfold function. It takes an integer and a 
pair of functions. The second function tells it when to stop unfolding; 
the first one actually does the unfold.

-- "coll" uses "un" to split a text string into blocks of 25 characters. 
So idea why.

-- "cox" appears to be using a list fold to convert a list into a giant 
code number. (Note that it works with arbitrary precision integers.) 
"de" looks like it's trying to do the reverse operation.

- The "p" function appears to be trying to decide whether to call "pe" 
or "po" depending on whether n is odd or even.

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