Fixed assertions and comments
This commit is contained in:
parent
ffdd7cc600
commit
00385eee11
3 changed files with 10 additions and 11 deletions
|
|
@ -1,7 +1,6 @@
|
|||
Concepts / Language Features
|
||||
=====
|
||||
new record syntax
|
||||
Agents
|
||||
Vars
|
||||
state identity lifetime
|
||||
Metadata
|
||||
|
|
|
|||
|
|
@ -208,4 +208,4 @@
|
|||
10
|
||||
10
|
||||
12
|
||||
IllegalStateException]}]]
|
||||
12]}]]
|
||||
|
|
|
|||
|
|
@ -9,23 +9,23 @@
|
|||
"To get agent's value you dereference it"
|
||||
(= __ @agent-example)
|
||||
|
||||
"To set a new value, you use send or send-all functions, but you can't just send anything.."
|
||||
(= __ (do
|
||||
(set-error-mode! agent-example :continue)
|
||||
(send agent-example 20)
|
||||
@agent-example))
|
||||
|
||||
"Send takes a function and arguments and sends them to the agent. The send function,
|
||||
returns immediately, but the action is prccessed in a separate thread and it's the result,
|
||||
"To change agent's value you use send function - you pass action and action's arguments to it.
|
||||
Send function, returns immediately, but the action is prccessed in a separate thread and it's the result,
|
||||
of that action that gets assigned to agent's state"
|
||||
(= __ (do
|
||||
(send agent-example + 2)
|
||||
@agent-example))
|
||||
|
||||
"You can't just send a value to agent"
|
||||
(= __ (do
|
||||
(set-error-mode! agent-example :continue)
|
||||
(send agent-example 20)
|
||||
@agent-example))
|
||||
|
||||
"You can create validations for states that agent is allowed to take"
|
||||
(= __ (do
|
||||
(set-validator! agent-example #(even? %))
|
||||
(try
|
||||
(send agent-example + 1)
|
||||
(catch IllegalStateException e))
|
||||
(agent-error agent-example))))
|
||||
@agent-example)))
|
||||
|
|
|
|||
Loading…
Reference in a new issue