i was going to write it in ruby, i guess i dont have to now :P<div><br clear="all">jabber: <a href="mailto:ian@slumbrparty.com">ian@slumbrparty.com</a><br><a href="http://www.twitter.com/verbiee">http://www.twitter.com/verbiee</a><br>

<br><br><div class="gmail_quote">On Tue, Mar 10, 2009 at 3:05 PM, Josh Myer <span dir="ltr"><<a href="mailto:josh@joshisanerd.com">josh@joshisanerd.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Tue, Mar 10, 2009 at 02:56:41PM -0700, Mikolaj Habryn wrote:<br>
<br>
> I think most languages will look similar if written in accessible<br>
> style. Real Python would say:<br>
><br>
<br>
</div>That's why I wrote the ruby in the most naive form possible.  It's<br>
like pseudocode with a slightly different syntax.<br>
<div class="im"><br>
> import operator<br>
><br>
> def dot_product(a, b):<br>
>   return sum(map(operator.mul, a, b))<br>
><br>
<br>
</div>I hate to yield the elegance plaque to python, but, well, it looks<br>
like I must.  That's just nice, clean functional code.<br>
<br>
The most functional version in ruby I could pull together:<br>
<div class="im"><br>
def dot_product(a, b)<br>
</div>  a.zip(b).inject(0.0) { |s, x| s+x[0]*x[1] }<br>
end<br>
<div class="im"><br>
> Which just goes to show that most high-level languages look the same<br>
> when written in real style too ;)<br>
><br>
<br>
</div>Sadly, ruby looks less like real languages than python does here.<br>
Drat.  It does smell kind of like a handicapped lisp, at least?<br>
<font color="#888888">--<br>
</font><div><div></div><div class="h5">Josh Myer   650.248.3796<br>
  <a href="mailto:josh@joshisanerd.com">josh@joshisanerd.com</a><br>
_______________________________________________<br>
Noisebridge-discuss mailing list<br>
<a href="mailto:Noisebridge-discuss@lists.noisebridge.net">Noisebridge-discuss@lists.noisebridge.net</a><br>
<a href="https://www.noisebridge.net/mailman/listinfo/noisebridge-discuss" target="_blank">https://www.noisebridge.net/mailman/listinfo/noisebridge-discuss</a><br>
</div></div></blockquote></div><br></div>