I said you could use as-> to work around the placement of an argument that doesn’t quite fit into a larger pattern of -> . My example was:

( -> results :matches ( as-> matches (filter winning-match? matches)) (nth 3) :scores (get "total_points" ))

This is not a good example, because filter is a lazy sequence function that should more properly be used with ->> . And I warned explicitly against mixing -> and ->> .

Here’s a better example.

Say you have three functions, each taking a “context map” as their first argument and returning a similar map:

( defn one [context ...] ...) ( defn two [context ...] ...) ( defn three [context ...] ...)

Those functions can be chained together neatly with -> :

( -> context (one ...) (two ...) (three ...))

Now say you need to insert a call to another function that doesn’t quite follow the same pattern, maybe from a library whose source you do not control:

( defn irritating [... context ...] ...)

Here’s where the as-> macro really shows its purpose. You can slip in a call to irritating without having to change the structure of the -> .

( -> context (one ...) (two ...) ( as-> ctx (irritating ... ctx ...)) (three ...))

That’s a good use case for as-> , but I would tread cautiously even here. as-> subverts the usual pattern of -> and, as such, should be used only in exceptional situations where the alternative is worse.