TermStreamer
TermStreamer()
A term streamer that can handle large expressions, by streaming terms to and from disk.
Methods
Name | Description |
---|---|
fits_in_memory | Check if the term stream fits in memory. |
get_byte_size | Get the byte size of the term stream. |
get_num_terms | Get the number of terms in the stream. |
load | Load terms and their state from a binary file into the term streamer. The number of terms loaded is returned. |
map | Apply a transformer to all terms in the stream. |
map_single_thread | Apply a transformer to all terms in the stream using a single thread. |
normalize | Sort and fuse all terms in the stream. |
push | Push an expression to the term stream. |
save | Export terms and their state to a binary file. |
to_expression | Convert the term stream into an expression. This may exceed the available memory. |
clear
TermStreamer.clear()
Clear the term streamer.
fits_in_memory
TermStreamer.fits_in_memory()
Check if the term stream fits in memory.
get_byte_size
TermStreamer.get_byte_size()
Get the byte size of the term stream.
get_num_terms
TermStreamer.get_num_terms()
Get the number of terms in the stream.
load
=None) TermStreamer.load(filename, conflict_fn
Load terms and their state from a binary file into the term streamer. The number of terms loaded is returned.
The state will be merged with the current one. If a symbol has conflicting attributes, the conflict can be resolved using the renaming function conflict_fn
.
A term stream can be exported using TermStreamer.save
.
map
map(f) TermStreamer.
Apply a transformer to all terms in the stream.
map_single_thread
TermStreamer.map_single_thread(f)
Apply a transformer to all terms in the stream using a single thread.
normalize
TermStreamer.normalize()
Sort and fuse all terms in the stream.
push
TermStreamer.push(expr)
Push an expression to the term stream.
save
=9) TermStreamer.save(filename, compression_level
Export terms and their state to a binary file. The resulting file can be read back using TermStreamer.load
or by using Expression.load
. In the latter case, the whole term stream will be read into memory as a single expression.
to_expression
TermStreamer.to_expression()
Convert the term stream into an expression. This may exceed the available memory.