News for hackers. Stuff that matters.
Re:APL Style: Patterns/Anti-patterns by geocar on Sunday March 04, 2018 @03:45AM (#16513828)
I love this bit:

Readability is the amount of money you're willing to bet that a change you make to the code will work the first time, without breaking anything, without testing it mechanically first.

Re:APL Style: Patterns/Anti-patterns by jknoepfler on Sunday March 04, 2018 @11:18AM (#16515215)
It's clever, but I think it misses the point of readability. For me anyway, readability isn't about one person actively developing code. It's about communicable code, working in a shared code base, and having to re-skim a 2,000 line chunk of a 2 million line code base two years after dropping it on the floor in order to update it in a timely and correct fashion.

In the same fashion, I update my design, architecture, and implementation documents concurrently with implementing a prototype if I need to make modifications or add complexity on the fly. They aren't for me, now. They're for the junior engineers I'm going to hand the project over to who need to be able to flesh out parts of a much larger machine.

Finally, whether or not I can read or understand my code, which I generally can, I test it anyway. I test my code not because it is unreadable (it is generally very readable), but because despite my best efforts to minimize complexity, it is generally too complex to fit inside my head, and because whether or not it fits in my head I'm not the only person working on it.

Re:APL Style: Patterns/Anti-patterns by geocar on Sunday March 04, 2018 @01:39PM (#16515852)
I believe people have strong feelings about what is readable and what is not.

Most people have this subjective definition of "readable" which is basically something between "I can read it" and "people I work with/like can read it".

This definition is difficult to work with for a number of reasons, but if you are trying to convince someone there's value in reading and writing code sufficiently alien, it's at a minimum a massive barrier to progress.

Disclaimer: I can read code like this, and while I've let Aaron try to teach me Tai Chi, I don't use Dyalog or co-dfns.

Re:APL Style: Patterns/Anti-patterns by PuercoPop on Sunday March 04, 2018 @03:02PM (#16516352)
> For me anyway, readability isn't about one person actively developing code. It's about communicable code,

If the person who wrote it can't pass the 'readability' test above what are the chances that other people, who are less familiar with the code, will?

Re:APL Style: Patterns/Anti-patterns by feelin_googley on Sunday March 04, 2018 @05:57PM (#16517322)
For those who do not use Javascript in the browser, here is another source of the presentation:

https://www.youtube.com/watch?v=9xCJ3BCIudI

Lots of good commentary not in the slides.

And here is a way to download the video without Javascript. I have been meaning to try to rewrite this in k.

     #  Notes
     #  Works by brute force and has been reliable for years
     #  Was easily updated when YouTube made changes (rare)
     #  Zero dependencies except tr, sed and an https client
     #  Takes a YouTube URL on stdin  
     #  Example usage: 
     #  echo http://www.youtube.com/watch?v=9xCJ3BCIudI|ytd 22 file
     #  "ytd" is name of the script
     #  "22" is itag-no in this case large mp4 ("18" is smaller mp4) 
     #  "file" is optional filename, no extension required
     #  if no filename given video is saved as "1.mp4"
     #  UNIX-like: url-filter < file-containing-url|ytd 22 
     #  Caution when copying and pasting: line 2 needs to retain the 4 space indent
     #  N.B. Will not work with restricted videos; *this is not for downloading music or other commercial crap*; use youtube-download if thats what you are after
     #  N.B. Some videos may require a few tries, most will work on the first try; if get 403 try again
      
    #!/bin/sh 
    case $# in [123]);;*)exec echo usage: $0 itag-no \[file\];esac;a=$(exec sed 's/http:/https:/;s/m.youtube/www.youtube/;s/youtu.be./www.youtube.com\/watch?v=/;s/hooktube.com/youtube.com/;s/embed./watch?v=/;#etc.;s/?version.*//;s/;.*//'); n=0;while true;do b=$(curl $a|exec tr -cd '\12\40-\176'|exec sed 's/https%3A/\
        &/g;s/ *//;/   https%3A%2F%2F/!d;s/%3A/:/g;s/%2C/,/g;s/%2F/\//g;s/%3D/=/g; s/%3B/;/g;s/%3F/?/g;s/%26/\&/g;s/\\u0026/\&/g;s/%252C/,/g;s/%252F/\//g;s/%22/\"/g; s/%255B/[/g;s/%255D/]/g;'|exec sed '/itag='"$1"'/!d;/video.mp4/!d;/webm/d;/ytplayer/d;s/;+codecs.*//;s/&xtags.*//;/timedtext/d;s/&itag=..//2');test ${#b} = 0||break;test $n -le 9||exit;n=$((n+1));done;case $1 in 18|22)ext=mp4;esac;exec echo curl $3 -4o ${2-1}.$ext $b;
Re:APL Style: Patterns/Anti-patterns by feelin_googley on Tuesday March 06, 2018 @01:39PM (#16530896)
Corrections: 1. remove "echo" from line #2; 2. add " -v" after "curl" in line #2 so one can see occasional 403 errors.
Re:APL Style: Patterns/Anti-patterns by ognyankulev on Sunday March 04, 2018 @02:05AM (#16513620)
Two talks with these slides:

1. https://www.youtube.com/watch?v=9xCJ3BCIudI (Dyalog17: Patterns and Anti-patterns in APL: Escaping the Beginner's Plateau)

2. https://www.youtube.com/watch?v=v7Mt0GYHU9A (Design Patterns vs Anti pattern in APL by Aaron W Hsu at FnConf17)

Re:APL Style: Patterns/Anti-patterns by telotortium on Sunday March 04, 2018 @12:24AM (#16513398)
Quite an interesting presentation, but the site is pretty slow, especially with the transitions. I would click on the three dots on the first slide and export it to PDF to read it.
Re:APL Style: Patterns/Anti-patterns by galfarragem on Sunday March 04, 2018 @07:14AM (#16514435)
Noob questions:

- Did anybody try to use APL (or a derivate) in web development?

- Is the APL job market under-saturated? Or putting it in a different form: is there job opportunities for the 'average Joe'?

I hate verbose, or better, I hate to be distracted by it.

Re:APL Style: Patterns/Anti-patterns by beagle3 on Sunday March 04, 2018 @08:15AM (#16514591)
I haven’t seen an APL job posting since 1995 ; I’m sure they exist eg at Dyalog or Carlisle, but I haven’t seen any in the wild in over 20 years.

I have never seen a J job posting.

K programmers appear to be in demand, mostly around New York, Connecticut and London (and th occasional posting about a job in Singapore). Salaries are rumored to be low-to-mid six figures.

If you are willing to be much less APLish but still mostly hang around vectors, MATLAB jobs are plentiful but usually require specific experience.

Re:APL Style: Patterns/Anti-patterns by kcoyner on Sunday March 04, 2018 @10:18AM (#16514939)
I'm not sure today, but it used to be actively used in the Fixed Income Department of Morgan Stanley in the 1980-90-2000 time period.
Re:APL Style: Patterns/Anti-patterns by Athas on Sunday March 04, 2018 @08:50AM (#16514719)
SimCorp is the largest industrial user of APL I know of. They even own part of Dyalog. They mostly use APL for business logic written by domain experts (primarily people who studied finance), while infrastructure and GUIs tends to be written in C# by trained programmers.
Re:APL Style: Patterns/Anti-patterns by 35bge57dtjku on Sunday March 04, 2018 @02:06PM (#16515994)
> Did anybody try to use APL (or a derivate) in web development?

I'd love to see how it handles web dev. It doesn't look like it'd be good at those types of things.

Re:APL Style: Patterns/Anti-patterns by Volt on Sunday March 04, 2018 @02:38PM (#16516192)
Re:APL Style: Patterns/Anti-patterns by ekns on Sunday March 04, 2018 @06:08AM (#16514248)
I've never really like the word "anti-pattern". Anti-patterns are still patterns of sorts instead of pure entropy.

How about just "common mistakes" or "discouraged/deprecated/error-prone/incorrect patterns" or something?

Re:APL Style: Patterns/Anti-patterns by talideon on Sunday March 04, 2018 @07:15AM (#16514439)
That's a common usage of the prefix 'anti-', however. You see it in things like antihero (still a hero), antiparticle (still particle), &c., where it means 'opposite, contrasting with the norm'.
Re:APL Style: Patterns/Anti-patterns by paulddraper on Sunday March 04, 2018 @02:06PM (#16515992)
Or antithesis (still a thesis).

Anti just means "against". The opponent could also fit the suffix (antithesis) or not (antisocial).

Contrast with "non" or "a" or "un'.

Re:APL Style: Patterns/Anti-patterns by danidiaz on Sunday March 04, 2018 @01:01PM (#16515642)
Re:APL Style: Patterns/Anti-patterns by contravariant on Sunday March 04, 2018 @08:51PM (#16518118)
I guess it came from the tendency to call a technique that is frequently useful a 'pattern'.

Oddly enough the DRY principle seems to discourage patterns, but in the end it seems that it's a matter of moderation.

Re:APL Style: Patterns/Anti-patterns by bringtheaction on Sunday March 04, 2018 @07:58AM (#16514550)
There is a notification about cookies that has no link to dismiss it, which obscures the content on iOS.
Re:APL Style: Patterns/Anti-patterns by sciolizer on Sunday March 04, 2018 @02:26PM (#16516101)
If I wanted to gain a more intuitive appreciation of the patterns described in the presentation by learning a language, which is the best place to start: APL, J, K, or something else?
Re:APL Style: Patterns/Anti-patterns by alsoconfuzed on Sunday March 04, 2018 @02:52PM (#16516288)
The only way to truly understand an APL derivative language is to implement an interpreter for one.

It's interesting that the author of the article embraces the Write Only code philosophy. If there's an issue - just rewrite it.

Re:APL Style: Patterns/Anti-patterns by agumonkey on Sunday March 04, 2018 @11:29AM (#16515255)
does sway offer pdf export u_u ?
Re:APL Style: Patterns/Anti-patterns by dasmoth on Sunday March 04, 2018 @12:13PM (#16515426)
Mercifully, yes!

Click the “three dots” icon in the top right and it should be obvious from there.

(The “accessibility view”, accessed in the same place, is also worth a try)

Re:APL Style: Patterns/Anti-patterns by agumonkey on Sunday March 04, 2018 @12:14PM (#16515435)
Thank you very very many much

ps: this might only work for a while but here's an url

https://sway.com/s/b1pRwmzuGjqB30On/exportstoryget?fileType=...

Re:APL Style: Patterns/Anti-patterns by 35bge57dtjku on Sunday March 04, 2018 @02:07PM (#16516003)
That site's design is an anti-pattern. :|
Re:APL Style: Patterns/Anti-patterns by jochung on Sunday March 04, 2018 @04:03AM (#16513869)
In the FP community there is often griping about obtuse mathematical terminology. APL seems like an alternative answer that embraces the unsuitability of human language to capture the nuances of composability space and just presents an alien language instead.

It's not about the code, it's about transforming between different shapes of information. I suspect this requires a degree of kinesthetic thinking that most people do not have, similar to the phenomenon of aphantasia. Linear, word based thinking is not the best for everyone, and for those averse to it, there's APL.

Re:APL Style: Patterns/Anti-patterns by galfarragem on Sunday March 04, 2018 @07:32AM (#16514477)
> Linear, word based thinking is not the best for everyone, and for those averse to it, there's APL.

1000x this. My visual memory is better than my memory for sounds (words). That's why I'm compelled to APL and derivates, Haskell or even Coffeescript.. it's way easier to have a macro understanding of the code.

Re:APL Style: Patterns/Anti-patterns by seanmcdirmid on Sunday March 04, 2018 @10:41AM (#16515038)
For problems that are about transforming different shapes of information, APL makes sense. However, it isn’t so much about the programmer, but the problem domain.
Re:APL Style: Patterns/Anti-patterns by virgilp on Sunday March 04, 2018 @11:57AM (#16515357)
What problems are not about that?
Re:APL Style: Patterns/Anti-patterns by seanmcdirmid on Sunday March 04, 2018 @12:00PM (#16515374)
Plenty of programming problems are non-transformative, anything interactive for one. If you want to see attempts to make it transformative, there is pure FRP (not the fake kind, see Antony's Courtney's dissertation as a good example of how weird this looks at an extreme) and lenses. In either case, it feels like trying to shoe horn one solution to a problem into the wrong kind of abstraction. Much of the today's web work is also non-transformative.
Re:APL Style: Patterns/Anti-patterns by virgilp on Sunday March 04, 2018 @05:00PM (#16517033)
> anything interactive for one

I feel there's a misunderstanding in how you use "non-transformative" versus how I interpret it. E.g. aren't interactive charts mostly about transformations? (data => aggregation => affine transforms => render the graphics)

Re:APL Style: Patterns/Anti-patterns by seanmcdirmid on Sunday March 04, 2018 @05:37PM (#16517221)
Mostly? Maybe, maybe not. Every program has transformational elements, but they may or may not dominate. A rendering pipeline is, but if you are implementing a text editor, you might not be doing many transformations at all.
Re:APL Style: Patterns/Anti-patterns by M_Bakhtiari on Sunday March 04, 2018 @02:38PM (#16516191)
With the view of APL as a better notation for mathematics, what would happen if mathematics were taught using APL from first grade?

In first grade it would probably be identical to traditional notation, and you wouldn't need a computer because learning to evaluate by hand would be the whole point. Then as more operators are added it's a convenient way to not have to worry about operator precedence. And in higher grades where programming classes are increasingly being mandated (despite there being next to no teachers capable of teaching it) they would have already picked up enough of APL to get it for free, making it a mere typing exercise to put it into the computer for execution.

Re:APL Style: Patterns/Anti-patterns by moontear on Sunday March 04, 2018 @12:02PM (#16515382)
OT, but this is the first time I have seen someone use Sway outside of Microsoft. Is Sway popular in APL circles?