# What's the meaning of \`to\_string.map(\_)\`?

**URL:** <https://racket.discourse.group/t/whats-the-meaning-of-to-string-map/4510>\
**Category:** Questions & Answers\
**Tags:** rhombus\
**Created:** [December 1, 2026, 8:38pm UTC](https://racket.discourse.group/t/whats-the-meaning-of-to-string-map/4510 "2026-12-01T20:38:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnSnow](https://avatars.discourse-cdn.com/v4/letter/j/74df32/32.png) [@JohnSnow](https://racket.discourse.group/u/JohnSnow)\
**Post date:** [December 1, 2026, 8:38pm UTC](https://racket.discourse.group/t/whats-the-meaning-of-to-string-map/4510/1 "2026-12-01T20:38:15Z")

</div>

I come to this strange piece of code from rhombus's doc about `|>`

> **[4.2 Function Calls](https://docs.racket-lang.org/rhombus-reference/ref-function-call.html#%28def._%28%28submod._%28lib._rhombus%2Fprivate%2Famalgam..rkt%29._core-derived%29._~7c~3e%29%29)**
>
> An expression followed by a parenthesized sequence of expressions is parsed as an implicit use of the #%call form, which is normally bound to implement function calls.

```lisp
[3, 1, 2] |> to_string.map(_)

```

Alternatively this strange code is `to_string.map(_)([1,2,3])`.

I find the code makes more sense with

```lisp
(_.map(to_string))([3, 1, 2])

```

---

<div class="post-metadata">

**Author:** ![ndykman](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/ndykman/32/2140_2.png) [@ndykman](https://racket.discourse.group/u/ndykman)\
**Post date:** [December 2, 2026, 2:52am UTC](https://racket.discourse.group/t/whats-the-meaning-of-to-string-map/4510/2 "2026-12-02T02:52:12Z")

</div>

The use of `|>` matches the operator available in ML like languages (OCaml, F#), Haskell doesn't have it natively, but many code bases define it as it is easy enough in Haskell to do.

It's used to create a pipeline:

```scheme
numbers 
|> List.filter(_ , x => (_ > 0))
|> List.sort(_)
|> List.take(_, 2)

```

This is often preferred to chaining the method calls. It also shines when the return value types change in the pipeline.

---

<div class="post-metadata">

**Author:** ![shhyou](https://avatars.discourse-cdn.com/v4/letter/s/ccd318/32.png) [@shhyou](https://racket.discourse.group/u/shhyou)\
**Post date:** [December 2, 2026, 4:05am UTC](https://racket.discourse.group/t/whats-the-meaning-of-to-string-map/4510/3 "2026-12-02T04:05:16Z")

</div>

> [@JohnSnow](#):
>
> Alternatively this strange code is `to_string.map(_)([1,2,3])`.

Yes and, actually, I think the code is also

```scheme
to_string.map([1,2,3])
;;=> ["1", "2", "3"]

```

I think I finally figured the secret sauce here: this is not mapping over lists, but rather calling the `Function.map` method (based on an annotation error message I got). Here is the doc: [4.1&nbsp;Functions](https://docs.racket-lang.org/rhombus-reference/ref-function.html#%28def._%28%28submod._%28lib._rhombus%2Fprivate%2Famalgam..rkt%29._core%29._.Function._%28.Function..map._~23f%29%29%29)

> ```
> method (f :: Function).map(args0 :: List, args :: List, ...)
> :: List.of(Any.like_result(f))
> 
> ```
> 
> Applies `f` to each element of each `args` (including `args0`), iterating through the `args` lists together, [...]

In short this is not a dynamically-dispatched map (so other data like MutableList or PairList won't work). The code is, after un-abbreviating everything,

```scheme
[1,2,3] |> (fun lst: Function.map(to_string, lst))

```

So `_` works in its expected manner but the code is actually different from `List.sort(_)` or `[1,2,3] |> List.map(_, to_string)` or `[1,2,3].map(to_string)`.
