I'm trying to figure out how to "simulate" a Port using cells but I can't make it.
The main idea is to have a function or procedure that simulates {NewPort S P}
and other one that simulates {Send P X}
behavior.
Here what I got.
declare P S
proc {CellPort ?P}
P = {NewCell S}
end
proc {SendMessage P X}
P := X | @P
{Browse @P}
end
in
{CellPort P}
{Browse @P}
{SendMessage P c}
{SendMessage P b}
{SendMessage P a}
The Port should work like:
_
c|_
c|b|_
c|b|a|_
I don't know what else I am doing wrong that I can't make it print like above. Also, how would be implementing a cell using ports? Any guide?
Thanks in advance.