Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Can your language do this?

Name: Anonymous 2012-11-13 22:29

average = sum / genericLength

import Control.Monad
import Control.Monad.Instances
import Data.List

instance Eq (x -> a)

instance (Num a, Eq a) => Num (x -> a) where
    fromInteger = const . fromInteger
    f + g = liftM2 (+) f g
    f * g = liftM2 (*) f g
    f - g = liftM2 (-) f g
    negate = (negate .)
    abs = (abs .)
    signum = (signum .)

instance (Eq a, Fractional a) => Fractional (x -> a) where
    f / g = liftM2 (/) f g
    recip = (recip .)
    fromRational = const . fromRational

Name: Anonymous 2012-11-13 22:30

what does it do? too much syntax. Lisp is all I can take for my puny brain.

Name: Anonymous 2012-11-13 22:37

>>2
It's functional programming. Lisp weenies aren't expected to understand it.

Name: Anonymous 2012-11-13 22:47

>>1-3
same haskell-using dog-sucking faggot

Name: 2 2012-11-13 22:48

I was asking honestly. It's too much syntax. I have reached Lisp satori and do not need ``Haskell''

Name: Anonymous 2012-11-13 22:56

J can:
+/%#
+/ is sum (reduce by addition).
% is division.
# is length.
Thus this phrase computes the sum divided by the length.

Don't change these.
Name: Email:
Entire Thread Thread List