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

I understand the advantages of array-oriented programming, but why the J/APL syntax? There are plenty of column-oriented databases available. https://en.wikipedia.org/wiki/List_of_column-oriented_DBMSes

Also related is range-based programming. https://wiki.dlang.org/Component_programming_with_ranges

    return
        // Start by generating all dates for the given year
        datesInYear(year)
        // Group them by month
        .byMonth()
        // Group the months into horizontal rows
        .chunks(monthsPerRow)
        // Format each row
        .map!(r =>
                // By formatting each month
                r.formatMonths()
                 // Storing each month's formatting in a row buffer
                 .array()
                 // Horizontally pasting each respective month's lines together
                 .pasteBlocks(colSpacing)
                 .join("\n"))
        // Insert a blank line between each row
        .join("\n\n");
Much more readable than something like "(~R∊R∘.×R)/R←1↓ιR".


Is it more readable? I'm even less familiar with D than APL, and that D code only looks more readable to me right now because it's mostly comments.

Wouldn't adding 8 lines of comments help newcomers to APL, too? This seems like a rather unfair contest.

Familiarity counts for a lot. 25 years ago when my primary language was 6502 assembly, I would have said 20 pages of assembly code look more readable than either of these.

In the long run, though, in every field I've worked in, being able to turn 20 lines of code into 20 characters has turned out to be a huge benefit. Once you familiarize yourself with the vocabulary, you can operate at a higher level. Nobody fears concise names and symbols when it's in a context they understand. I think even the most APL-phobic would admit that "a←b+c" is more readable than "assign(a,sum(b,c))".


okay but in J thats:

  require 'dates general/misc/format'
  4 3$ calendar 2018
4 3$ just re$hapes it from a big as line to a 4x3 calendar. If you wanted to print it to a file you'd want to convert it to a string of course so:

  ": 4 3$calendar 2018


Everything you know how to read, and peppered with comments you know how to read is more readable than everything you don't, without such helper devices.




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

Search: