diff options
| author | mryouse | 2023-05-25 22:52:07 +0000 |
|---|---|---|
| committer | mryouse | 2023-05-25 22:52:07 +0000 |
| commit | 785b43a7b6635e6fadb94e224a094e524c9e0ccd (patch) | |
| tree | 5c60ee3d25a747c21e480283a9dd4021457c43f3 /chunk.d | |
| parent | 3535bfefccea789169786767ac80c54241cae019 (diff) | |
length on seq
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, |
