https://github.com/openmodelica/immutablelist.jl
An implementation of an immutable list for Julia
https://github.com/openmodelica/immutablelist.jl
immutable-datastructures julia-package list
Last synced: about 1 month ago
JSON representation
An implementation of an immutable list for Julia
- Host: GitHub
- URL: https://github.com/openmodelica/immutablelist.jl
- Owner: OpenModelica
- License: other
- Created: 2019-08-18T19:20:05.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-01-11T13:09:58.000Z (about 4 years ago)
- Last Synced: 2024-06-11T17:54:58.965Z (over 1 year ago)
- Topics: immutable-datastructures, julia-package, list
- Language: Julia
- Homepage:
- Size: 37.1 KB
- Stars: 2
- Watchers: 5
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# ImmutableList
**A single linked immutable list for Julia**
This package provides a singly linked immutable list.
Along with common operations such as listHead and listRest to get the head and the tail in constant time.
## List
`List` is a single linked immutable list.
* Usage:
```julia
a = List{Int}() # Create a list of the given type.
b = list(1,2,3) # Creates a list of 3 elements
c = 1 <| b # Creates a new list C using the cons opertor <| with b as the tail.
```
* Utility functions:
```julia
""" O(length(lst1)), O(1) if either list is empty """
listAppend
""" O(n) """
listLength
""" O(n) """
listMember
""" O(index) """
listGet
""" O(1) """
listRest
""" O(1) """
listHead
""" O(index) """
listDelete
""" O(1) """
listEmpty
```
Support for calling functions defined in the Julia core is also provided.
Such as eltype and length.