fix prelude bindings

This commit is contained in:
Scott Richmond 2025-07-07 08:42:09 -04:00
parent 28cc6ddf1d
commit c2329519d7
2 changed files with 10 additions and 10 deletions

View File

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

Binary file not shown.