24 ms·
Functional Programming Jargon
- KevanM 9y agoThe contents links all go back to the top of the page.
- moomin 9y agoGotta love it when “Category Theory for Programmers” is provided as a further reading link on a very introductory article.
- dogruck 9y agoYes. Although I question the usefulness of this jargon list, I think Bartosz Milewski’s CTfP is excellent: https://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/ https://bartoszmilewski.com/2014/10/28/category-theory-for-p...
- d3ckard 9y agoThank you very much for that. Downloaded, on read list now.
- bitwalker 9y agoI bought a physical copy of this recently, it's been great so far, certainly the best introduction to the topic I've read.
- tommikaikkonen 9y agoWhere can I order a physical copy?
- deleted 9y ago[deleted]
- reborg 9y agoI assume @hemanth is happy for the project README to appear on the blog of a recruitment agency. Along with the rest of the blogs that seem to be copy pasted from the original location. Should I guess functional-works obtained permission from all the original copyright holders?
- deleted 9y ago[deleted]
- arianvanp 9y agoOriginal article is here: https://github.com/hemanth/functional-programming-jargon/blob/master/readme.md https://github.com/hemanth/functional-programming-jargon/blo... Functional works does not mention the MIT license and thus is allegedly infringing on his copyright. They link to the original source though. And the author seems to be hemanth himself. So perhaps this is all false alarm.
- deleted 9y ago[deleted]
- charliejrgower 9y agoWe absolutely receive permission before we publish anything. With final approval coming from the author before anything goes live. We have a platform that givs visibility to the great work that’s being done in the functional space.
- Sir_Cmpwn 9y ago>We have a platform that givs visibility to the great work that’s being done in the functional space. Wow, that's disingenous. That's nothing like what you do. You have a platform that promotes your brand by copying and pasting other people's content into a worse presentation with your logo in a sticky navbar stuck to the top of the page.
- fnwx17 9y agoyeah, we reached out directly to Hemanth and got a written consent to re-publish as long as the attributions were visible enough - he is credited as the author, plus there is a link for the original source at the bottom. As with all articles on our blog that are not written by us, the authors can reach out to us at any time if they want to make any changes to the article and we'll be happy to comply. As well, they can make the changes by themselves at any point. Regarding the MIT license, we didn't think of mentioning it on the blog - but thank you for head's up, we'll look into it.
- nicolast 9y agoMay be worth to mention a 'Functor' in OCaml is a different kind of beast than the 'Functor' explained in this article (which is ~ the Haskell Functor type-class).
- eru 9y agoAnd perhaps add something about (OCaml) modules in that case? The whole list seems to be mostly Haskell-inspired terminology translated to JavaScript(?), so OCaml-style modules and thus functors might make less sense to describe thoroughly. (Even though the OCaml people have a better claim to be using Functor in something resembling its mathematical meaning.)
- GreaterFool 9y ago> Even though the OCaml people have a better claim to be using Functor in something resembling its mathematical meaning. I think that is not accurate. Haskell's notion of a functor is basically taken from category theory. Same with applicative functor. It is easy to draw commutative diagrams for things like `Maybe` or `Either a` to prove it! In contrast in OCaml functors are module functions. Do modules form categories? Maybe? I haven't seen anyone talking about category of OCaml modules. Perhaps in some papers. But even if they do I wouldn't call OCaml's claim better. When one says Functor in Haskell it is generally understood as "the category theory thing". When one says functor in OCaml I think most people, myself included, would think "module function", whether it satisfies category-theory requirements or not. Also, worth pointing out that OCaml too has applicative functors. Those are such functors that when applied to same modules produce same types. Whether that fits with the category-theoretic notion of applicative functor... haven't thought about that! Maybe? Basically module M1 = Make(F)(G) module M2 = Make(F)(G) then if `M1.t` is the same as `M2.t` for some `t` the we have an applicative functor. The other side of the coin are generative functors: each time you apply them they mint new types: module M1 = Make(F)(G)() module M2 = Make(F)(G)() Then `M1.t` /= `M2.t`. This has been introduced in OCaml `4.02`
- eru 9y agoThanks! The main point against Haskell functors being 'proper' is that they only work in the category of 'Hask'.
- deleted 9y ago[deleted]
- rajman187 9y agoWhy JavaScript indeed...
- kowdermeister 9y agoSo you won't have to spend an eternity to reverse engineer the syntax of a language you don't know. Like a lean Chinese book written in Chinese would be a bit counter productive intended for westerners.
- rajman187 9y agoIt's a terrible language in general, so your analogy doesn't really work. It would be really easy to introducs this in python, for example. If it takes someone an eternity to reverse engineer python then there is a bigger problem here than learning functional programming...
- kowdermeister 9y agoWhich of JavaScript's terribleness appears in the examples provided by the article? I was referring to fully functional languages. I love Python too, however its lambdas have a bit weird syntax.
- wruza 9y agoEven “why javascript” link has error in it. And I spotted it not even writing js daily, probably because of the fact that it is such a joke.
- kowdermeister 9y agoThat "error" is an urlencoded question mark. If that's your biggest problem, fine, but point fingers at GitHub :)
- wruza 9y ago
- alphaalpha101 9y agoCorrection: Haskell jargon. The continued conflation of Haskell and functional programming as a whole annoys me greatly. (The majority of functional programming is not statically typed! Clojure and the other lisps are far more widely used than Haskell and the MLs, not even to mention that basically every language has first-class functions now.)
- marcosdumay 9y ago"Constant" is a term almost never spoken at Haskell circles, and "referential transparency" appears much more often within lispers and Clojure practitioners than between haskellers.
- gmfawcett 9y agoIt is a stretch to suggest that Haskellers don't discuss referential transparency as much as Lispers do. It's a fundamentally important concept in writing and reasoning about Haskell programs.
- marcosdumay 9y agoThere's a large "fish don't talk about the water" effect. When talking about Haskell, people talk about referential transparency, but when writing Haskell, it's very rare.
- xelxebar 9y agoI know this is off topic, but I really wish pages wouldn't hide content behind JavaScript. The page I see would work just as well as just HTML with a little CSS styling.
- deleted 9y ago[deleted]
- wruza 9y agohttps://github.com/hemanth/functional-programming-jargon/blob/master/readme.md https://github.com/hemanth/functional-programming-jargon/blo... (it is original article) In my other deleted comment I thought only links don’t work; but it appears that you see nothing at all with js off.
- fnwx17 9y agoindeed the links to the sections don't work for now and we're looking into it. regarding the JS stuff, the site is built as an SPA and the blog is only one feature, the others are job postings and a personal dashboard where a signed-in user can pin their favorite jobs to keep them for further reference It's also built using ClojureScript, Reframe, Clojure & GraphQL plus a revamped version launch is planned for mid-December, so I'm afraid the JS is still going to be there :)
- tempodox 9y agoPage doesn't display in Kindernet Exploder. All you see is a header and a footer and no content inbetween.
- fnwx17 9y agoWe’ll look into it, but can’t promise much as we’re launching a new version mid December which should be friendlier across more platforms.
- matthew349hall 9y agowhy in the world would you need to provide support for that browser?
- jw- 9y agoI think the jump from 'Category' to 'Value: Anything that can be assigned to a variable.' was a somewhat jarring change in abstraction level. Also, trying to explain Monad, Comonad, or Applicative as 'jargon' is probably a step too far IMO. They are not important for getting started with FP, and describing them without their equational properties is kind of meaningless. That being said I liked alot of the inclusions; partial application, closure, composition. I think the collection is probably slightly guilty of trying to be too clever by including advanced concepts.
- sidlls 9y agoThese terms provide a concise way to communicate more complex concepts in a technical, specialized context: practically the definition of "jargon." But that's also the reason I agree with you as regards their utility in most programming. Simply knowing the "what" of the definitions is barely a start. Those who know the definitions and are comfortable enough with the material to use them effectively would find little value in lists of this sort. For most (almost all) programming efforts outside a very narrow niche of academic applications it's not even necessary.
- elihu 9y agoI think it makes sense to include some of the advanced jargon in a list of this kind because they're words that people are likely to encounter in online discussions about functional programming.
- jefozabuss 9y agoFound two bugs with the page (in case a developer is reading this thread) I clicked on any topic in the list and it just scrolled me to the top of the page. (Mac OS + Chrome latest / Safari latest) Also if you refresh the page with a url which has a #link in it it will reload with an empty-ish content.
- fnwx17 9y agoHey, thanks for pointing it out - the first one we’re currently looking into as we’re using github style markdown, but the second one is fairly new. We’ll launch a new version of the site mid December which will address the current issues. Iterating...
- spion 9y ago> Lifting is when you take a value and put it into an object like a functor. It should probably say: > Lifting is when you take a function and make a version of it that operates on functors / applicatives.
- jethrolarson 9y agoI don't think this is strictly true. Sure there's liftA2 that does that but as a general concept, you can lift things of various kinds into a monad (or other thing like that). For example, `pure`/`return` (`of` in fantasy-land) lifts a value into an applicative/monad. I'm not sure if lifting is just application of a coalgebra but I'm still learning too. :)
- spion 9y agoAFAIK lifting is informal and specifically refers to lifting functions. Confusion arises when this is accomplished via Applicative which... erm "lifts" currying itself.
- have_faith 9y agoLoved the concise explanations of the What. A nice extension of this would be the Why, something I usually struggle to understand. Currying as an example, I'm none the wiser as to why it's a preferable way of composing a function and it's arguments, or when either is applicable.
- hood_syntax 9y agoLet's say you have a validation function that matches a string with a given regex, and you need to use that same logic in several places, using a different regex. Currying allows you to write something like this: validate :: Regex -> String -> T validate r s = ... validateIpAddr :: String -> T validateIpAddr = validate ipRegex validateZipCode :: String -> T validateZipCode = validate zipCodeRegex And so on and so forth. It can reduce boilerplate, and lets you do stuff like map partially applied functions to functors.
- jandrese 9y agoThis doesn't really seem to save you much, since you're going from: validate(IpAddr, Regex) to validateIpAddr(Regex) I have to admit I'm a little fuzzy on why currying is desirable so there's probably something obvious I'm missing.
- taejo 9y agoIt's `validateIpAddr(String)`: the first argument is fixed. Suppose you have a list of strings, and you want to extract the ones that are IP addresses. Then you can just write filter (validate ipRegex) listOfStrings instead of filter validateIpAddr listOfStrings where validateIpAddr string = validate ipRegex string
- jandrese 9y agoWhy not just map { validate(ipRegex, $) } listOfStrings
- masklinn 9y ago
- tedmiston 9y agoLooks like the article on Works Hub was copied & pasted from the original source on GitHub, as others have mentioned in subthreads. Would be great if we could update the article link to the primary source to give the many contributors credit. https://github.com/hemanth/functional-programming-jargon https://github.com/hemanth/functional-programming-jargon
- charliejrgower 9y agothe post is linked back to the original source at the bottom of the page.
- tedmiston 9y agoYeah, I saw that and disliked that they copied the entire very long post then buried the attribution in one small line at the very bottom which most people will not read to. Without putting that upfront, the site that copied is playing in a gray area of plagiarism where this is presumed to be original content from the top of the post.
- charliejrgower 9y agoNice idea - should be moved to the top to avoid confusion. However, all post are approved by the author before they go live so it's really down to the writer to structure the post how they wish.
- tedmiston 9y agoIf you are affiliated with the website that republished, it would be great to see clearer upfront indication of reposted content.
- jethrolarson 9y agoBugs me to see this glossary posted as an article. Especially with the broken formatting and links. The article also won't get the updates as the github updates. Seems like a bad deal all around. I say this as one of the main contributors
- dualogy 9y ago> "Since these rules govern composition at very abstract level, category theory is great at uncovering new ways of composing things." I understood this much already prior. What I'd like next now are at least a handful (half-dozen-or-so) of concrete and truly compelling examples of such "uncoverings" ;) OK, 1 or 2 would also be a start
- thedufer 9y agoHere's a couple: Monads are so pervasive that multiple languages have determined that they deserve special syntax (see: Haskell's do-notation, OCaml's let-syntax). Those syntaxes play nicely with a ton of seemingly-different types, such as promises, options (maybes/nullables), lists, monadic error handling (either, or_error), etc. On a similar note, recognizing the structure of monads has in the past allowed me to abstract things in an interesting way. For example, say I have a dict lookup function (takes a key, returns a value) and I want to build a bunch of useful functions on top of that. But we want to use them in many different contexts - the dict might be remote or locally in memory (promises vs. not) and we may or may not be in a test context (monadic vs exception-based error-handling). By recognizing that we can just abstract over monads, we can easily handle these 4 cases (promise, promise+error monad, error monad, unit monad).
- jw- 9y agoBy OCaml's let syntax do you mean this: https://blog.janestreet.com/let-syntax-and-why-you-should-use-it/ https://blog.janestreet.com/let-syntax-and-why-you-should-us...? You can also add F# computation expressions to the list!
- thedufer 9y agoYes, that's what I mean by let syntax. The implementation and more description can be found at https://github.com/janestreet/ppx_let https://github.com/janestreet/ppx_let I failed to find F# computation expressions, probably because I searched for the word "monad" which they seem to be avoiding, but that's another great example.
- 9y ago
- zumu 9y agoAnyone have any insight as to why they call `bind/flatmap` `chain` instead of just `flatmap` (given `bind` is already taken in JS)?
- s4vi0r 9y agoPresumably because it represents a 'chain' of dependent computations or something along those lines.
- kentosi 9y agoReally nice. Small suggestion: It would be really nice if the table of contents allowed me to click to the section itself.
- dfabulich 9y agoMy biggest request would be to add "map" to the list, precisely because it's ambiguous. It could mean: 1) any key/value data structure 2) a hashmap, specifically 3) a function that runs on each element of an array to make a new array
- Mikeb85 9y agoIn a functional language I'd expect it to be #3 every time, no?
- castis 9y agomy only experience with this being confusing is the immutable.js Map construct. https://facebook.github.io/immutable-js/docs/#/Map https://facebook.github.io/immutable-js/docs/#/Map While this doesn't cause an immense amount of confusion, it does throw me every once in a while.
- rbobrowicz 9y agoThose are all just particular cases of the same concept. A "map", well, maps values in a domain to values in a codomain. A mathematical function is a map. A key/value data structure can be viewed as a partial function on a non contiguous, discrete domain. A hashmap is just an implementation detail of a key/value structure. A map over an array is again just a function mapping an array in one domain to another array in a codomain.
- skybrian 9y agoWhile that's true in a sense, I think it sweeps important details under the rug, which confuses things more than it enlightens. You can iterate over the domain of a map data structure, but not (in general) a map function. For purposes of education and communication, I think it's unfortunate that we use the same name for these things.
- maxpert 9y agoIt's interesting how simple and understandable now these concepts are with JS. I couldn't imagine a language written in 7 days ending up with ability to handle all this.
- morty16 9y agoThe original JS borrowed heavily from Scheme (lisp1 + everything evaluatable) and Self (prototype model of inheritance) and then was covered with a bunch of Java-like nonsense, which (IMO) just made things more complex. There's been a nice functional language buried in JS all this time. It's still buried in there someplace.
- zdkl 9y agoIf you make it through the tooling, clojurescript is magical.
- Antrikshy 9y agoHow similar is modern JS to the original "7 day" language?
- maxpert 9y agoModern JS is just syntactic sugar on top of concepts introduced in original JS. It's so much flexible you have to appreciate the beauty; you can have getters/setters or classes but it the core is such a simple concept; you can mold it any way you like it.
- mihau 9y agoDoes anyone know of similar github repos / websites that describe things (does not have to be fp) by providing code / math examples ?
- Antrikshy 9y agoYou can explore popular GitHub repos and filter by "Unknown languages": https://github.com/trending/unknown https://github.com/trending/unknown
- kim031 9y agoProfessor Frisby's Mostly Adequate Guide to Functional Programming https://drboolean.gitbooks.io/mostly-adequate-guide/ https://drboolean.gitbooks.io/mostly-adequate-guide/