Earlier quoted context omitted.
I am going to tell you something fantastic, but first, I want to explain some things about this: us:{$[#i:&{(y~*K)&"*"~*x}':x;@[x;i;:[;,"_"]];x]} The first is that there's a typo in what bidirectional wrote. The above is correct. The second, is what it is. Once I have explained that, I can tell you the fantastic thing. k syntax is very simple. There's just a few forms you need to be aware of: f x which applies x to f…
To me, this is infinitely more readable: let mut input = ["select", "*", "from", "potato"]; for i in 1..input.len() { if ["select","*"] == input[i-1..=i] { input[i] = "_"; } } If I could be bothered to dig up a Haskell compiler, I'm sure it's possible to do a one-liner list comprehension that is both terse and readable. If I was doing this in Rust, it's easy to create an iterator extension that does something like "m…
The Array Cast – A podcast about the array programming languages
101–110 of 141 posts
Re: The Array Cast – A podcast about the array programming languages
#102Earlier quoted context omitted.
" Please don't post shallow dismissals, especially of other people's work. A good critical comment teaches us something. " Dismissing what you don't understand because it is unfamiliar is the essence of a shallow dismissal, no? And you did it twice in this thread. The first was a blessing in disguise because of geocar's excellent reply, but now you're just repeating it, with added name-calling. Please don't do that h…
It's the essence of the thing in this case, and isn't a shallow criticism. Syntax can be good or bad. I don't believe that it's just a matter of "getting used to it", there are objective metrics of readability, developer error rates, and speed of training that some languages do poorly at. My point was that most array languages look like line noise. That's flippant, but true . Ask yourself this question: Is it possibl…
If you want a "more readable" array language, take a look at Nial.
PS: qualifying the Wolfram language (Mathematica) as obscure is a really, really myopic view of the programming world.
Re: The Array Cast – A podcast about the array programming languages
#103Earlier quoted context omitted.
" Please don't post shallow dismissals, especially of other people's work. A good critical comment teaches us something. " Dismissing what you don't understand because it is unfamiliar is the essence of a shallow dismissal, no? And you did it twice in this thread. The first was a blessing in disguise because of geocar's excellent reply, but now you're just repeating it, with added name-calling. Please don't do that h…
It's the essence of the thing in this case, and isn't a shallow criticism. Syntax can be good or bad. I don't believe that it's just a matter of "getting used to it", there are objective metrics of readability, developer error rates, and speed of training that some languages do poorly at. My point was that most array languages look like line noise. That's flippant, but true . Ask yourself this question: Is it possibl…
Re: The Array Cast – A podcast about the array programming languages
#104Earlier quoted context omitted.
I am going to tell you something fantastic, but first, I want to explain some things about this: us:{$[#i:&{(y~*K)&"*"~*x}':x;@[x;i;:[;,"_"]];x]} The first is that there's a typo in what bidirectional wrote. The above is correct. The second, is what it is. Once I have explained that, I can tell you the fantastic thing. k syntax is very simple. There's just a few forms you need to be aware of: f x which applies x to f…
To me, this is infinitely more readable: let mut input = ["select", "*", "from", "potato"]; for i in 1..input.len() { if ["select","*"] == input[i-1..=i] { input[i] = "_"; } } If I could be bothered to dig up a Haskell compiler, I'm sure it's possible to do a one-liner list comprehension that is both terse and readable. If I was doing this in Rust, it's easy to create an iterator extension that does something like "m…
Yes, to you. Just like Chinese would be infinitely less readable to you, if you don't know Chinese.
Do you think this is a deep observation?
The real challenge is knowing whether it is worth it to learn k so that it becomes readable.
- How many characters is it? This is a useful metric when you realise bug/defect rate is proportional to the physical size (in rows and columns of source code) of a program given equivalent processes (Moore 1992; McConnell 1993) but that process matters more than anything else. Not tooling, not "memory safety", and certainly not "readability" by people unfamiliar with the language.
However "readable" you think your rust code is, did you notice the bug in your rust code? (hint: input is not supposed to be mutable)
- How fast is it? On my 2014 i7 macbook air, the supplied us averages 232 msec for 100k cycles. My version
us:{$[x~(z;y);,"_";y]}[(*K;,"*")]':
is faster: 126msec for 100k cycles.- How quickly was it written? I can't speak for sa/atw on us since I didn't see them write it. I wrote mine in about 30 seconds including testing. Yes really. How long did your rust program take to write? Did you think simply because you thought you understood the requirements that you didn't need to test it?
- How quickly can someone familiar with the language read it? Again, I can't speak for anyone other than myself, but I'm not a k expert -- I program in it very infrequently, and the new amend-syntax in k9 I had not run across previously. And yet I read it as quickly as I said.
These four values (less code, fast run, fast write, fast read) are the biggest most important things to me. And anyone who shows me all four of things will get my attention.
Rust? Simply does not impress.
> Unreadable array languages are popular with quants because they work in a highly competitive, cut-throat industry where "write only" languages provide job security.
That's another interesting opinion. This one might even be true amongst some quants (Most of the ones I know that use k don't particularly like k). But I suggest you try not to expect the worst in people. Yes, some people are assholes, but most people aren't. And for what it's worth, I'm not a quant (I work in Advertising).
Re: The Array Cast – A podcast about the array programming languages
#105Earlier quoted context omitted.
To me, this is infinitely more readable: let mut input = ["select", "*", "from", "potato"]; for i in 1..input.len() { if ["select","*"] == input[i-1..=i] { input[i] = "_"; } } If I could be bothered to dig up a Haskell compiler, I'm sure it's possible to do a one-liner list comprehension that is both terse and readable. If I was doing this in Rust, it's easy to create an iterator extension that does something like "m…
Because you're wrong. Do spend six months doing hobby array programming. Your view will change.
My only motivation is that I've been tempted to develop a toy programming language myself that is as high-level as Rust or C++ but explicitly designed for "wide" processing platforms such as GPUs or many-core processors with SIMD instruction sets.
All I'm saying is that the concept of array programming -- like pure functional programming -- may be valuable, but the syntax is not.
Re: The Array Cast – A podcast about the array programming languages
#106Earlier quoted context omitted.
Because you're wrong. Do spend six months doing hobby array programming. Your view will change.
It's on my bucket list. But it seems so niche that I suspect I'll never use it. My only motivation is that I've been tempted to develop a toy programming language myself that is as high-level as Rust or C++ but explicitly designed for "wide" processing platforms such as GPUs or many-core processors with SIMD instruction sets. All I'm saying is that the concept of array programming -- like pure functional programming…
You would not be the first person tempted to try and separate the two, but I think it is impossible. Every attempt to do so I have ever seen has lost too much in the translation that the four-values I have for programming are no longer conserved.
Re: The Array Cast – A podcast about the array programming languages
#107Earlier quoted context omitted.
Because you're wrong. Do spend six months doing hobby array programming. Your view will change.
It's on my bucket list. But it seems so niche that I suspect I'll never use it. My only motivation is that I've been tempted to develop a toy programming language myself that is as high-level as Rust or C++ but explicitly designed for "wide" processing platforms such as GPUs or many-core processors with SIMD instruction sets. All I'm saying is that the concept of array programming -- like pure functional programming…
Is the closest you'll get to that, I think. It took a whole team of big brains to make it, and the author stated it was highly non-trivial to make something like that.
Re: The Array Cast – A podcast about the array programming languages
#108Earlier quoted context omitted.
" Please don't post shallow dismissals, especially of other people's work. A good critical comment teaches us something. " Dismissing what you don't understand because it is unfamiliar is the essence of a shallow dismissal, no? And you did it twice in this thread. The first was a blessing in disguise because of geocar's excellent reply, but now you're just repeating it, with added name-calling. Please don't do that h…
It's the essence of the thing in this case, and isn't a shallow criticism. Syntax can be good or bad. I don't believe that it's just a matter of "getting used to it", there are objective metrics of readability, developer error rates, and speed of training that some languages do poorly at. My point was that most array languages look like line noise. That's flippant, but true . Ask yourself this question: Is it possibl…
If we had such objective metrics on APL or K, that would be an interesting discussion. But what I've seen here is just opinion and anecdote.
I also think that "looks like line noise" is a fair characterization of how J and K look on the surface, but that does not mean they are unreadable.
I'm hardly qualified to give any deep insight, but after reading the first half of Aaron Hsu's thesis and playing around with a Dyalog APL interpreter online for a few days, APL starts to look quite readable to me (much more so than J, thanks to the additional symbols) and I found it rather easy to learn (unlike mathematics, but for me the struggle there is not at all in syntax but in the concepts, methods, and meaning).
Re: The Array Cast – A podcast about the array programming languages
#109Earlier quoted context omitted.
1 2 3 + 4 5 6 7 |length error | 1 2 3 +4 5 6 7 In general - depends on the operation. Sometimes the verb checks that both operands have the same rank and dimensions, sometimes the shorter/smaller side gets applied column-wise (or cell-wise/page-wise): (2 2 $ 1 2 3 4) NB. $ means "reshape" 1 2 3 4 (2 2 $ 1 2 3 4) + 1 2 2 3 5 6 Sometimes the shorter side is repeated as much as needed to get the correct length, and some…
Gotta say, "depends on the operation" was the most unfortunate possible answer to my question, alas :-) Maybe one day we'll figure out how to make a consistent array language ;-)
Re: The Array Cast – A podcast about the array programming languages
#110Earlier quoted context omitted.
" Please don't post shallow dismissals, especially of other people's work. A good critical comment teaches us something. " Dismissing what you don't understand because it is unfamiliar is the essence of a shallow dismissal, no? And you did it twice in this thread. The first was a blessing in disguise because of geocar's excellent reply, but now you're just repeating it, with added name-calling. Please don't do that h…
It's the essence of the thing in this case, and isn't a shallow criticism. Syntax can be good or bad. I don't believe that it's just a matter of "getting used to it", there are objective metrics of readability, developer error rates, and speed of training that some languages do poorly at. My point was that most array languages look like line noise. That's flippant, but true . Ask yourself this question: Is it possibl…
Listen: I don't think you're qualified to speak to the essence of a thing that you don't understand, and I think you know that. I am telling you this is not very difficult and it is very useful, and I think you're angry at yourself for not "getting it". You are so smart you know ten programming languages, so you assume there's something wrong with "it" because to think there's something wrong with you is unthinkable.
Relax. There's nothing wrong with you either. You can learn this, but you aren't going to be able to skim it; the knowledge you have gained learning ten other languages is not going to help you very much. What is going on is stranger than you can realise at this point, so many array-people believe it is easiest if you try to forget everything you know about programming when you try to learn an array language. I don't think I agree with that, but the myth that children learn languages faster than adults is pervasive. Maybe that helps.
> Geocar wrote about two pages to explain what is a trivial piece of code, and I still have no idea what it even does or how!
Try reading it again! It is not complicated (nor optimal) but you are likely skimming or skipping important parts. If you can tell me where I lost you, I can probably help you find your way.
You might find it easier to follow along with a k reference guide. These typically fit on a note-card and can be helpful in memorising the k operators. These are all of the operators in the above program:
$[a;b;c] cond (if a then b else c)
@[a;i;f] amend i indices in a with operation f
&x where (are the 1-bits in x)
#x count (the length of x)
*x first (element of X)
x&y min/and
x~y atom-equivalent (like lisp's equalp)
f':x call f with each pair of x
A complete reference card isn't much longer and usually ships with the k interpreter. People learn in different ways, and that's ok! Help me help you learn and you will probably learn this very quickly.> Is it possible to develop an array-based language and use more "normal" syntax?
"Array-based" isn't exactly the same thing as an "array" language - I think people get too hung up on the power of vector-operators (which are indeed powerful!) and miss the fact that there are so few operators which to learn.
I don't expect you to understand exactly what I mean by that, but I hope that if you take the plunge to learn this properly, you'll remember that I said this and when it does make sense, it will be useful.
> Array based languages are the first time I've seen a high-level language that is less readable than the machine code that they are supposed to be abstracting away!
You can't read Arabic either, can you? Why do you think this is different?
Try to stop thinking in terms of "readable": You can only say something is "readable" to you, or perhaps if you are a hiring manager, "to most people". I can read it perfectly fine. Worrying about how "readable" a programming language at this point speaks only to how easy it is for you to acquire the ability to learn it, not how valuable it will be when you actually learn it.