Aug. 19th, 2005

fivemack: (Default)
Not iPod, just iTunes:

Everybody wants to rule the world
Everybody is a number one
Everybody have fun tonight
Everybody's talking
Everybody's got somebody
Everybody hurts
Everybody knows
Everybody's leaving home
Not everybody dies

[yes, unconscionably few songs; I've only 15GB of the things, less than a fortnight]
fivemack: (Default)
haarStep x y = [s*(x+y), s*(x-y)]

disorderedHaar [] = []
disorderedHaar (x:y:xs) = haarStep x y : disorderedHaar xs

haar [a,b] = haarStep a b
haar s = let w = disorderedHaar s in 
         (haar (map head w)) ++ (map (!!1) w)


Divide-and-conquer algorithms come over amazingly naturally in Haskell; it's a deeply uncluttered language. First-class functions mean that it's almost always possible to abstract rather than to cut-and-paste; memory allocation and deallocation is dealt with by the garbage collector, looping by the magic of tail recursion. You can write down an algorithm in not many more words than you'd use in English, and with less ambiguity.

On the other hand, everything I've actually written in the language has been a pedagogical exercise. I've implemented pseudoprimality testing, Shanks' algorithm for square roots modulo p, arithmetic on elliptic curves, some rudimentary image processing, two different kinds of wavelet, a routine for counting polyominoes; didn't bother porting my sudoku solver from python. It's a great language for the sort of things I'd have written as a couple of hundred lines of BASIC on the Archimedes.

It may even be possible to write 'real applications'; but most of the real applications inside my head are highly graphical, pictures in the sense of maps from the complex space to a colour-wheel parameterised by arg f(x), to be computed either by vectorised assembly language or by pixel shaders (there's not much of a difference there, of course), and I wonder how to get to there from here, and once I've got there, how to distribute the result. The closest I can get to pictures are

          hPutStr hdl "P6\n1000 1000\n255\n"
          hPutStr hdl (map chr (concat (map pix (newtonset 255 zz (1000,1000)))))


and that's punched-card-era: run the program to generate the file which can be loaded into the gimp. The model in my head is to have a routine compiling an expression-tree representation of what I want to do into machine code which the program can then call; can that actually be done?

I know I used to drip with ideas for that kind of thing, to plan web-sites of moderate grandeur in the bath. What's gone wrong?

March 2024

S M T W T F S
     12
3456789
10111213141516
17181920212223
24 252627282930
31      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 12th, 2025 11:18 am
Powered by Dreamwidth Studios