liveBook · Manning

Juxt

As explained in Clojure: The Essential Reference

juxt is a Clojure function that returns a function applying multiple supplied functions to the same arguments and collecting their results in a vector.

juxt creates a function multiplexer: it applies multiple functions to the same arguments and returns their results in a vector. Each supplied function must accept the generated function’s argument count. section 2.2.6

Collecting several views

((juxt first second last) (range 10)) ;; [0 1 9]. The output vector preserves the supplied function order and has the same size as the function list. section 2.2.6

How Clojure: The Essential Reference covers it

How deep it goes
Defines inputs, outputs, arity requirements, exceptions, and several executable patterns, but does not descend into implementation internals.
Examples
Demonstrates collection inspection, grid-neighbor generation, word decoration, formatted output, sorting, and grouping.
What it assumes
Assumes familiarity with functions, arity, collections, and higher-order operations such as map, filter, sorting, and grouping.
What you can do after
Apply juxt to build functions that return ordered vectors of several computations over shared arguments.
How it connects
Connects higher-order functions with map, filter, identity, sort-by, and group-by.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Clojure: The Essential Reference. The section links point to the parts of the book it draws on.