[Noisebridge-discuss] ML Wednesday: code up a neuron!
Christoph Maier
cm.hardware.software.elsewhere at gmail.com
Wed Mar 11 04:11:03 UTC 2009
On Tue, 2009-03-10 at 15:05 -0700, Josh Myer 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?
Speaking of handicapped Lisp, what is a poor Mathematica addict supposed
to do?
The Dot[] function looks like this:
.
(as in
DuNervst = Function[{gewichte,stimuli},Tanh[gewichte.stimuli]]
)
Ok, this is a commercial program and kind of off topic here.
Mea maxima
[ http://maxima.sourceforge.net/docs/manual/en/maxima_25.html#SEC85 ]
culpa.
Hope I can make it from San Diego in time for tomorrow night!
Christoph
More information about the Noisebridge-discuss
mailing list