Ion Fusion Documentation
Release 0.38a1-SNAPSHOT (2026-04-16T19:45:37.790Z)

Module /fusion/series

Abstract, ordered collections that can be consumed by for comprehensions.

A series is an abstract data type that produces any number of values in order. Their primary use is as input to the various for comprehension forms.

A number of built-in types are usable as series:

This module provides constructors that can make new series from other sources of data.

empty_series constant

A series that produces no elements.

in_port procedure
(in_port)

Returns a series of elements produced by calling read. In other words, the series produces the data on the current Ion input port.

The current port can be locally parameterized to affect iteration over Ion data in files, lobs, or strings:

(with_ion_from_file "document.ion"
  // The with_ion_from functions take a thunk:
  (lambda ()
    (series_to_list (in_port))))
=>
[1, k, {a:false}]

See /fusion/io for other ways to parameterize the current Ion input port.

in_producer procedure
(in_producer producer stop_pred)

Returns a series containing the results from calls to the producer procedure.

At each step, the producer is invoked with no argument. The stop_pred is then applied to the result(s), and if it returns truthy then the series ends (without including those values). Otherwise the producer's results are produced by the series.

is_series procedure
(is_series value)

Determines whether a value is a series that can be consumed by a for comprehension.

series_to_list procedure
(series_to_list s)

Converts the given series to an immutable list.

Each element of the series must be a single value, so things like (series_to_list {a:1}) will fail.

series_to_sexp procedure
(series_to_sexp s)

Converts the given series to a sexp.

Each element of the series must be a single value, so things like (series_to_sexp {a:1}) will fail.