[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Functional Programming & Math: General
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 86
Thread images: 13
File: Brown Representability.png (1 MB, 1344x1196) Image search: [Google]
Brown Representability.png
1 MB, 1344x1196
https://www.haskell.org/
http://www.schemers.org/Documents/#intro-texts
http://www.scala-lang.org/
http://elm-lang.org/
http://miranda.org.uk/
https://www.functionalgeekery.com/
https://clojure.org/
https://en.wikipedia.org/wiki/Category_theory
https://jobs.functionalworks.com/#/job-board
>>
>>54435870
Let the functional programming goddess save this board from retards and degeneracy.
>>
File: haskell.png (36 KB, 2000x1412) Image search: [Google]
haskell.png
36 KB, 2000x1412
I know a thing or two about Haskell and abstract algebra. Happy to answer any questions!
>>
>>54436235
What are closed cartesian categories? The definitions I've read made little sense.
>>
>>54436235
What resources are the best place to learn abstract algebra?
>>
>>54436589
A Book of Abstract Algebra by Charles Pinter
How to Bake Pi

also consider How to Prove It for general mathematical thinking

>>54436496
Category theory isn't my strong suit, but something like:

A CCC is a category with a terminal object - in Hask that's ()
and products - in Hask that's pairs
and exponentials - in Hask that's functions.

You can do a form of currying:
((a,b) -> c) -> a -> b -> c
and uncurrying:
(a -> (b -> c)) -> (a,b) -> c

Currying and uncurrying form what's called an adjunction.
>>
>>54437176
Thanks for the book recommendation and response. I'm not that advanced in Haskell yet, can you explain this in english?
>>
>>54437226
If that explanation didn't make sense, then you probably don't need to know about CCCs. Most Haskell programmers don't know any category theory at all. It is sort of a myth that has come about because the more famous members of the Haskell community like Edward Kmett tend to talk a lot about category theory.

It would probably be a better use of your time to learn Haskell, instead.

I recommend CIS194 - 2013 edition:
http://www.seas.upenn.edu/~cis194/fall14/spring13/index.html

And if you're hungry for more exercises, try the NICTA course:
www.github.com/NICTA/course
>>
>>54437455
Ok thanks for the resources.
>>
Haskell is shit. A programming language is supposed to be first and foremost useable above all else. Meanwhile Haskell does its best to be a Turing tar pit language.

Lisp > Haskell
>>
>>54437891
>hasklel
>turing tar pit

nice meme
>>
>>54437891
Without an advanced type system such as Haskell's, I can't even define the abstractions I rely on on a daily basis, such as Traversable Alternative, and Functor.
Types are documentation that cannot get stale.
>>
>>54438005
Requiring programmers to be experts in type theory is a failure of the language designer. Programming languages are supposed to be for creating things, not jerking off.
>>
>>54438061
You don't need to be an expert in type theory. Most professional Haskell programmers have never learnt any type theory. These are practical, composable abstractions, with many motivating examples.
>>
I go back and forth.

I like reading Haskell but writing Lisp

Whenever there is something serious I need to get done though, I reach for Lisp. Lazy evaluation and a forced functional paradigm hold me back too much.
>>
>>54438156
If you like Haskell but you want a strict programming language, try Idris. It also has some extra type system features, which make it worth learning about.
What about laziness do you dislike? (genuine question)
I hope you know there are strictness annotations to make certain parts of data structures strict, and strict variants of most data structures (Data.Map.String, Data.Bytestring.Strict, ...)
A good rule of thumb is strict data, lazy functions.
A lot of people don't like lazy IO. Its performance can be unintuitive. An iteratee library like Pipes would give you compositional strict IO.

Why do you feel like FP holds you back? How do you structure your Haskell programs?
>>
>>54438324
>If you like Haskell but you want a strict programming language
You really don't get it, do you?
>>
I really like the look of haskell (sometimes) but I am already a lisp converse.
And not even a Scheme guy but a CL man.
I'm interested in that it's based on category theory or type theory or whatever it is. I'd love to see a formal spec of the language as a mathematical entity, you know? Something that's thorough but concise.
Have anything for me babe?
>>
File: logo-and-text.png (18 KB, 396x120) Image search: [Google]
logo-and-text.png
18 KB, 396x120
>>
Anyone know a good book on type theory or category theory for someone with no experience in either?

I've got a pretty good foundation in set theory, formal logic and automata
>>
>>54438662
category theory for computer scientists by, er... just look it up in google it's right there
>>
>>54438662
https://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/
>>
>>54438770
>>54438818

thanks man. I'm about to finish my degree, and I'm looking for books on the CS end of math to explore before I immediately forget everything

Unfortunately I never got to take combinatorics or linear algebra either :/
>>
>>54435870
Who is this ugly cunt you keep putting on your Haskell threads?
>>
>>54438662
Conceptual Mathematics is the best intro category theory book. The blog post series recommended earlier is also good.
>>
>>54436235
what do I need to know to be considered proficient in haskell?
list in order of most importance to least important
>>
>>54436235
nice AMA, faggot

>>>/reddit/
>>
>>54440515
kys faggot
its almost like you're new and saw someone say "go back to plebbit" and now you wanna try it because you think is cool
>>
>>54438156
try F#
>>
File: 1310653366021.jpg (101 KB, 550x550) Image search: [Google]
1310653366021.jpg
101 KB, 550x550
>>54436235
nvidia or amd?
>>
File: outtahere.jpg (17 KB, 480x542) Image search: [Google]
outtahere.jpg
17 KB, 480x542
>>54440552
>I'm a newfag, the post

now you fucking retard you did a literal ama on /g/ you need to leave now this place is already almost unusable because of people like you
>>
>>54440665
Not even him, but kys. You are the fucking problem, instead of letting people discuss functional programming you know in a functional programming general you just come here to insult because you are a butthurt fagott. Let people learn, he is teaching them what they dont know, but here comes the memer cockgoblin whot thinks he is better than the rest. Kys
>>
>>54440665
>posts an fb image
I don't wanna shit up thread, so this is going to be my last post replying to your faggotry.
anyways, his post has value to the thread because it creates discussion pertaining to the thread

I'd agree with you if it was a "the best girl is Maki, prove me wrong" post
so please, stop being a faggot and don't shit up the thread by defining what a gentoo man is.
nobody gives a shit
>>
File: no thank you.jpg (135 KB, 800x800) Image search: [Google]
no thank you.jpg
135 KB, 800x800
>>54440557
>Microshit
>>
File: haskell-ready-for-industry2.png (1 MB, 1000x3420) Image search: [Google]
haskell-ready-for-industry2.png
1 MB, 1000x3420
>>
File: incredulous black science man.webm (1 MB, 642x435) Image search: [Google]
incredulous black science man.webm
1 MB, 642x435
>>54438061
>>
>>54438662
Category Theory: Awodey - Category Theory

Type Theory: Pierce - Types and Programming Languages
>>
I wrote a chess engine in C++ once. The hard part was the chess not the programming. OOP let's you write code so easily, since it maps to real life concepts.

Now I'm trying to rewrite the engine in lisp and I can't think of a natural way structure the program.

How would you represent the pieces and their legal moves? The state of the board? I looked at a github project and I swear the code is read only - so much nesting and unnamed functions...
>>
>>54442808

Also any very basic GUI packages for board and piece movement?
>>
>In March 2015, former VP of the Platform Engineering group at Twitter Raffi Krikorian, stated he would not have chosen Scala in 2011 due to its learning curve.[110] The same month, LinkedIn SVP Kevin Scott stated their decision to "minimize [their] dependence on Scala."[111] In November 2011, Yammer moved away from Scala for reasons that included the learning curve for new team members and incompatibility from one version of the Scala compiler to the next.[112]

>minimise our dependence on scala
that's just code for we will hire a herd of pajeets to write java instead of competent developers to write something that's actually good

instead of flying cars we get 140 characters thanks to Raffi
>>
>>54442808
you look at the entire board
you analyse the state of the board based on where each piece is

depending on who's turn it is you do one of two things

you make your move, or you let the other player move
>>
>>54442964
It is about strictness and less "magic"
http://jimplush.com/talk/2015/12/19/moving-a-team-from-scala-to-golang/

In large teams this is important, of course functional languages work well in small teams (<20)
>>
>>54442964
Java 8+ basically killed Scala
the scala experiment failed
>>
>>54437176
>How to Prove It
>free as in free beer
based
>>
>>54442808
how can it be hard?

what does oop have that other paradigms don't have?
>>
>>54443132
I don't think Java 8 killed Scala. Kotlin is going to be Scala's killer.
>>
>>54443277
linkedin moved to java from scala (which they moved from java before that)

but yea I am sure they will move to kotlin after that
>>
File: haskell-hnreddit-shills.png (260 KB, 600x800) Image search: [Google]
haskell-hnreddit-shills.png
260 KB, 600x800
>>54443009

> of course functional languages work well in small teams (<20)

Based on what evidence?

You state that as if its a fact, so you could easily dispell naysayers but providing proof of this trend, "of course"
>>
Why are you guys saying scala is dying? Honest question, dont really know much about it
>>
>>54444024
I don't know but you can get paid $170,000/yr in NY to be a Scala engineer:

https://jobs.functionalworks.com/#/job-board/585
>>
>>54444825
>https://jobs.functionalworks.com/#/job-board/585

Why doesn't mention the startup name?

Sounds like a honey trap for recruiters. I don't see similar job offerings on other websites.
>>
what is typed lambda calculus?
>>
>>54441613

I honestly can't even decipher what this pic is trying to convey
>>
>>54443181
People are used to it. That's all.
>>
>>54443132

lol. That's a lot like saying "windows with bash killed linux." Java 8's functional aspects are incomplete and it still can't really work as a purely functional language. I don't know a single person that switched to Java because of new Java 8 features
>>
>>54435870
learning python and c++, why haskell?

My teacher says that c is the ultimate language because it is as low as you can get previous to assembly.

Educate me to some extent if you are learned, and infographs for visual are appreciated.
>>
>>54446062
Scala's not a purely functional language either. It's OO with syntactic sugar.
>>
>>54446134

> "ultimate language"

Oh, man. Is this bait?
>>
>>54446300
no. His philosophy is that most languages are written in a fork of 'c' anyways.

Please explain or enlighten me.
>>
>>54446376

> all languages a fork of c

Well, I don't know enough about compilers to go into detail about where languages come from, but I do know enough to be bothered by that statement. Have you ever heard of bootstrapping? A lot of languages are literally written in themselves.

Additionally, reductionism helps no one and hurts everyone in most situations. For instance, before a language is bootstrapped, it may be written in C. But C had to go through the same process when as well (not sure if it was written in pure assembly or not). This is a really shitty rabbit hole because then:

> C is the ultimate language. Everything else is a fork of C

> Assembly is the ultimate language. C is just a fork of assembly.

> Hexcode is the ultimate language. Assembly is just a fork of hexcode

> Binary is the ultimate language. Hexcode is just a fork of Binary

> Logic gates are the ultimate language. Binary is just a fork of Logic gates

see what I mean? Doing anything in C is a pain, and that's important. Try writing a web framework in C. You don't always need to go that low level. It seems ridiculous to argue that "abstraction is bad" in a system that is literally abstractions on top of abstractions and only progresses by adding additional abstractions. Sorry if that doesn't answer your question about haskell.
>>
>>54446376
He probably means that since C is a low level language without features like garbage collection, which prevent programmers from making catastrophic and difficult to find mistakes, and higher-level imperative languages (usually object-oriented) share much their syntax with C, they are forks of C.

It's certainly not true of all languages.

With higher-level languages you can usually write code that is shorter, more appropriate for the problem domain, and easier to maintain. Dropping down to C lets you leverage higher performance.
>>
High level languages are just for people who can't into C. C is indeed the ultimate language. Every language is implemented in C. Compilers are written in C (or C++, eg clang).
>>
>>54446639

http://programmers.stackexchange.com/questions/267086/is-every-language-written-in-c

Nice try faggot. You're objectively wrong, and you're just going to get more and more wrong as time goes on
>>
>>54442964
Honestly Scala is syntactically ugly as fuck for a functional programming language.

http://rosettacode.org/wiki/Sorting_algorithms/Quicksort#Scala
http://rosettacode.org/wiki/Sorting_algorithms/Quicksort#Haskell
http://rosettacode.org/wiki/Sorting_algorithms/Quicksort#F.23

http://rosettacode.org/wiki/Mutual_recursion#Scala
http://rosettacode.org/wiki/Mutual_recursion#Haskell
http://rosettacode.org/wiki/Mutual_recursion#F.23

http://rosettacode.org/wiki/Palindrome_detection#Scala
http://rosettacode.org/wiki/Palindrome_detection#Haskell
http://rosettacode.org/wiki/Palindrome_detection#F.23

http://rosettacode.org/wiki/Remove_lines_from_a_file#Haskell
http://rosettacode.org/wiki/Remove_lines_from_a_file#Scala
http://rosettacode.org/wiki/Remove_lines_from_a_file#F.23

To be fair though this comparison isn't exactly very scientific, I'm just clicking random pages.
>>
>>54447496
Those aren't quicksort. Quicksort is an in-place sort.
>>
File: webm.webm (116 KB, 880x805) Image search: [Google]
webm.webm
116 KB, 880x805
>>
>>54447758
Doing it in-place would mean side-effects - the very thing functional programming helps us avoid. If you wanna control flow by hand, you can stick to your imperative language of choice.
>>
File: thumb_COLOURBOX3438603.jpg (23 KB, 320x212) Image search: [Google]
thumb_COLOURBOX3438603.jpg
23 KB, 320x212
>>54448209
>>
>>54448209
When your language can't do something, you redefine its meaning.
>>
>>54448490
An all-purpose language is a useless language.
>>
>>54445494
I have a profile there - you can only see the companies' names after your profile is approved.
>>
>>54448545
What company is it? I'm generally curious different anon here
>>
>>54448209
>>54448514
>I can’t even say what’s wrong with Haskell, because— okay. Imagine you have uh, a toolbox. A set of tools. Looks okay, standard stuff in there.

>You pull out a screwdriver, and you see it’s one of those weird tri-headed things. Okay, well, that’s not very useful to you, but you guess it comes in handy sometimes.

>You pull out the hammer, but to your dismay, it has the claw part on both sides. Still serviceable though, I mean, you can hit nails with the middle of the head holding it sideways.

>You pull out the pliers, but they don’t have those serrated surfaces; it’s flat and smooth. That’s less useful, but it still turns bolts well enough, so whatever.

>And on you go. Everything in the box is kind of weird and quirky, but maybe not enough to make it completely worthless. And there’s no clear problem with the set as a whole; it still has all the tools.
>>
>>54438589
underrated post
>>
>>54436589

Algebra Chapter 0 by Aluffi.
>>
>>54448916
>I can’t even say what’s wrong with Haskell
or because you dont know the language :^)
>>
File: gdgOC6a.jpg (111 KB, 629x1023) Image search: [Google]
gdgOC6a.jpg
111 KB, 629x1023
I got p. pissed when a functional programing twitter ad bot followed me.
>>
>>54449021
>using the smiley with a carat nose
>>
>>54435870
Machine Learning >>> functional programming

python and cuda/c are used to produce research (ML related) orders of magnitude more relevant then all the empty PL papers you keep regurgitating
>>
Haskell is to programming as masturbation is to sex.
>>
>>54450006
"more relevant" to what exactly?
and what does machine learning even have to do with functional programming? that's like saying "HTML is superior to C++"
>>
>>54447496
You like this more?
def qsort[T <% Ordered[T]](ls: List[T]): List[T] = {
if (ls == Nil) Nil
else qsort(ls filter (_ < ls(0))) ++ (ls filter (_ == ls(0))) ++ qsort(ls filter (_ > ls(0)))
}


I agree Scala is not that nice, but it's not even ugly as fuck as you say. Some syntax is optional (like the dot to call a method) and this is the main problem in my opinion.
>>
>>54446062
I bet you never tried to pass a method as a parameter. Java 8 functional style sucks.
>>
>>54450857 meant for >>54443132
>>
>>54450882
Ok
>>
>>54450857
Why use Java 8?
Thread replies: 86
Thread images: 13

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.