logoalt Hacker News

kaoD • today at 1:04 PM • 2 replies • view on HN

I never liked currying. It feels more theoretically elegant than practically useful.

IMO it is hard to read (unless you're very familiar with the functions at hand), produces type errors that are not easy to follow (oops, I forgot the last arg), and is too rigid (I often need to partially apply arguments in non left-to-right order).

I never understood why partial application via "slots" isn't more common though (I just made up the term, not sure if this has a name). Like Clojure's:

    #(f %2 "foo" %1 "bar")
    ;; same as
    (fn [a b] (f b "foo" a "bar"))
Does Gleam have something like that?

Replies

nchagnet • today at 1:11 PM

Yes Gleam allows you to do f(arg, _)

See the relevant docs: https://tour.gleam.run/everything/#functions-function-captur...

senderista • today at 6:55 PM

Are there any physicists out there who are reminded of abstract index notation for tensors?