From 0d8d799ad3ec4d7f99bab18540478b68b5a50cd7 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 24 Jan 2021 11:31:12 +0100 Subject: [PATCH] commit --- package.json | 2 +- src/langs/129/ctors.js | 9 +++++++-- src/langs/129/index.js | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 82f7ffd..1031414 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@hakerh400/esolangs", "description": "Collection of interpreters for esoteric programming languages", - "version": "1.3.1", + "version": "1.3.2", "author": "Thomas ", "main": "index.js", "contributors": [], diff --git a/src/langs/129/ctors.js b/src/langs/129/ctors.js index 5566107..ea70f5d 100644 --- a/src/langs/129/ctors.js +++ b/src/langs/129/ctors.js @@ -64,8 +64,13 @@ class Stack extends Base{ return this.elems.shift(); } - dup(){ - return new Stack(this.elems); + *dup(){ + const stack = new Stack(); + + for(const elem of this.elems) + stack.push(yield [[elem, 'dup']]); + + return stack.rev(); } get int(){ return this.len; } diff --git a/src/langs/129/index.js b/src/langs/129/index.js index 93d667e..3bedef0 100644 --- a/src/langs/129/index.js +++ b/src/langs/129/index.js @@ -50,7 +50,7 @@ const run = (src, input) => { halt = 1; return; } - + output.push(byte); }; @@ -84,7 +84,7 @@ const run = (src, input) => { if(DEBUG) log('Duplicate'); const s = mainStack.top(); if(!check(s)) return; - mainStack.push(s.dup()); + mainStack.push(O.rec([s, 'dup'])); } break; case '((()(()))())': {