Because it can be used to wrap any expression.
I haven't seen a debug function that returns the value again anywhere else.
I haven't seen a debug function that returns the value again anywhere else.
https://github.com/arclanguage/anarki/blob/master/arc.arc#L1...
Edit: Yes, it's in Common Lisp too, so it goes back at least to the 1980s and probably further.
http://www.lispworks.com/documentation/HyperSpec/Body/f_wr_p...
.tap { |x| puts x }
For those of you who don't know Ruby, its map/filter/reduce functions chain like this: values.map { |x| x + 2 }.select { |x| x > 3 }
So when you want to look at an intermediate result, there's the .tap() method that runs a lambda with that intermediate result, then passes it on to the next step in the chain. [0, 1, 2, 3].map { |x| x + 2 }.tap { |x| puts x }.select { |x| x > 3 }
This returns [4, 5] after printing [2, 3, 4, 5]. ("puts" is Ruby's println.)