diff options
Diffstat (limited to 'chunk.d')
| -rw-r--r-- | chunk.d | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -45,6 +45,7 @@ abstract class Seq { SeqType type; abstract Value first(); abstract Seq rest(); + abstract int length(); } class List : Seq { @@ -71,6 +72,10 @@ class List : Seq { return ret; } + override int length() { + return to!int(this.inner.length); + } + override string toString() { return format("list ('%s' + %d)", printableValue(this.inner[0]), this.inner.length - 1); } @@ -108,6 +113,7 @@ enum OpCode { OP_FIRST, // No? OP_REST, + OP_LENGTH, OP_TYPE_CHECK_NUMBER, OP_TYPE_CHECK_BOOLEAN, |
