Open bennn opened 3 weeks ago
Are recursive functions like loop
not allowed? I'm getting an error.
Code:
defmodule TestCounterChor do
defchor [Client, Server] do
def loop(dummy) do
if Client.continue(dummy) do
Client[L] ~> Server
Client.incr(2) ~> Server.incr_amt
Server.do_incr()
loop(0)
else
Client[R] ~> Server
Server.(running_total) ~> Client.(final_amount)
Client.(final_amount)
end
end
loop(4)
end
end
Error
** (MatchError) no match of right hand side value: 0
(chorex 0.1.0) lib/chorex.ex:477: Chorex.project/3
....
TODO implement as a singleton / genserver proxy once those are in.
Possible code for the counter example: https://doi.org/10.1016/j.jlamp.2023.100891
Does it work in Chorex?
EDIT: how to functional update the server's counter value?