csys: start setting neuron addresses to be stored in env state
This commit is contained in:
parent
f8a767db50
commit
417bdf201a
3 changed files with 9 additions and 7 deletions
|
|
@ -34,9 +34,9 @@ defmodule Scopes.CSys do
|
||||||
#Enum.reduce(syns(scope), false, fn s, _acc -> s.(msg); true end)
|
#Enum.reduce(syns(scope), false, fn s, _acc -> s.(msg); true end)
|
||||||
end
|
end
|
||||||
|
|
||||||
def create(_msg, scope = {state, proc, _syns, env}) do
|
def create(msg, scope = {state, proc, _syns, env}) do
|
||||||
new = neuron({state, proc, [], env})
|
new = neuron({state, proc, [], env})
|
||||||
notify_created(new, scope)
|
notify_created(msg, new, scope)
|
||||||
new
|
new
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -68,9 +68,10 @@ defmodule Scopes.CSys do
|
||||||
|
|
||||||
# notifications
|
# notifications
|
||||||
|
|
||||||
def notify_created(new, scope) do
|
def notify_created(msg, new, scope) do
|
||||||
msg = Shape.create(~w(csys created)a, data: %{old: self(), new: new})
|
msg1 = Shape.create(~w(csys created)a,
|
||||||
notify(msg, scope)
|
data: Map.merge(Shape.data(msg), %{old: self(), new: new}))
|
||||||
|
notify(msg1, scope)
|
||||||
end
|
end
|
||||||
|
|
||||||
# scope access shortcuts
|
# scope access shortcuts
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,8 @@ defmodule Scopes.CSys.Environ do
|
||||||
def setup({state, proc}, seq \\ []) do
|
def setup({state, proc}, seq \\ []) do
|
||||||
scope = {%State{init_seq: seq}, &proc_env/2, [], self()}
|
scope = {%State{init_seq: seq}, &proc_env/2, [], self()}
|
||||||
env = CSys.neuron(scope)
|
env = CSys.neuron(scope)
|
||||||
CSys.create(Shape.create([:csys, :zero]), {state, proc, [], env})
|
CSys.create(Shape.create([:csys, :zero], data: %{addr: [:csys, :c00, {0, 0}]}),
|
||||||
|
{state, proc, [], env})
|
||||||
env
|
env
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ defmodule Scopes.CSys.Program do
|
||||||
def init_recursive_1() do [
|
def init_recursive_1() do [
|
||||||
fn _env, %Environ.State{neurons: [zero]} ->
|
fn _env, %Environ.State{neurons: [zero]} ->
|
||||||
CSys.send_message(zero, ~w(csys connect)a, %{target: zero, op: negate()})
|
CSys.send_message(zero, ~w(csys connect)a, %{target: zero, op: negate()})
|
||||||
CSys.send_message(zero, ~w(csys create succ)a, %{name: ~w(csys e01 001)a})
|
CSys.send_message(zero, ~w(csys create succ)a, %{addr: [:csys, :e01, {1, 1}]})
|
||||||
end
|
end
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue