Find a flaw
> protip: you can't
>not using Haskell
Wow, it's like you don't even program.
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].
>>8458671
This. But obviously OP was baiting in layers of retardation.
>>8458688
B8'd hard
>>8458655
This.
>>8458655
Lisp is legit too, though.
i did this in lua a while ago just for keks
http://pastebin.com/MUajNsaE
now try to construct the real numbers :^)
>>8458644
Congratulations, you've just discovered the basic arithmetic Charles Babbage used to design the Analytical Engine. You're only about 180 years too late.
>/sci/ completely btfo
>how will it ever recover?
>>8458644
> exponent function isn't even recursive
what is this trash?
>nonrecursive slow as shit exponentials
Kys
>>8458644
wew, babby's first peano encoding
meanwhile in Haskell
[code]
add = (++)
multiply = (>>)
power = foldr (>>) (pure ()) .: (<$)
[/code]
>>8459092
I did this in the haskell type system and wrote fizzbuzz in it for the lulz
https://0x0.st/2Q-.hs
>>8459176
It's funny how this is fucking short, and still, beyond that, the MonadPlus class even abstracts from it exactly like that
https://en.wikibooks.org/wiki/Haskell/MonadPlus
In your code: What's the backwards fish <$ again?
And is ":" the only List things in the power-line?
Wait do academics unironically do things that can be done iteratively recursively in haskell
>>8459208
There is not "for" construction in haskell, but stuff like folds are another method
>>8459207
>In your code: What's the backwards fish <$ again?
x <$ y = pure x <* y
or
x <$ y = const x <$> y
>>8459304
It's okay brainlet, nobody's forcing you to move on
>>8459304
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
https://en.wikipedia.org/wiki/Hindley%E2%80%93Milner_type_system
https://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?
>>8459304
Different tools for different jobs.
>>8458655
This.
>>8458644
god damn, what language is this and why is addition not part of its core instructions
>>8458644
>Not multiplying with fast fourier transform.
>>8460180
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.
>>8458655
this, is python even trying?
>>8460247
both of those implement the `min` operation
>>8459006
>lot's of
>infuriating
>small
>parenthesis
if you are gonna write functional code, at least use OCaml
>>8458644
>def power
and this is why imperative programming is cancer.