POV-Ray : Newsgroups : povray.off-topic : My first C++ program : Re: (And in Haskell. Obviously.) Server Time
1 Oct 2024 03:18:29 EDT (-0400)
  Re: (And in Haskell. Obviously.)  
From: Invisible
Date: 22 Sep 2008 05:08:46
Message: <48d7609e$1@news.povray.org>
Nicolas Alvarez wrote:

> I understand the C++ one and the Haskell one looks like line noise.

I just found this in the Haskell humour section:

   bos: come on, real programmers use "(((,) <$>) .) . (<*>)"

(It's an IRC quote.)

I wish to point out that I had to actually go look up some of those 
operators just to find out what they do!

   (,) takes two values and returns a 2-element tuple.
   <$> is a generalised version of "map" (not just for lists).
   .   is function composition, as always.
   <*> takes a collection of functions and a collection of values and 
applies one to the other.

So that little expression has the type signature

   (Applicative col) => col (x -> y) -> col x -> col (z -> (y, z))

which more or less tells you what it does (once you realise that "col" 
means "a collection of"). Quite why this particular function would be 
useful for anything is another matter...


Post a reply to this message

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