Veeky Forumsbtfo

Find a flaw
> protip: you can't

Other urls found in this thread:

pastebin.com/MUajNsaE
0x0.st/2Q-.hs
en.wikibooks.org/wiki/Haskell/MonadPlus
en.wikipedia.org/wiki/Hindley–Milner_type_system
en.wikipedia.org/wiki/Lazy_evaluation
twitter.com/SFWRedditImages

This is a science and math board. For languages you might enjoy a bit more.

>not using Haskell
Wow, it's like you don't even program.

I fucking hate you coder zombies with your codes n shit

That's fucked up but would actually work if it returned the length of the vector instead of the vector itself

Arithmetic in the category of sets is also basically this. Any two sets of cardinality 4 resp. 7 are isomorphic (in bijection to), e.g. {0,1,5,6} and {3,5,6,2}, and addition (coproduct, i.e. the direct sum) of a set with 4 element and one with 7 gives you one with 11 elements, and this is again isomorphic (in bijection) to any other set of cardinality 11.

You restrict yourself to FinSet, the finite sets, and require that your set argument come with a total order - i.e. you work with finite lists.

PS instead of unpacking list elements, you can just do "++" and "+="
a = [1,7]
b = [2,3]
r = a++b
Then r points at [1,7,2,3].
r += b
Then r points at [1,7,2,3,2,3].

This. But obviously OP was baiting in layers of retardation.

B8'd hard

This.

Lisp is legit too, though.

i did this in lua a while ago just for keks

pastebin.com/MUajNsaE

now try to construct the real numbers :^)

Congratulations, you've just discovered the basic arithmetic Charles Babbage used to design the Analytical Engine. You're only about 180 years too late.

>Veeky Forums completely btfo
>how will it ever recover?

> exponent function isn't even recursive

what is this trash?

>nonrecursive slow as shit exponentials
Kys

wew, babby's first peano encoding

meanwhile in Haskell

[code]
add = (++)
multiply = (>>)
power = foldr (>>) (pure ()) .: (

I did this in the haskell type system and wrote fizzbuzz in it for the lulz

0x0.st/2Q-.hs

It's funny how this is fucking short, and still, beyond that, the MonadPlus class even abstracts from it exactly like that

en.wikibooks.org/wiki/Haskell/MonadPlus

In your code: What's the backwards fish

Wait do academics unironically do things that can be done iteratively recursively in haskell

There is not "for" construction in haskell, but stuff like folds are another method

>In your code: What's the backwards fish

there's `for` in haskell (but it's an example of a catamorphism)

for :: (Traversable t, Applicative f) => t a -> (a -> f b) -> f (t b)

for [1..10] doSomething

this would run `doSomething` on each number from 1 to 10 and collect all of the results

sounds like mental masturbation to me

I don't know why anybody would want that when C or c++ exists

It's okay brainlet, nobody's forcing you to move on

Why have different languages at all?
Haskell in particular has laziness and (much) stronger type system, traded off for more abstraction (and different abstractions) and thus slower code
en.wikipedia.org/wiki/Hindley–Milner_type_system
en.wikipedia.org/wiki/Lazy_evaluation

But it was an academic project and there's also nothing wrong with that.
Why do we have different music bands?

Different tools for different jobs.

This.

god damn, what language is this and why is addition not part of its core instructions

>Not multiplying with fast fourier transform.

Looks like Python.

The functions aren't adding/multiplying/raising to the power though. First concats two arrays, second outputs the second array a number of times equal to the length of the first, and the third seems to repeatedly output the first array the sum of the second array's elements times.

My Python's a bit shaky though, so that may well be wrong.

this, is python even trying?

both of those implement the `min` operation

+1

>lot's of
>infuriating
>small
>parenthesis

if you are gonna write functional code, at least use OCaml

>def power
and this is why imperative programming is cancer.