OLD | NEW |
1 part of lisp; | 1 part of petitparser.lisp; |
2 | 2 |
3 /** | 3 /// The basic data structure of LISP. |
4 * The basic data structure of LISP. | |
5 */ | |
6 class Cons { | 4 class Cons { |
7 | 5 |
8 /** The head of the cons. */ | 6 /// The head of the cons. |
9 dynamic head; | 7 dynamic head; |
10 | 8 |
11 /** The tail of the cons. */ | 9 /// The tail of the cons. |
12 dynamic tail; | 10 dynamic tail; |
13 | 11 |
14 /** Constructs a cons. */ | 12 /// Constructs a cons. |
15 Cons(this.head, this.tail); | 13 Cons(this.head, this.tail); |
16 | 14 |
17 @override | 15 @override |
18 bool operator ==(other) { | 16 bool operator ==(other) { |
19 return other is Cons && head == other.head && tail == other.tail; | 17 return other is Cons && head == other.head && tail == other.tail; |
20 } | 18 } |
21 | 19 |
22 @override | 20 @override |
23 int get hashCode => 31 * head.hashCode + tail.hashCode; | 21 int get hashCode => 31 * head.hashCode + tail.hashCode; |
24 | 22 |
(...skipping 10 matching lines...) Expand all Loading... |
35 } | 33 } |
36 } | 34 } |
37 if (current != null) { | 35 if (current != null) { |
38 buffer.write('. '); | 36 buffer.write('. '); |
39 buffer.write(current); | 37 buffer.write(current); |
40 } | 38 } |
41 buffer.write(')'); | 39 buffer.write(')'); |
42 return buffer.toString(); | 40 return buffer.toString(); |
43 } | 41 } |
44 } | 42 } |
OLD | NEW |