Remix.run Logo
Isognoviastoma 3 hours ago

> curried functions often don't compose nicely

Same for imperative languages with "parameter list" style. In python, with

def f(a, b): return c, d

def g(k, l): return m, n

you can't do

f(g(1,2))

but have to use

f(*g(1,2))

what is analogical to uncurry, but operate on value rather than function.

TBH I can't name a language where such f(g(1,2)) would work.

shawn_w 2 hours ago | parent [-]

perl, though that uses lists rather than multiple value or fixed-size tuples:

  #!/usr/bin/env perl
  use v5.36;
  
  sub f($a, $b) {
    return ($a+1, $b+1);
  }
  
  sub g($k, $l) {
    return ($k+1, $l+1);
  }
  
  say for f(g(1,2));
prints out

  3
  4