Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It kind of seems to me that it's actually vectored multiplication that's the odd one out that should maybe have a special syntax, maybe even one that applies to many operations and not just multiplication.

A matrix is a Thing that happens to also be a collection. A vector you want to multiply is just a collection. Really vector multiplication is just a map operation, so make some syntactic sugar to generate an operator comprehension:

    a = [1,2,3]
    b = [4,5,6]
    c = a [*] b # or something
    # becomes
    c = [x * y for (x,y) in zip(a,b)]
    # or
    c = a.__vecmul__(b)
This would make more sense to me.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: