[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

How important is it for elements of code to be algebraic structures?

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 10
Thread images: 1

File: I5rYA.gif (20KB, 644x652px)
I5rYA.gif
20KB, 644x652px
How important is it for elements of code to be algebraic structures?

For example:
I store some data in a list-type structure, adding two lists gives another list to its a groupoid. Since the addition of lists is associative and the empty list is the identity element its actually a monoid.

Now I can do the following:
1) Overload negation to mean remove a matching entry from the end of the list
2) (This is usually not implemented in a list) If nothing can be removed, let the list remember it sothat it will remove an entry once its added.

Now the list has inverses, so its a Group. Further I can now let the list sort itself when a new element is added, thus now its an Abelian group.

Now There are two options, I can either leave it with the properties of a group, or I can force the list to contain only unique elements, then it becomes an Abelian Semigroup where each element is Idempotent.

A drawback to this might be that the structure is too limiting to accommodate some elements of code, but I can see this making it easier to reason about your code since everything obeys familiar mathematical theorems.

So should code be mathematical structures?
>>
The only math I ever use for programming is pointer arithmetic.
>>
>>57259151
it's important only if you're a meme coder
>>
>>57259151
>How important is it for elements of code to be algebraic structures?

It's not. You should not limit or alter functionality to shoehorn something into common algebraic structures.

It's only useful for abstraction, and not more so than any other type of contract.
>>
>>57259151
Real programmers care about getting shit done, not following useless masturbatory rules
>>
>>57259322
>math professors who built CS were unreal programmers
>>
>>57259377
They also got shit done and claimed the domain of computing in the name of imperative programming.

You know what happened to the math autists?
They went with stateless functional programming and that shit has yet to take off in any meaningful way.
Just look at haskell. It's been "ready for industry" for nearly 20 years, and yet it only has one high visibility project written in it, and it's a buggy piece a shit, not due to logic errors, but because of limitations in the language.
>>
>>57259395
*limitations of the implementation, which is the fault of the language.
>>
>>57259395
>>57259403
I'm not much an autist to get into functional programming and I generally suck at math, so I don't understand Haskell at all.
>>
>>57259395
>>57259403
Well the main problem with Haskel isnt that it uses algebraic structures, its that they are obsessed with pure code, and then try to do everything an imperative language can do with it by using retarded shit like state monads.
Thread posts: 10
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.