fix prelude bindings

This commit is contained in:
Scott Richmond 2025-07-07 08:42:09 -04:00
parent 26f6ecf020
commit 43f466a74e
2 changed files with 11 additions and 11 deletions

View File

@ -1137,7 +1137,7 @@ fn heed {
fn send_sync {
"Sends the message to the specified process, and waits for a response in the form of a `(:reply, response)` tuple."
(pid, msg) -> {
send (pid, msg)
send! (pid, msg)
receive {
(:reply, res) -> res
}
@ -1157,7 +1157,7 @@ fn request_fetch! {
request_fetch! (pid)
}
else {
send (pid, (:reply, unbox (fetch_inbox)))
send! (pid, (:reply, unbox (fetch_inbox)))
store! (fetch_inbox, ())
}
}
@ -1167,7 +1167,7 @@ fn fetch {
"Requests the contents of the URL passed in. Returns a result tuple of (:ok, <contents>) or (:err, <status code>)."
(url) -> {
let pid = self ()
spawn! (fn () -> request_fetch! (pid, url))
spawn (fn () -> request_fetch! (pid, url))
receive {
(:reply, (_, response)) -> response
}
@ -1182,7 +1182,7 @@ fn input_reader! {
input_reader! (pid)
}
else {
send (pid, (:reply, unbox (input)))
send! (pid, (:reply, unbox (input)))
store! (input, nil)
}
}
@ -1192,7 +1192,7 @@ fn read_input {
"Waits until there is input in the input buffer, and returns it once there is."
() -> {
let pid = self ()
spawn! (fn () -> input_reader! (pid))
spawn (fn () -> input_reader! (pid))
receive {
(:reply, response) -> response
}
@ -1390,10 +1390,10 @@ fn turtle_listener () -> {
add_command! (self (), (:loadstate, position, heading, visible?, pendown?, penwidth, pencolor))
}
(:pencolor, pid) -> send (pid, (:reply, do turtle_states > unbox > self () > :pencolor))
(:position, pid) -> send (pid, (:reply, do turtle_states > unbox > self () > :position))
(:penwidth, pid) -> send (pid, (:reply, do turtle_states > unbox > self () > :penwidth))
(:heading, pid) -> send (pid, (:reply, do turtle_states > unbox > self () > :heading))
(:pencolor, pid) -> send! (pid, (:reply, do turtle_states > unbox > self () > :pencolor))
(:position, pid) -> send! (pid, (:reply, do turtle_states > unbox > self () > :position))
(:penwidth, pid) -> send! (pid, (:reply, do turtle_states > unbox > self () > :penwidth))
(:heading, pid) -> send! (pid, (:reply, do turtle_states > unbox > self () > :heading))
does_not_understand -> {
let pid = self ()
panic! "{pid} does not understand message: {does_not_understand}"
@ -1405,7 +1405,7 @@ fn turtle_listener () -> {
fn spawn_turtle {
"Spawns a new turtle in a new process. Methods on the turtle process mirror those of turtle graphics functions in prelude. Returns the pid of the new turtle."
() -> {
let pid = spawn! (fn () -> turtle_listener ())
let pid = spawn (fn () -> turtle_listener ())
update! (turtle_states, assoc (_, pid, turtle_init))
pid
}

BIN
pkg/rudus_bg.wasm (Stored with Git LFS)

Binary file not shown.