﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>masklinn commented on Challenge: What does this code do?</title><description>@Oliver
  
Your first correction is wrong, the other two are right
</description><link>http://ayende.com/4439/challenge-what-does-this-code-do#comment17</link><guid>http://ayende.com/4439/challenge-what-does-this-code-do#comment17</guid><pubDate>Sat, 20 Mar 2010 16:02:33 GMT</pubDate></item><item><title>Alexey Romanov commented on Challenge: What does this code do?</title><description>Using lists:nth in this way is a bad idea. Quadratic behaviour ahoy!
  
  
Possible fixes: 
  
1) switch to using arrays or one of the dictionary libraries
  
2) change your state to keep two lists: the processes you haven't used this round yet, and the ones you have. When the first list runs out, reverse the second and use it again.
  
  
Additionally, it's now trivial to add more processes, if desired.
</description><link>http://ayende.com/4439/challenge-what-does-this-code-do#comment16</link><guid>http://ayende.com/4439/challenge-what-does-this-code-do#comment16</guid><pubDate>Sat, 20 Mar 2010 06:03:14 GMT</pubDate></item><item><title>Ayende Rahien commented on Challenge: What does this code do?</title><description>It was a sample code that I had written in that course.
</description><link>http://ayende.com/4439/challenge-what-does-this-code-do#comment15</link><guid>http://ayende.com/4439/challenge-what-does-this-code-do#comment15</guid><pubDate>Fri, 19 Mar 2010 18:21:32 GMT</pubDate></item><item><title>Robert M. commented on Challenge: What does this code do?</title><description>@Ayende: Is it something that you've built or did you find the code in some other app?
  
  
If you built it, for what project do you use it? I am thinking about Erlang course that we've participated one week ago :-)
</description><link>http://ayende.com/4439/challenge-what-does-this-code-do#comment14</link><guid>http://ayende.com/4439/challenge-what-does-this-code-do#comment14</guid><pubDate>Fri, 19 Mar 2010 15:59:38 GMT</pubDate></item><item><title>cadet354 commented on Challenge: What does this code do?</title><description>Yes, lightweight erlang threads, not OS threads.
</description><link>http://ayende.com/4439/challenge-what-does-this-code-do#comment13</link><guid>http://ayende.com/4439/challenge-what-does-this-code-do#comment13</guid><pubDate>Fri, 19 Mar 2010 14:25:43 GMT</pubDate></item><item><title>Ayende Rahien commented on Challenge: What does this code do?</title><description>Cadet354,
  
I'll quibble with threads vs. processes, but you are correct.
</description><link>http://ayende.com/4439/challenge-what-does-this-code-do#comment12</link><guid>http://ayende.com/4439/challenge-what-does-this-code-do#comment12</guid><pubDate>Fri, 19 Mar 2010 14:23:22 GMT</pubDate></item><item><title>cadet354 commented on Challenge: What does this code do?</title><description>init runs Num threads.
  
handle_call (Msg, From, State) handled asynchronously (gen_server: cast) request.
  
(Processes, (CurrentIndex +1) rem Num, Num) selects the next thread that will work.
  
P.S. I apologize for my bad English
</description><link>http://ayende.com/4439/challenge-what-does-this-code-do#comment11</link><guid>http://ayende.com/4439/challenge-what-does-this-code-do#comment11</guid><pubDate>Fri, 19 Mar 2010 14:20:06 GMT</pubDate></item><item><title>Ayende Rahien commented on Challenge: What does this code do?</title><description>Cadet354,
  
Great! You got it!
  
Now, how does it work? :-)
</description><link>http://ayende.com/4439/challenge-what-does-this-code-do#comment10</link><guid>http://ayende.com/4439/challenge-what-does-this-code-do#comment10</guid><pubDate>Fri, 19 Mar 2010 13:52:59 GMT</pubDate></item><item><title>cadet354 commented on Challenge: What does this code do?</title><description>load balancer in erlang code.
</description><link>http://ayende.com/4439/challenge-what-does-this-code-do#comment9</link><guid>http://ayende.com/4439/challenge-what-does-this-code-do#comment9</guid><pubDate>Fri, 19 Mar 2010 13:35:14 GMT</pubDate></item><item><title>Mike commented on Challenge: What does this code do?</title><description>Nice to see Myspace implementation: 
  
[http://code.google.com/p/qizmt/](http://code.google.com/p/qizmt/)</description><link>http://ayende.com/4439/challenge-what-does-this-code-do#comment8</link><guid>http://ayende.com/4439/challenge-what-does-this-code-do#comment8</guid><pubDate>Fri, 19 Mar 2010 13:12:06 GMT</pubDate></item><item><title>Rafal commented on Challenge: What does this code do?</title><description>Wow, so that's THE map/reduce... I'm totally disappointed, after having heard so much about it i expected it to have at least 200 lines of code.
</description><link>http://ayende.com/4439/challenge-what-does-this-code-do#comment7</link><guid>http://ayende.com/4439/challenge-what-does-this-code-do#comment7</guid><pubDate>Fri, 19 Mar 2010 12:22:15 GMT</pubDate></item><item><title>Ivica Munitic commented on Challenge: What does this code do?</title><description>It is a map/reduce algorithm written using the gen_server behavior from the OTP erlang library.
</description><link>http://ayende.com/4439/challenge-what-does-this-code-do#comment6</link><guid>http://ayende.com/4439/challenge-what-does-this-code-do#comment6</guid><pubDate>Fri, 19 Mar 2010 12:15:57 GMT</pubDate></item><item><title>Damien commented on Challenge: What does this code do?</title><description>its lambda expressions in F# I think but am not sure
</description><link>http://ayende.com/4439/challenge-what-does-this-code-do#comment5</link><guid>http://ayende.com/4439/challenge-what-does-this-code-do#comment5</guid><pubDate>Fri, 19 Mar 2010 12:09:06 GMT</pubDate></item><item><title>Oliver commented on Challenge: What does this code do?</title><description>Don't know Erlang either, but I think I spot some syntax errors/typos:
  
  
{stop, normal, State ); --&gt; {stop, normal, State }.
  
  
an in handle_call() I guess there's a } missing at the end before the dot, as well as a (maybe optional?) comma in terminate() after ... = State.
  
  
I might be wrong though.
</description><link>http://ayende.com/4439/challenge-what-does-this-code-do#comment4</link><guid>http://ayende.com/4439/challenge-what-does-this-code-do#comment4</guid><pubDate>Fri, 19 Mar 2010 11:09:09 GMT</pubDate></item><item><title>Andreas Schlapsi commented on Challenge: What does this code do?</title><description>This is Erlang code. I'm not fluent in Erlang, but I think it starts some Erlang processes and delegates handling of messages to one of those services. Every time this process receives a message it delegates the message to the next "child process".
</description><link>http://ayende.com/4439/challenge-what-does-this-code-do#comment3</link><guid>http://ayende.com/4439/challenge-what-does-this-code-do#comment3</guid><pubDate>Fri, 19 Mar 2010 10:29:29 GMT</pubDate></item><item><title>Ben in Japan commented on Challenge: What does this code do?</title><description>Google tells me that it's Erlang.I can't understand it for the life of me, but It looks like a small server process, maybe doing unnatural acts on processes.
</description><link>http://ayende.com/4439/challenge-what-does-this-code-do#comment2</link><guid>http://ayende.com/4439/challenge-what-does-this-code-do#comment2</guid><pubDate>Fri, 19 Mar 2010 10:19:47 GMT</pubDate></item><item><title>Iain commented on Challenge: What does this code do?</title><description>It looks like a functional language, maybe f# or Clojure returning a list messages
</description><link>http://ayende.com/4439/challenge-what-does-this-code-do#comment1</link><guid>http://ayende.com/4439/challenge-what-does-this-code-do#comment1</guid><pubDate>Fri, 19 Mar 2010 10:18:44 GMT</pubDate></item></channel></rss>