[Noisebridge-discuss] ML Wednesday: code up a neuron!

Ian ian at slumbrparty.com
Wed Mar 11 18:54:24 UTC 2009


i was going to write it in ruby, i guess i dont have to now :P
jabber: ian at slumbrparty.com
http://www.twitter.com/verbiee


On Tue, Mar 10, 2009 at 3:05 PM, Josh Myer <josh at joshisanerd.com> wrote:

> On Tue, Mar 10, 2009 at 02:56:41PM -0700, Mikolaj Habryn wrote:
>
> > I think most languages will look similar if written in accessible
> > style. Real Python would say:
> >
>
> That's why I wrote the ruby in the most naive form possible.  It's
> like pseudocode with a slightly different syntax.
>
> > import operator
> >
> > def dot_product(a, b):
> >   return sum(map(operator.mul, a, b))
> >
>
> I hate to yield the elegance plaque to python, but, well, it looks
> like I must.  That's just nice, clean functional code.
>
> The most functional version in ruby I could pull together:
>
> def dot_product(a, b)
>   a.zip(b).inject(0.0) { |s, x| s+x[0]*x[1] }
> end
>
> > Which just goes to show that most high-level languages look the same
> > when written in real style too ;)
> >
>
> Sadly, ruby looks less like real languages than python does here.
> Drat.  It does smell kind of like a handicapped lisp, at least?
> --
> Josh Myer   650.248.3796
>  josh at joshisanerd.com
> _______________________________________________
> Noisebridge-discuss mailing list
> Noisebridge-discuss at lists.noisebridge.net
> https://www.noisebridge.net/mailman/listinfo/noisebridge-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.noisebridge.net/pipermail/noisebridge-discuss/attachments/20090311/acb775d0/attachment-0003.html>


More information about the Noisebridge-discuss mailing list