Usage

use LinkedLists;


This module provides a simple singly linked list.

Note

This module is expected to change in the future.

record LinkedList

Note

destroy must be called to reclaim any memory used by the list.

type eltType

The type of the data stored in every node.

var length: int

The number of nodes in the list.

proc size

Synonym for length.

iter these()

Iterate over the list, yielding each element.

Yield type: eltType
proc ref append(e: eltType)

Append e to the list.

proc push_back(e: eltType)

Synonym for append.

proc append(e: eltType, es: eltType ...?k)

Append all of the supplied arguments to the list.

proc prepend(e: eltType)

Prepend e to the list.

proc push_front(e: eltType)

Synonym for prepend.

proc concat(l: LinkedList(eltType))

Append all the elements in l to the end of the list.

proc ref remove(x: eltType)

Remove the first encountered instance of x from the list. Does nothing if x is not present in the list.

proc pop_front(): eltType

Remove the first element from the list and return it. It is an error to call this function on an empty list.

proc destroy()

Delete every node in the list.

proc makeList(x ...?k)

Initialize a new LinkedList containing all of the supplied arguments.

Arguments: x : T -- Every argument must be of type T. LinkedList(T)
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.2982395589351654, "perplexity": 9037.9804057008}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-10/segments/1581875145529.37/warc/CC-MAIN-20200221111140-20200221141140-00028.warc.gz"}