> defunctionalization, a transformation that replaces higher-order functions with equivalent first-order ones. For anyone else who got nothing from the title.
I admit to fawning for functional languages like Haskell, Clojure and OCaml for fun, but it seems like they are not more popular because having many additional, higher-order constructs makes code “obsfucated” behind clever features rather than written as simply as possible (but no simpler). Maybe for a coding shop full of insane geniuses (i.e., quants, CalTech aerospace, physicists or Stanford research department) it…
Defunctionalization: Everybody Does It, Nobody Talks About It
11–20 of 23 posts
Re: Defunctionalization: Everybody Does It, Nobody Talks About It
#12Earlier quoted context omitted.
What are the ergonomics-first languages of the functional world?
I would say that rust and kotlin are good at providing most of the useful concepts from functional programming (higher order functions, common functors (map, filter, etc), tail call, pattern matching, destructuring, expressions, lazy evaluation, immutable collections, actor model, algebraic data types) Sadly they lack some features at the type system level (higher kinded types, intersection and union types) TypeScrip…
Re: Defunctionalization: Everybody Does It, Nobody Talks About It
#13Earlier quoted context omitted.
What are the ergonomics-first languages of the functional world?
I would say that rust and kotlin are good at providing most of the useful concepts from functional programming (higher order functions, common functors (map, filter, etc), tail call, pattern matching, destructuring, expressions, lazy evaluation, immutable collections, actor model, algebraic data types) Sadly they lack some features at the type system level (higher kinded types, intersection and union types) TypeScrip…
Re: Defunctionalization: Everybody Does It, Nobody Talks About It
#14The authors work seems very interesting, and could maybe lead to the automatic generation of a language server with semantic query and refactoring capabilities, for any programming language. Or portable (in the 'language to language' sense) static analysis tools or interpreters or symbolic execution tools... Just wondering (out loud) how you formalize language semantics so they can be consumed... I know about grammar…
Another popular tool I'm aware of for this is Ott[1], which lets you write a high-level semantics description, much like you'd write in a LaTeX paper. It can then compile it to Coq, LaTeX, etc for further work. Ott is probably a much better place to start without getting too far into the weeds, if you want to write real high-level sketches.
In general, I (unfortunately) don't think there's anything like a "library" of language semantics definitions that are easily reusable or anything like that. Modular definitions of semantics that can be reused like a library/API is basically a programming language abstraction problem, but I'm not sure what the current forefront of research on that is. In general, very few languages have fully specified machine-checked semantics, or even unproven ones.
Re: Defunctionalization: Everybody Does It, Nobody Talks About It
#15> For instance, I teach programmers to tune out the noise of refactoring catalogs and learn how most familiar refactorings instead follow from a few primordial algebraic laws Why "instead?" Knowing more math is good, but I think the author is doing his students a disservice. You don't need to memorize refactoring catalogs, but if someone says "maybe you should use a visitor pattern here" it's helpful to look it up an…
They can learn that stuff after they've become familiar with the fundamentals. Visitor pattern is just a way to implement pattern matching starting from the primitives Java and the like provide.
Re: Defunctionalization: Everybody Does It, Nobody Talks About It
#16Earlier quoted context omitted.
I admit to fawning for functional languages like Haskell, Clojure and OCaml for fun, but it seems like they are not more popular because having many additional, higher-order constructs makes code “obsfucated” behind clever features rather than written as simply as possible (but no simpler). Maybe for a coding shop full of insane geniuses (i.e., quants, CalTech aerospace, physicists or Stanford research department) it…
What are the ergonomics-first languages of the functional world?
Re: Defunctionalization: Everybody Does It, Nobody Talks About It
#17Earlier quoted context omitted.
They can learn that stuff after they've become familiar with the fundamentals. Visitor pattern is just a way to implement pattern matching starting from the primitives Java and the like provide.
That's like saying that people can learn arithmetic after they learn group theory, which they can learn after they learn category theory. No, learn the concrete first, then learn the abstractions, so that you have some concept of why the abstractions are relevant.
Re: Defunctionalization: Everybody Does It, Nobody Talks About It
#18Earlier quoted context omitted.
That's like saying that people can learn arithmetic after they learn group theory, which they can learn after they learn category theory. No, learn the concrete first, then learn the abstractions, so that you have some concept of why the abstractions are relevant.
I'm not sure we do kids a service by skipping over fundamental aspects of mathematics in order to stick to the 'more concrete' stuff. The staggeringly vast majority of kids will never learn a lick of group theory or category theory, and I think that is unfortunate because the fundamentals aren't difficult or big. Most high school grads will hardly have touched even basic logic, and it is frighteningly common to run i…
First, even if you can teach group theory or category theory to an 8-year-old, if you wind up with an 8-year-old who knows category theory but can't add, is that a win? No, it isn't. They need to be able to add in a way that they don't need group theory.
But, second, you can't in any meaningful way teach category theory, or even group theory, to an 8-year-old. But you can teach them to add.
So again, I say, concrete first, then abstractions. First because they can function better knowing one concrete form and no abstract than they can knowing the abstract and zero concrete forms. And second, they are able to learn the most-useful concrete form younger and with less background than they are able to learn the abstraction.
Re: Defunctionalization: Everybody Does It, Nobody Talks About It
#19Re: Defunctionalization: Everybody Does It, Nobody Talks About It
#20Earlier quoted context omitted.
I admit to fawning for functional languages like Haskell, Clojure and OCaml for fun, but it seems like they are not more popular because having many additional, higher-order constructs makes code “obsfucated” behind clever features rather than written as simply as possible (but no simpler). Maybe for a coding shop full of insane geniuses (i.e., quants, CalTech aerospace, physicists or Stanford research department) it…
What are the ergonomics-first languages of the functional world?