Comment

Comment by sbjs

Why are there two variations for ~> and ~>> ? It looks like it limits you to using only functions that take parameters in the same position.

Why not have one position-independent version? Something where you can specify at every level which position you want to use, like this:

    (~>>> #"foobar"
          (~> bytes-length)
          (~>> number->string 16)
          (~> string->bytes/utf-8))
But that still only limits you to first and last position. Why not use a positional special form like JavaScript has with __dirname called __var?

    (~>>> #"foobar"
          (__var bytes-length)
          (number->string 16 __var)
          (__var string->bytes/utf-8))
This way you can use it no matter what functions you want. But I don't write my code in Racket so maybe this is already a solved problem.
parent sbjs 8 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton