Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: petitparser/lib/src/lisp/cons.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « petitparser/lib/src/json/parser.dart ('k') | petitparser/lib/src/lisp/environment.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 part of lisp;
2
3 /**
4 * The basic data structure of LISP.
5 */
6 class Cons {
7
8 /** The head of the cons. */
9 dynamic head;
10
11 /** The tail of the cons. */
12 dynamic tail;
13
14 /** Constructs a cons. */
15 Cons(this.head, this.tail);
16
17 @override
18 bool operator ==(other) {
19 return other is Cons && head == other.head && tail == other.tail;
20 }
21
22 @override
23 int get hashCode => 31 * head.hashCode + tail.hashCode;
24
25 @override
26 String toString() {
27 var buffer = new StringBuffer();
28 buffer.write('(');
29 var current = this;
30 while (current is Cons) {
31 buffer.write(current.head.toString());
32 current = current.tail;
33 if (current != null) {
34 buffer.write(' ');
35 }
36 }
37 if (current != null) {
38 buffer.write('. ');
39 buffer.write(current);
40 }
41 buffer.write(')');
42 return buffer.toString();
43 }
44 }
OLDNEW
« no previous file with comments | « petitparser/lib/src/json/parser.dart ('k') | petitparser/lib/src/lisp/environment.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698