aboutsummaryrefslogtreecommitdiff
path: root/chunk.d
diff options
context:
space:
mode:
Diffstat (limited to 'chunk.d')
-rw-r--r--chunk.d6
1 files changed, 6 insertions, 0 deletions
diff --git a/chunk.d b/chunk.d
index 70d7b1c..47d3c73 100644
--- a/chunk.d
+++ b/chunk.d
@@ -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,