Compare commits

..

No commits in common. "2f5af1152748e72cf7149f25419028f9ec240b78" and "9db10edd5cc9853b296257cdb15382f9524d6ed0" have entirely different histories.

8 changed files with 30 additions and 64 deletions

Binary file not shown.

View File

@ -6489,7 +6489,7 @@ var __emscripten_stack_alloc = (a0) => (__emscripten_stack_alloc = wasmExports['
var _emscripten_stack_get_current = () => (_emscripten_stack_get_current = wasmExports['emscripten_stack_get_current'])();
var ___cxa_is_pointer_type = createExportWrapper('__cxa_is_pointer_type', 1);
var dynCall_jiji = Module['dynCall_jiji'] = createExportWrapper('dynCall_jiji', 5);
var ___emscripten_embedded_file_data = Module['___emscripten_embedded_file_data'] = 1781252;
var ___emscripten_embedded_file_data = Module['___emscripten_embedded_file_data'] = 1781548;
function invoke_i(index) {
var sp = stackSave();
try {

Binary file not shown.

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@ludus/ludus-js-pure",
"version": "0.1.10",
"version": "0.1.9",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@ludus/ludus-js-pure",
"version": "0.1.10",
"version": "0.1.9",
"license": "GPL-3.0",
"devDependencies": {
"shadow-cljs": "^2.26.0",

View File

@ -1,6 +1,6 @@
{
"name": "@ludus/ludus-js-pure",
"version": "0.1.10",
"version": "0.1.9",
"description": "A Ludus interpreter in a pure JS function.",
"type": "module",
"main": "build/ludus.mjs",

View File

@ -1250,15 +1250,6 @@ fn turtle_state {
() -> do turtle_states > unbox > last
}
fn load_turtle_state! {
"Sets the turtle state to a previously saved state. Returns the state."
(state) -> {
update! (turtle_states, append (_, state))
let call = state/call ()
if call then { add_call! (call); :ok } else :ok
}
}
& position () -> (x, y)
fn position {
"Returns the turtle's current position."
@ -1357,7 +1348,6 @@ pkg Prelude {
last
left!
list
load_turtle_state!
lt!
lt?
lte?

View File

@ -53,8 +53,6 @@
(set stringify stringify*)
(var show nil)
(defn- show-pkg [x]
(def tab (struct/to-table x))
(set (tab :^name) nil)
@ -62,50 +60,41 @@
(string "pkg " (x :^name) " {" (stringify tab) "}")
)
(defn- dict-show [dict]
(string/join
(map
(fn [[k v]] (string (show k) " " (show v)))
(pairs dict))
", "))
(defn- show* [x]
(defn show [x]
(case (ludus/type x)
:nil "nil"
:string (string "\"" x "\"")
:tuple (string "(" (string/join (map show x) ", ") ")")
:list (string "[" (string/join (map show x) ", ") "]")
:dict (string "#{" (dict-show x) "}")
:set (string "${" (string/join (map show (keys x)) ", ") "}")
:tuple (string "(" (string/join (map show x)) ")")
:list (string "[" (string/join (map show x)) "]")
:dict (string "#{" (string/join (map show x)) "}")
:set (string "${" (string/join (map show (keys x))) "}")
:box (string "box " (x :name) " [ " (show x) " ]")
:pkg (show-pkg x)
(stringify x)))
(set show show*)
(var json nil)
# (var json nil)
(defn- dict-json [dict]
(string/join
(map
(fn [[k v]] (string (json k) ": " (json v)))
(pairs dict))
", "))
# (defn- dict-json [dict]
# (string/join
# (map
# (fn [[k v]] (string (json k) ": " (json v)))
# (pairs dict))
# ", "))
(defn- json* [x]
(case (ludus/type x)
:nil "\"null\""
:number (string x)
:bool (if true "\"true\"" "\"false\"")
:string (string "\"" x "\"")
:keyword (string "\"" x "\"")
:tuple (string "[" (string/join (map json x) ", ") "]")
:list (string "[" (string/join (map json x) ", ")"]")
:dict (string "{" (dict-json x) "}")
:set (string "[" (string/join (map json (keys x)) ", ") "]")
(show x)))
# (defn- json* [x]
# (case (ludus/type x)
# :nil "\"null\""
# :number (string x)
# :bool (if true "\"true\"" "\"false\"")
# :string (string "\"" x "\"")
# :keyword (string "\"" x "\"")
# :tuple (string "[" (string/join (map json x) ", ") "]")
# :list (string "[" (string/join (map json x) ", ")"]")
# :dict (string "{" (dict-json x) "}")
# :set (string "[" (string/join (map json (keys x)) ", ") "]")
# (show x)))
# (set json json*)
(set json json*)
(defn show-patt [x]
(case (x :type)

View File

@ -53,17 +53,4 @@
(set (out :draw) (post :draw))
(-> out j/encode string))
# (comment
(do
(-> (ludus `
penup! ()
let s = turtle_state ()
pendown! ()
forward! (100)
rt! (0.25)
fd! (100)
load_turtle_state! (s)
pendown! ()
lt! (0.25)
fd! (50)
`)))