"Point-Free or Die: Tacit Programming in Haskell and Beyond" by Amar Shah

  Рет қаралды 28,134

Strange Loop Conference

Strange Loop Conference

7 жыл бұрын

Tacit programming, or programming in the “point-free” style, allows you to define a function without reference to one or more of its arguments. Thanks to automatic currying, point-free definitions can be easy to write in Haskell, OCaml, and F#.
But is point-free syntax just point-less? Ostensibly, tacit definitions can calibrate your code to the appropriate level of abstraction. But which level is most appropriate? When is a point-free definition better than its “pointed” variation? And when is it spectacularly worse?
Let's be explicit about tacit programming. Let's learn eta-reduction to produce it. Let's develop our intuition for its expressive power. Let's hunt for it in trusted libraries. Let's probe its origins in John Backus' function-level programming. Let's see it amplified in Joy and J, languages designed for maximum quiet. Let's speak at length, about the unspoken.

Пікірлер: 22
@1111757
@1111757 3 жыл бұрын
What if you have a function that takes 3 arguments? I stopped the talk right in the middle because I was wondering that myself and had to play around with it. And the answer is actually quite beautiful: - blackbird is a compose of compose and compose - blackbird with 3 args is a compose of compose and blackbird - blackbird with 4 args is a compose of compose and blackbird with 3 args - blackbird with 5 args is a compose of compose and blackbird with 4 args Alternatively, blackbird with 4 args is a compose of blackbird and blackbird. I was hoping to also find the blackbird of blackbird and blackbird but that seems less useful (it's something like `outer(middle(inner(x, y), z))`).
@abebuckingham8198
@abebuckingham8198 2 жыл бұрын
Yeah it's called currying after Curry Haskell. There is also a programming language named after him. en.wikipedia.org/wiki/Currying
@SloeElvis
@SloeElvis Жыл бұрын
@@abebuckingham8198 Haskell Curry* lol
@AlexanderGosselin
@AlexanderGosselin 5 жыл бұрын
This is fantastic.
@wyc7tjmf794
@wyc7tjmf794 7 жыл бұрын
Joy, Factor, Kitten. Recursion combinators are cool. Great talk though.
@KipIngram
@KipIngram 6 ай бұрын
I like your "non-dogmatic" approach to all this.
@ruffianeo3418
@ruffianeo3418 7 жыл бұрын
He is right, that the way one writes code is all about communication (well most of the time, sometimes it is about performance). And the first question should be: Who is going to read the code? It could be another haskell programmer, it could be a domain expert (often a customer) with problem domain knowledge but not if any haskell knowledge. The next question should be: How are the readers going to read the code? A print on paper, in the subway on the way home in form of a killing time code review? Interactively in a ghci to play around with the code? With a debugger? For the paper case, as well as for the case where a non-haskell pro reads the code, IMHO locality of functionality is vital. If the reader sees (...) and a) does not even notice it is an overloaded operator (maybe he thinks it is a part of haskell he has not seen yet or it is something like C++ variadic templates..) or b) he knows it is some operator but he has no clue how it looks like and where it is defined, the code review is over. They see some syntax and a few names but cannot even guess what the code will do as all the information related to that is written anywhere but in the spot they look at. So, sometimes it could be best to do brain dead on point code with well known functions and operators.
@gregbell2117
@gregbell2117 4 жыл бұрын
This is an interesting point. So much of understanding FP code seems to rely on the reader having a really thick theoretical foundation. The complexity is in the theory, not the code. Imperative/procedural code, on the other hand, relies on just understanding some basic operations, and what a sequence is.
@ratfuk9340
@ratfuk9340 4 ай бұрын
You could say the same thing about composition. But composition is such a useful idea that everyone knows it. Blackbird (and others) _should_ be considered a useful pattern as well and everyone should learn it.
@IanKjos
@IanKjos Жыл бұрын
Clever, but terseness puzzles. The signature illuminates.
@trblyoo823
@trblyoo823 5 жыл бұрын
Does anyone know of a tool/parser that shows you all the steps from pointful to point free and vice versa? He had a great point that to find what communicates best, you'll need to know what your options actually are. I'm still new to Haskell and the ($) (.) (...) operators are "understood", but I don't have them pattern recognition chops yet. I was hoping to build up that skill by finding a tool that did it for me so I could have these patterns thrown in my face over and over. TL:DR - Anyone know of a tool that does these eta-reductions/vice-versa for you? (Specifically in Haskell)
@fernandooliveira266
@fernandooliveira266 4 жыл бұрын
Yeah, in haskell there is a program called "point-free". If you use vim you can try it by github.com/m00qek/vim-pointfree
@Argletrough
@Argletrough 8 ай бұрын
hmm... exactMatches in APL: +/=
@SergeyPedan
@SergeyPedan 3 жыл бұрын
What sorcery is this
@MyAce8
@MyAce8 4 жыл бұрын
in case anyones curious the way you do the three argument blackbird is (.) . (.) . (.) or (.) . (...) where "..." is blackbird
@DanDart
@DanDart 4 жыл бұрын
Fun fact: it's called Bunting, or B2.
@philipschloesser
@philipschloesser 4 жыл бұрын
Nice way to see (and generalise) this: fmap . fmap . fmap (or any composition of fmaps) has the type (Functor f, Functor g, Functor h) => (a -> b) -> f (g (h a)) -> f (g (h a)), so it is the fmap of the functor you obtain by composing the functors f, g, and h. Now, if we consider the special case of our functors being reader functors, i.e. (->) e, then we just have fmap = (.). So (.) . (.) . (.) takes an a -> b to an (x -> y -> z -> a) -> (x -> y -> z -> b)
@acykablyatley
@acykablyatley 8 ай бұрын
​@@DanDartor ..... ;)
@magne6049
@magne6049 2 ай бұрын
Point free programming is actually less expressive, not more. Because you express less, and being more implicit. Tacit means silence as you say. More silence is less expression.
@glialcell6455
@glialcell6455 7 жыл бұрын
Haha if you want to write code like that so badly Joy would be a much better fit than Haskell.
"Hackett: a metaprogrammable Haskell" by Alexis King
33:40
Strange Loop Conference
Рет қаралды 12 М.
"The J Programming Language" by Tracy Harms (2013)
27:40
Strange Loop Conference
Рет қаралды 12 М.
Они убрались очень быстро!
00:40
Аришнев
Рет қаралды 3 МЛН
IS THIS REAL FOOD OR NOT?🤔 PIKACHU AND SONIC CONFUSE THE CAT! 😺🍫
00:41
Pointless or Pointfree - Damjan Vujnovic
53:51
NDC Conferences
Рет қаралды 1,5 М.
[Haskell'23] The Evolution of Effects
1:06:11
ACM SIGPLAN
Рет қаралды 5 М.
"Propositions as Types" by Philip Wadler
42:43
Strange Loop Conference
Рет қаралды 125 М.
"The Mess We're In" by Joe Armstrong
45:50
Strange Loop Conference
Рет қаралды 377 М.
Haskell is Not For Production and Other Tales
38:19
Linux.conf.au 2016 -- Geelong, Australia
Рет қаралды 100 М.
"Dependent Types in Haskell" by Stephanie Weirich
38:42
Strange Loop Conference
Рет қаралды 22 М.
Adventure with Types in Haskell - Simon Peyton Jones (Lecture 1)
1:33:37
Debunking Haskell Myths and Stereotypes
10:04
Impure Pics
Рет қаралды 10 М.
Мечта Каждого Геймера
0:59
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 1,2 МЛН
Настоящий детектор , который нужен каждому!
0:16
Ender Пересказы
Рет қаралды 288 М.
iPhone 12 socket cleaning #fixit
0:30
Tamar DB (mt)
Рет қаралды 35 МЛН
Cadiz smart lock official account unlocks the aesthetics of returning home
0:30
AI от Apple - ОБЪЯСНЯЕМ
24:19
Droider
Рет қаралды 111 М.