#pipe placeholders?

1 messages · Page 1 of 1 (latest)

lost river
#

yeah gleam has that!

sage laurel
#

I think there maybe be some misconception here about the placeholder syntax, it can be any parameter

#

And you can definitely combine pipes and labels to pipe to whichever param you want to

unkempt path
#

cool, see what a noob I am!

lost river
#

you could, for instance, set a placeholder to whichever positional argument
you can do that already! with or without labels

#

in gleam the placeholder is _

unkempt path
#

thanks!

summer otter
#

It’s not limited to pipes either

#

Can do it with any function call

unkempt path
pseudo lodge
#

Tagging on here, I had trouble figuring out how to reference the "invisible" piped value if I had to reference it more than once which seemed to prevent usage of _. For example:

MyType(a=1, b=2, c=3)
  |> some_func
  |> some_other_func("example", _)
  |> problem_func(_.a, "other arg", _.c) // how is this done?
lost river
#

you write a lambda if you want to do that

#

i think it would be clearer to just not do it in the pipe at all, personally