all repos — min @ 9e46828aa0112ba4841d31197d5807529dad4a7a

A small but practical concatenative programming language.

Fixed clear line; fixed map implementation.
h3rald h3rald@h3rald.com
Sun, 11 Sep 2016 12:28:06 +0200
commit

9e46828aa0112ba4841d31197d5807529dad4a7a

parent

59a02e22c2b81fe664628f6c959c2d5c0fe1bf42

3 files changed, 7 insertions(+), 3 deletions(-)

jump to
M core/linedit.nimcore/linedit.nim

@@ -211,9 +211,10 @@ ed.printChar(c.ord)

ed.printChar(32) proc clearLine*(ed: var LineEditor) = - stdout.cursorBackward(ed.line.position) + stdout.cursorBackward(ed.line.position+1) for i in ed.line.text: putchar(32) + putchar(32) stdout.cursorBackward(ed.line.text.len) ed.line.position = 0 ed.line.text = ""
M lib/min_lang.nimlib/min_lang.nim

@@ -329,11 +329,12 @@ .symbol("map") do (i: In):

var prog, list: MinValue i.reqTwoQuotations prog, list i.push newVal(newSeq[MinValue](0)) + var res = newSeq[MinValue](0) for litem in list.qVal: i.push litem i.unquote("<map-quotation>", prog) - i.apply("swap") - i.apply("append") + res.add i.pop + i.push res.newVal .symbol("times") do (i: In): var t, prog: MinValue
M minim.nimminim.nim

@@ -64,6 +64,8 @@ if word.startsWith(">"):

return symbols.mapIt(">" & $it) if word.startsWith("*"): return symbols.mapIt("*" & $it) + if word.startsWith("("): + return symbols.mapIt("(" & $it) if word.startsWith("<"): return toSeq(MINIMSYMBOLS.readFile.parseJson.pairs).mapIt(">" & $it[0]) if word.startsWith("$"):