Comment by fainpul
4 months ago
I assume this is the same as this?
# python
[127 * sin(x * tau * freq / samplerate) for x in range(samplerate)]
4 months ago
I assume this is the same as this?
# python
[127 * sin(x * tau * freq / samplerate) for x in range(samplerate)]
For that matter,
for that matter, i always wonder how people mistake python for numpy :) they have surprisingly little in common.
but enough talking about languages that suck. let's talk about python!
i'm not some braniac on a nerd patrol, i'm a simple guy and i write simple programs, so i need simple things. let's say i want an identity matrix of order x*x.
nothing simpler. i just chose one of 6 versions of python found on my system, create a venv, activate it, pip install numpy (and a terabyte of its dependencies), and that's it - i got my matrix straight away. i absolutely love it:
and now lets see just how obscure and unreadable exactly the same thing looks in k:
no wonder innocent people end up with brain aneurisms and nervous breakdowns.
That is wildly disingenuous. Assuming you've imported numpy as np, you get an nxn identity matrix by doing
http://numpy.org/doc/stable/reference/generated/numpy.identi...
1 reply →
i'm a fan of
2 replies →
Pretty much, yeah! The difference is that in Python the function that calculates a single value looks like:
...while the function that calculates a batch of values looks like:
Meanwhile in Lil (and I'd guess APL and K), the one function works in both situations.
You can get some nice speed-ups in Python by pushing iteration into a list comprehension, because it's more specialised in the byte-code than a for loop. It's a lot easier in Lil, since it often Just Works.
A few more examples in K and Lil where pervasive implicit iteration is useful, and why their conforming behavior is not equivalent to a simple .map() or a flat comprehension: http://beyondloom.com/blog/conforming.html
And in Julia it’s foo.(x).
julia is cool, hands down.
only typical k binary will be less than 200kb and doesn't need stdlib. it still needs a few syscalls, but we're working on that.
and julia has this small and insignificant dependency called llvm. i bullshit you not: