defmodule Scopes.CSys do alias Scopes.Core.Actor def neuron(scope) do Actor.create(fn msg -> process(msg, scope) end) end def synapse(rcvr, op) do fn msg -> Actor.send(rcvr, op.(msg)) end end def process(msg, scope) do proc(scope).(msg, scope) end # helper functions def proc(scope), do: hd(code(scope)) def state(scope), do: elem(scope, 0) def code(scope), do: elem(scope, 1) def syns(scope), do: elem(scope, 2) def env(scope), do: elem(scope, 3) end