Fixed assertions and comments

This commit is contained in:
Ignacy Moryc 2012-09-23 14:01:28 +02:00
parent ffdd7cc600
commit 00385eee11
3 changed files with 10 additions and 11 deletions

View file

@ -1,7 +1,6 @@
Concepts / Language Features Concepts / Language Features
===== =====
new record syntax new record syntax
Agents
Vars Vars
state identity lifetime state identity lifetime
Metadata Metadata

View file

@ -208,4 +208,4 @@
10 10
10 10
12 12
IllegalStateException]}]] 12]}]]

View file

@ -9,23 +9,23 @@
"To get agent's value you dereference it" "To get agent's value you dereference it"
(= __ @agent-example) (= __ @agent-example)
"To set a new value, you use send or send-all functions, but you can't just send anything.." "To change agent's value you use send function - you pass action and action's arguments to it.
(= __ (do Send function, returns immediately, but the action is prccessed in a separate thread and it's the result,
(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,
of that action that gets assigned to agent's state" of that action that gets assigned to agent's state"
(= __ (do (= __ (do
(send agent-example + 2) (send agent-example + 2)
@agent-example)) @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" "You can create validations for states that agent is allowed to take"
(= __ (do (= __ (do
(set-validator! agent-example #(even? %)) (set-validator! agent-example #(even? %))
(try (try
(send agent-example + 1) (send agent-example + 1)
(catch IllegalStateException e)) (catch IllegalStateException e))
(agent-error agent-example)))) @agent-example)))