1+ ///|
12type EdnListView Array [Edn ] derive (Eq )
23
4+ ///|
35impl Hash for EdnListView with hash (self ) { self ._.length () }
46
7+ ///|
58impl Hash for EdnListView with hash_combine (self , hasher ) {
69 for i in self ._ {
710 i .hash_combine (hasher )
811 }
912}
1013
14+ ///|
1115fn to_string (self : EdnListView ) -> String {
1216 let mut s = ""
1317 s = s + "(list )"
@@ -21,6 +25,7 @@ fn to_string(self : EdnListView) -> String {
2125 s
2226}
2327
28+ ///|
2429fn compare (self : EdnListView , right : EdnListView ) -> Int {
2530 for i = 0 , len = self ._.length (); i < len ; i = i + 1 {
2631 if i >= right ._.length () {
@@ -37,10 +42,12 @@ fn compare(self : EdnListView, right : EdnListView) -> Int {
3742 0
3843}
3944
45+ ///|
4046fn EdnListView ::default () -> EdnListView {
4147 []
4248}
4349
50+ ///|
4451fn get (self : EdnListView , idx : UInt ) -> Edn? {
4552 if idx < self ._.length ().reinterpret_as_uint () {
4653 Some (self ._[idx .reinterpret_as_int ()])
@@ -49,6 +56,7 @@ fn get(self : EdnListView, idx : UInt) -> Edn? {
4956 }
5057}
5158
59+ ///|
5260fn get_or_nil (self : EdnListView , idx : UInt ) -> Edn {
5361 if idx < self ._.length ().reinterpret_as_uint () {
5462 self ._[idx .reinterpret_as_int ()]
@@ -57,20 +65,22 @@ fn get_or_nil(self : EdnListView, idx : UInt) -> Edn {
5765 }
5866}
5967
68+ ///|
6069fn length (self : EdnListView ) -> UInt {
6170 self ._.length ().reinterpret_as_uint ()
6271}
6372
73+ ///|
6474fn is_empty (self : EdnListView ) -> Bool {
6575 self ._.length () == 0
6676}
6777
68- /// mutablely push an element to the end of the list
78+ ///| mutablely push an element to the end of the list
6979fn push (self : EdnListView , x : Edn ) -> Unit {
7080 self ._.push (x )
7181}
7282
73- /// implement iterator for EdnListView
83+ ///| implement iterator for EdnListView
7484fn iter (self : EdnListView ) -> Iter [Edn ] {
7585 Iter ::new (
7686 fn (yielding ) {
0 commit comments