Live data from Hacker News

Pipelining might be my favorite programming language feature

herecomesthemoon.net

91–100 of 360 posts

Re: Pipelining might be my favorite programming language feature

#91

I feel like, at least in some cases, the article is going out of its way to make the "undesired" look worse than it needs to be. Compairing fn get_ids(data: Vec ) -> Vec { collect(map(filter(map(iter(data), |w| w.toWingding()), |w| w.alive), |w| w.id)) } to fn get_ids(data: Vec ) -> Vec { data.iter() .map(|w| w.toWingding()) .filter(|w| w.alive) .map(|w| w.id) .collect() } The first one would read more easily (and, s…

They did touch on that.

> You might think that this issue is just about trying to cram everything onto a single line, but frankly, trying to move away from that doesn’t help much. It will still mess up your git diffs and the blame layer.

Diff will still be terrible because adding a step will change the indentation of everything 'before it' (which, somewhat confusingly, are below it syntactically) in the chain.

Re: Pipelining might be my favorite programming language feature

#92

I tried to convince the julia authors to make a.b(c) synonymous to b(a,c) like in nim (for similar reasons as in the article). They didn't like it.

What were their reasons?

I suspect:

Julia's multiple dispatch means that all arguments to a function are treated equally. The syntax `b(a, c)` makes this clear, whereas `a.b(c)` makes it look like `a` is in some way special.

Re: Pipelining might be my favorite programming language feature

#93
post #87

Earlier quoted context omitted.

Because it makes more sense?

I would wager within a rounding error, all humans have a lifetime of experience in following directions of the form: 1. do the first step in the process 2. then do the next thing 3. followed by a third action I struggle to think of any context outside of programming, retrosynthesis in chemistry, and some aspects of reverse-Polish notation calculators, where you conceive of the operations/arguments last-to-first. All…

Consistency is more important. If you ever wrote:

a(b())

then you're already breaking your left-to-right/first-to-last rule.

Re: Pipelining might be my favorite programming language feature

#95
A pipeline operator is just partial application with less power. You should be able to bind any number of arguments to any places in order to create a new function and "pipe" its output(s) to any other number of functions.

One day, we'll (re)discover that partial application is actually incredibly useful for writing programs and (non-Haskell) languages will start with it as the primitive for composing programs instead of finding out that it would be nice later, and bolting on a restricted subset of the feature.

Re: Pipelining might be my favorite programming language feature

#96
post #31

Am I the only one who thinks yuck? Instead of writing: a().b().c().d(), it's much nicer to write: d(c(b(a()))), or perhaps (d ∘ c ∘ b ∘ a)().

Why, if you don't have to, would you write the functions in reverse order of when they're applied?

It's a bit snarky, but would you rather write FORTH then? So instead of

     draw(line.start, line.end);
     print(i, round(a / b));
you'd write

    line.start, line.end |> draw;
    i, a, b |> div |> round |> print;

Re: Pipelining might be my favorite programming language feature

#97
post #31

Am I the only one who thinks yuck? Instead of writing: a().b().c().d(), it's much nicer to write: d(c(b(a()))), or perhaps (d ∘ c ∘ b ∘ a)().

A subtlety that I think many people overlook is that putting function application in lexicographical order means that tools can provide significantly better autocomplete results without needing to add a magic keybinding.

Re: Pipelining might be my favorite programming language feature

#98
post #24

I'm personally someone who advocates for languages to keep their feature set small and shoot to achieve a finished feature set quickly. However. I would be lying if I didn't secretly wish that all languages adopted the `|>` syntax from Elixir. ``` params |> Map.get("user") |> create_user() |> notify_admin() ```

It would be even better without the `>`, though. The `|>` is a bit awkward to type, and more noisy visually.

Re: Pipelining might be my favorite programming language feature

#99
post #93
post #87

Earlier quoted context omitted.

I would wager within a rounding error, all humans have a lifetime of experience in following directions of the form: 1. do the first step in the process 2. then do the next thing 3. followed by a third action I struggle to think of any context outside of programming, retrosynthesis in chemistry, and some aspects of reverse-Polish notation calculators, where you conceive of the operations/arguments last-to-first. All…

Consistency is more important. If you ever wrote: a(b()) then you're already breaking your left-to-right/first-to-last rule.

There are some math books out there that use (x)f. My understanding is (some) algebraists tried to make it a thing ~60 years ago but it never really caught on.

Re: Pipelining might be my favorite programming language feature

#100
I suffer from (what I call) bracket claustrophobia. Whenever brackets get nested too deep I makes me uncomfortable. But I fully realize that there are people who are the complete opposite. Lisp programmers are apparently as claustrophil as cats and spelunkers.
Post reply on HN