4 ms·
> +/!10 I personally find the given example harder to read than the equivalent in python/matlab/javascript with lodash/probably many other languages sum(range
by duchenne 7y ago
> +/!10
I personally find the given example harder to read than the equivalent in python/matlab/javascript with lodash/probably many other languages
sum(range(10))
sum(1:10)
With "K", you have to know a few new conventions. In the second case you just have to read, and the data flow is more obvious.
- keymone 7y agoAs I understand author’s point, your example with “sum” is only valid because “sum” word has very few meanings, especially in software engineering world. Even the word “product” would introduce certain ambiguity in context of real world codebase: is it “math” product or some “domain” product? It’s even worse with most other words. So if in any given codebase you still have to know the specific meaning of every word, how is it different from having to know specific meaning of every K symbol?
- saagarjha 7y ago> “sum” word has very few meanings, especially in software engineering world Sum types, checksums, …
- qayxc 7y ago> So if in any given codebase you still have to know the specific meaning of every word, how is it different from having to know specific meaning of every K symbol? So you never encountered namespaces then? Because that's why you use namespaces. The number of symbols is limited, which is the reason why the whole "a symbol is more explicit"-argument simply doesn't hold in general. It breaks apart pretty quickly. That's why you'll find the following sentence pretty much verbatim in most maths and cs publications: "Throughout this paper, unless otherwise specified, we use the following notations," followed by half a page of definitions. Plot twist: different authors often use different notation even within the same field of research.
- keymone 7y agoI didn’t say I buy that argument, it’s just my understanding of it.
- nitely 7y agoYou still need to know that range starts at 0 and the end is not inclusive. Also, the second example is not the same as the first one, unless the second is non-inclusive.
- dang 7y agoYes, but as you multiply that difference 100x or 1000x, the advantages of the concise notation become obvious.
- loeg 7y agoThis 100 or 1000x claim is extraordinary. Do you have any factual basis for repeatedly asserting it?
- kick 7y agoContrived Debian shootout benchmarks: http://www.kparc.com/z/comp.k http://www.kparc.com/z/comp.k https://web.archive.org/web/http://shootout.alioth.debian.org/ https://web.archive.org/web/http://shootout.alioth.debian.or... Note that the relevant k program here is contained entirely on the last line of code and denoted by a comment telling you what it does: http://www.kparc.com/z/fun.k http://www.kparc.com/z/fun.k http://c2.com/cgi-bin/wiki?WardNumberInManyProgrammingLanguages http://c2.com/cgi-bin/wiki?WardNumberInManyProgrammingLangua... Most Joy people are also k people, and Joy appears to be the only one similar, although still very large. The C++ program is lost to link rot now, but by the author's own admission, was substantially larger than even the substantially large examples within that page. 1 2 29 k 23 70 498 scheme 25 111 768 otherhaskell 44 135 1096 erlang 53 125 1043 rb 67 190 1419 ocaml 74 346 1693 haskell 80 357 2586 java Keep in mind that by their own admission, everyone in the c2 thread's code was hard to read (outside of the Joy program), and many were buggy. Meanwhile, the k program is quite simple to read. These are just some basic examples, though.
- Jtsummers 7y agoYou should probably label your columns, but that seems to be wc output. The Scheme and Haskell versions are actually shorter than you imply since they include the pairings in the count (when the pairings in the code are examples). Additionally, the k version is one line longer than you suggest. The definition of a is on its own line is used in the solution. Still only 2 lines, but if you want to persuade you should probably have correct numbers.