Bugfixes: add cljQuot/cljRem to runtime, quot/rem to interpreter. Cleanup: remove unused processAgentActions and sequtils import. 164 tests pass.
This commit is contained in:
@@ -132,6 +132,7 @@ proc runtimeName(op: string): string =
|
||||
of "iterate": "cljIterate"
|
||||
of "interleave": "cljInterleave"
|
||||
of "quot": "cljQuot"
|
||||
of "rem": "cljRem"
|
||||
of "instance?": "cljInstanceP"
|
||||
of "meta": "cljMeta"
|
||||
of "with-meta": "cljWithMeta"
|
||||
|
||||
@@ -874,6 +874,22 @@ proc evalList(items: seq[CljVal], env: Env): EvalResult =
|
||||
return EvalResult(ok: true, value: cljInt(args[0].intVal mod args[1].intVal))
|
||||
return EvalResult(ok: false, error: "mod requires integers")
|
||||
|
||||
of "quot":
|
||||
numArgs(2)
|
||||
if args[0].kind == ckInt and args[1].kind == ckInt:
|
||||
if args[1].intVal == 0:
|
||||
return EvalResult(ok: false, error: "Division by zero")
|
||||
return EvalResult(ok: true, value: cljInt(args[0].intVal div args[1].intVal))
|
||||
return EvalResult(ok: false, error: "quot requires integers")
|
||||
|
||||
of "rem":
|
||||
numArgs(2)
|
||||
if args[0].kind == ckInt and args[1].kind == ckInt:
|
||||
if args[1].intVal == 0:
|
||||
return EvalResult(ok: false, error: "Division by zero")
|
||||
return EvalResult(ok: true, value: cljInt(args[0].intVal mod args[1].intVal))
|
||||
return EvalResult(ok: false, error: "rem requires integers")
|
||||
|
||||
of "min":
|
||||
numArgs(2)
|
||||
if args[0].kind == ckInt and args[1].kind == ckInt:
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
# AI-First REPL for Clojure/Nim
|
||||
import os, osproc, strutils, sequtils, json, times, net
|
||||
import os, osproc, strutils, json, times, net
|
||||
import reader, emitter, types, macros, eval
|
||||
|
||||
type
|
||||
|
||||
Reference in New Issue
Block a user