<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Feb 26, 2009, at 10:48 AM, Zvi wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>I want to concentrate on my problem domain and think in single paradigm.<br>Instead erlang forces you to think in MFAs, funs, messages and gen_server<br>primitives.</div></blockquote><div><br></div><div>If you want to have only one way of doing anything, perhaps you should try Python.  I hear that's one of their design principles.</div><div><br></div><div><br></div><blockquote type="cite"><div>Regaring simple things in other languages - hard in Erlang. This was<br>discussed many times and I'll not repeat it: interop, strings, collections,<br>defining functions from shell, libraries with principle of maximum surprise,<br>etc. I'll just give simple example like loop:<br><br>Ruby:<br>10.times { puts "hi" }</div></blockquote><div><br></div><blockquote type="cite"><div><font class="Apple-style-span" color="#000000">...</font></div></blockquote><br><blockquote type="cite"><div>or use LC, which is a little shorter, but build 2 unnecessary lists in<br>memory:<br><br>[ io:format("hi~n") || _<-lists:seq(1,10) ].</div></blockquote><div><br></div><div>You can also use lists:foreach, which will only require the one additional list, but really, as someone else pointed out, this is horribly contrived.  How often do you really use Integer#times in Ruby, compared to other looping / iteration constructs?  At $WORK I just checked our codebase:</div><div><br></div><div>each: 1234</div><div>map/collect: 35</div><div>times: 24</div><div>select: 19</div><div>reject: 18</div><div>inject: 9</div><div><br></div><div><div>Almost ever instance of times() is for the same basic purpose: generating a random sequence of length N.  There's probably also a lot of uses of each() which should be one of the others, but I work mostly with folks with an imperative, not functional mindset.</div><div><br></div><div>Anyway, the point is, if times() is something you do a lot, just write it and get on with your life.  If it matters to you a lot, make an argument for why it's generally important and submit a patch to the standard libraries.</div><div><br></div><div><br></div><div>-kevin</div></div></div></body></html>