PLists - immutable lists ========================== Introduction ~~~~~~~~~~~~~~~ A PList is a list that never changes, even when you add to it. To instantiate it, you should use the make_list convenience function:: >>> from pysistence import make_list >>> make_list(1,2) PList([1, 2]) As with any other list, items may be added to it:: >>> from pysistence import make_list >>> l = make_list(1,2) >>> l.cons(0) PList([0, 1, 2]) The same is true of removing items:: >>> from pysistence import make_list >>> l = make_list(1,2,3) >>> l.rest PList([2, 3]) You can remove any number of arbitrary arguments:: >>> from pysistence import make_list >>> ls = make_list(1, 2, 3) >>> ls.without(2) PList([1, 3]) You can even chain these things together:: >>> from pysistence import make_list >>> ls = make_list(1, 2, 3) >>> ls.rest.without(2).cons(4) PList([4, 3]) Reference ~~~~~~~~~~~~ .. module:: pysistence.persistent_list :synopsis: immutable lists .. autofunction:: make_list .. autoclass:: pysistence.persistent_list.PList :members: