4 ms·
The problem with category theory and monads, etc are that they are inaccessible for some of the popular tools. E.g. javascript, python, ruby . It invariably ha
by sandGorgon 9y ago
The problem with category theory and monads, etc are that they are inaccessible for some of the popular tools. E.g. javascript, python, ruby .
It invariably happens that learning these patterns needs you to learn haskell, lisp or erlang. Which is where accessibility breaks down.
If there was a conceptual framework that bridges these higher order designs to accessible languages .. even if partially so, that would be killer.
P.S. I love what dg for python has done - http://pyos.github.io/dg/ http://pyos.github.io/dg/
>Annoy advocates of the category theory!
>With Haskell's syntax but none of its type system, dg is the best way to make fans of static typing shut up already
- edem 9y agoHow can you call lisp an inaccessible language? It has less syntax than anything else. It is as simple as a language gets.
- kryptiskt 9y agoBrainfuck has even simpler syntax and is even more inaccessible. There's way more to languages than syntax.
- edem 9y agoBrainfuck it unintuitive, but Lisp is. You can learn the lambda calculus in 10 minutes. You can'c tompare the two.
- 201709User 9y agoIt's better to have 50 keywords than 1000 nested brackets.
- empthought 9y agoPersonally I don't see the advantage of )}]]})} over ))))))).
- kazinator 9y agoIt's more time consuming to close )}]]})}. With ))) we just repeatedly type ))) until the cursor jumps to the target opening paren we are trying to close. With a mixture of different parens we have to interrupt what we are doing and determine the correct parens which will continue the closing sequence.
- flavio81 9y ago>With ))) we just repeatedly type ))) until the cursor jumps to the target opening paren we are trying to close. Exactly. Or, the IDE can close all the parens for you: SLIME command "slime-close-all-parens-in-sexp", which you can map to whatever key combination you want.
- Udik 9y agoI think there are people who value completeness- they enjoy working on systems with many rules tailored for specific use cases, and like accumulating knowledge about which rule is the correct one to apply in each situation; and there are people who value open-endedness- systems that have few simple rules that can be combined to obtain novel and unexpected results, even if these are not as optimized as they could be in a more complete system. I picture the difference as that between a role playing game and chess: complex, domain-specific rules on one side, simple and abstract rules on the other.
- edem 9y agoNot really. You can't comment on this until you tried a lisp. I know that you haven't tried it because if you had you would have known about paredit and how it solves the paren problem.
- hoorayimhelping 9y agoHow many stack overflow questions and answers are there for lisp(s)? How many for Java? How many applications on the web are written in a lisp? How many are written in Java (or Python or Ruby or PHP)? There's a lot more to accessibility than how easy the syntax is to grok. This is just one simple and limited example.
- flavio81 9y ago>How many stack overflow questions and answers are there for lisp Yet there are a ton of books written about Lisp in all kinds of topics and applications. Not to mention really well-written tutorials like "Practical Common Lisp". Plus, the documentation/reference of the language itself is comprehensive and well written, comparing favorably to the documentation for most programming languages out there.
- flavio81 9y ago>How many applications on the web are written in a lisp? You are using one right now: Hacker News is written on a Lisp: Arc. Also, the first HTTP 1.1 compliant server and used by the W3C to debug the HTTP 1.1 reference implementation, was written in Common Lisp.
- lolive 9y agoI have learnt monads via the absolutely MARVELOUS book by Brian Lonsdorf. cf https://github.com/MostlyAdequate/mostly-adequate-guide https://github.com/MostlyAdequate/mostly-adequate-guide I agree that Haskell is built around those concepts. But the point of learning category theory is to change your mindset when programming. And even in Javascript, it is super useful. (basically because, while trying to learn category theory, you become fluent in functional programming ).
- sandGorgon 9y agopretty cool. Especially this. >Part 3 will start to dance the fine line between practical programming and academic absurdity. We'll look at comonads, f-algebras, free monads, yoneda, and other categorical constructs. I myself like this - https://github.com/valentjedi/ddd-dynamic https://github.com/valentjedi/ddd-dynamic - but I'm beginning to think maybe all of this is not the right paradigm for programming in languages like javascript or python. The success of tools like React or RxJava in Android makes me think that the tools define the paradigm and not the other way around... no matter how much we want it to be.
- BoiledCabbage 9y agoI'm not certain, but isn't RxJava just a specific inplementation of a monadic pattern with IObservables? I thought the original Rx was a Haskeller saying "Hey a 'dsl' built on a monad would be really powerful here in C#" and implemented it. Then it spread to other langs from there.
- tasuki 9y agoNot sure what you mean by "inaccessible", but you can use monads pretty much anywhere. In my opinion the biggest hurdle is the fact that getting to unrestand purely functional programming is pretty difficult. You start with monads, but quickly find out they do not compose. Move on to monad transformers, good for the simple stuff, but then you hit another wall because they don't compose either! Move on (up!) to tagless final and/or free monads. There are _a lot of_ concepts that don't have any equivalent in "the real world". The gang of four design patters are a child's toy in comparison.
- sandGorgon 9y agogenuine question - can this be done in python in a production ready manner ? I'm have been trying to answer this question for quite some time. In Haskell, writing monads or applying category theory is part of the idiomatic language. Not so in js or python. for example, if you want to apply haskell like concepts in javascript, the closest thing I know is purescript (http://www.purescript.org/ http://www.purescript.org/) or Bucklescript. So you need to switch over to a different language to achieve the richness of these concepts. I'm hardpressed to apply these concepts idiomatically to the mainstream languages. Compare this to design patterns or OO, or reactive programming (via rxjs or whatever) - which are so accessible that they are now the reason to learn a particular language!
- tasuki 9y agoWrt your question about production-ready manner: I don't know. However, there are many libraries which make functional programming in Python seem viable. See eg: https://pypi.python.org/pypi/PyMonad/ https://pypi.python.org/pypi/PyMonad/
- lmm 9y ago> genuine question - can this be done in python in a production ready manner ? It can, but without a type system you lose most of the benefits. You can put monads in there but if you refactor fearlessly the way you would in Haskell (without tests), you'll get production bugs. > Compare this to design patterns or OO, or reactive programming (via rxjs or whatever) - which are so accessible that they are now the reason to learn a particular language! Isn't that the same thing? Monads etc. are the reason to learn Haskell.
- marcosdumay 9y agoOn the other hand, as soon as you know how to apply the concepts of CT, learning Haskell mostly is a matter of syntax. So, why not? Besides, I don't think you would gain anything by using CT concepts in a language that won't resolve type polymorphism for you. It will lead to a mess of a code, where you'll have to make everything explicit. By the way, great language. an await command in a where scope is just phenomenal. Between seamless lambdas, interdependent functional declarations, and forced async I don't think it missed any language at its trolling.