Skip to main content
deleted 2 characters in body
Source Link

Haskell, 87 85 - 5 == 80 82

import Data.List
t x=genericLength.((iterate(sequence.map(const$replicate x[]))[[]])!!)

Uses neither of exponentiation, multiplication or addition (!), just list operations. Demonstration:

Prelude> :m +Data.List
Prelude Data.List> let t x=genericLength.(iterate(sequence.map(const$replicate x[]))[[]]!!)
Prelude Data.List> t 2 2
4
Prelude Data.List> t 2 4
65536
Prelude Data.List> t 4 3

...
ahm... you didn't say anything about performance or memory, did you? But given enough billions of years and some petabytes of RAM, this would still yield the correct result (genericLength can use a bigInt to count the length of the list).

Haskell, 87 85 - 5 == 80 82

import Data.List
t x=genericLength.((iterate(sequence.map(const$replicate x[]))[[]])!!)

Uses neither of exponentiation, multiplication or addition (!), just list operations. Demonstration:

Prelude> :m +Data.List
Prelude Data.List> let t x=genericLength.(iterate(sequence.map(const$replicate x[]))[[]]!!)
Prelude Data.List> t 2 2
4
Prelude Data.List> t 2 4
65536
Prelude Data.List> t 4 3

...
ahm... you didn't say anything about performance or memory, did you? But given enough billions of years and some petabytes of RAM, this would still yield the correct result (genericLength can use a bigInt to count the length of the list).

Haskell, 87 85 - 5 == 80 82

import Data.List
t x=genericLength.(iterate(sequence.map(const$replicate x[]))[[]]!!)

Uses neither of exponentiation, multiplication or addition (!), just list operations. Demonstration:

Prelude> :m +Data.List
Prelude Data.List> let t x=genericLength.(iterate(sequence.map(const$replicate x[]))[[]]!!)
Prelude Data.List> t 2 2
4
Prelude Data.List> t 2 4
65536
Prelude Data.List> t 4 3

...
ahm... you didn't say anything about performance or memory, did you? But given enough billions of years and some petabytes of RAM, this would still yield the correct result (genericLength can use a bigInt to count the length of the list).

added 29 characters in body
Source Link

Haskell, 87 87 85 - 5 == 8280 82

import Data.List
t x=genericLength.((iterate(sequence.map(const$replicate x[]))[[]])!!)

Uses neither of exponentiation, multiplication or addition (!), just list operations. Demonstration:

Prelude> :m +Data.List
Prelude Data.List> let t x=genericLength.((iterate(sequence.map(const$replicate x[]))[[]])!!)
Prelude Data.List> t 2 2
4
Prelude Data.List> t 2 4
65536
Prelude Data.List> t 4 3

...
ahm... you didn't say anything about performance or memory, did you? But given enough billions of years and some petabytes of RAM, this would still yield the correct result (genericLength usescan use a bigInt to count the length of the list).

Haskell, 87 - 5 == 82

import Data.List
t x=genericLength.((iterate(sequence.map(const$replicate x[]))[[]])!!)

Uses neither of exponentiation, multiplication or addition (!), just list operations. Demonstration:

Prelude> :m +Data.List
Prelude Data.List> let t x=genericLength.((iterate(sequence.map(const$replicate x[]))[[]])!!)
Prelude Data.List> t 2 2
4
Prelude Data.List> t 2 4
65536
Prelude Data.List> t 4 3

...
ahm... you didn't say anything about performance or memory, did you? But given enough billions of years and some petabytes of RAM, this would still yield the correct result (genericLength uses a bigInt to count the length of the list).

Haskell, 87 85 - 5 == 80 82

import Data.List
t x=genericLength.((iterate(sequence.map(const$replicate x[]))[[]])!!)

Uses neither of exponentiation, multiplication or addition (!), just list operations. Demonstration:

Prelude> :m +Data.List
Prelude Data.List> let t x=genericLength.(iterate(sequence.map(const$replicate x[]))[[]]!!)
Prelude Data.List> t 2 2
4
Prelude Data.List> t 2 4
65536
Prelude Data.List> t 4 3

...
ahm... you didn't say anything about performance or memory, did you? But given enough billions of years and some petabytes of RAM, this would still yield the correct result (genericLength can use a bigInt to count the length of the list).

Source Link

Haskell, 87 - 5 == 82

import Data.List
t x=genericLength.((iterate(sequence.map(const$replicate x[]))[[]])!!)

Uses neither of exponentiation, multiplication or addition (!), just list operations. Demonstration:

Prelude> :m +Data.List
Prelude Data.List> let t x=genericLength.((iterate(sequence.map(const$replicate x[]))[[]])!!)
Prelude Data.List> t 2 2
4
Prelude Data.List> t 2 4
65536
Prelude Data.List> t 4 3

...
ahm... you didn't say anything about performance or memory, did you? But given enough billions of years and some petabytes of RAM, this would still yield the correct result (genericLength uses a bigInt to count the length of the list).