I wanted to log some information during the execution of the genetic 
algorithm I posted earlier 
here<https://groups.google.com/forum/?fromgroups#!topic/clojure/mwFTyEA0xvY>. 
So I chnaged the code and changed the function 'track-evolution' so, that 
it now accept a maximal runtime and returns a map which contains the logged 
information.
The information where stored first as states in the agents which take part 
in this algorithm as a Map, which has as key the time, when the function is 
started and as value the information how long it takes to finishes the 
function and if there was an exception in the agent.
When 'track-evolution' finishes, it retrieves the states of the agents and 
put these map into an other map with more infomrations and then returns the 
map.

When I write the following code into the REPL:
=> (prepare-evolution 3) (start-evolution) (def stat (track-evolution 5 
:second))

(:creator-log stat)
Then I get as result 
=> {"593848" {<Map of the Agent>}, "9db6ff" {<Map of the Agent>}, "d03269" 
{<Map of the Agent>}}

(<Map of the Agent> is the Map with the information I described above).

To make it easier I wrote a function which I want to execute

(defn retrieve-new-stats
  [number-of-creators time timetype]
  (prepare-evolution number-of-creators) 
    (start-evolution) 
    (track-evolution time timetype))

And when I use this function 
=>(def stat (retrieve-new-stats 3 5 :second))
I get as result for '(:creator-log stat)' this:
{"593848" {}, "9db6ff" {}, "d03269" {}}

In this case I get only empty maps. I tried also to use do in the function 
like

(defn retrieve-new-stats
  [number-of-creators time timetype]
  (do (prepare-evolution number-of-creators) 
    (start-evolution) 
    (track-evolution time timetype)))

But there I got only empty maps too.

So I wonder why I get filled maps, when I write these three function into 
the REPL directly and only empty maps, when I execute them in a function. 
What is the difference?

Has anybody an idea?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to