|
> i assume that in most array languages, you also create "words" or however you want to call functions, to reuse code. sure, that's a very useful feature, like elsewhere. > I wonder about a purely aesthetic issue: how does it look to interleave those symbols with user-defined words that by nature will be much, much longer, i.e. "create-log-entry" or "calculate-estimated-revenue". strictly speaking, dashes and underscores in k can't even be a part of identifier - they are core language primitives. it is very uncommon to see java-like identifiers like CalculateEstimatedRevenue, why would you want that? to your question: here's a bit of an oddity: all user-defined functions and core language operators can be called using functional notation: v:1 2 3 / some vector
v+v / usual infix notation, two operands: left and right
2 4 6
+[v;v] / same as infix, but called as it were a function.
2 4 6
add:{x+y} / a user-defined function: a lambda with a name and two operands.
add[v;v]
2 4 6
but there is an important distinction between the two. you can't use your `add` function infix, you must call it as a function, and there are good reasons for that: 2 add 2 / that's not gonna work
that said, mixing language primitives with function calls looks and reads just fine: +/add[v;v]
12
hope this helps! |
So does it end up as
Or, do you just not do that sort of stuff in these languages? I'm not very familiar with them, but I have ended up with some pretty long programs using Pandas in Python.