Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
gandercrews
searching Neon…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
6 ms
·
1.
▲
by
gandercrews
6y ago
nah its pretty straightforward w/ higher order fns. one of many possible solutions: {(1○⍺)>2○⍵} {(⍹ ⍵)/⍨⍵ ⍶ ⍹ ⍵} {⍵*2} {⍵/⍨2|⍵}⍳50 1 9 49 225 361 441 625 1089 1521 1681 2025 2209
2.
▲
by
gandercrews
6y ago
rewritten apl version w/ lambdas and commute (vs assignment & parens): {⍵/⍨⍵<50}{2*⍨⍵/⍨1=2|⍵}⍳10 1 9 25 49 About as short as I can make it, and while its longer than the pandas solution, the primitiv
3.
▲
by
gandercrews
6y ago
it indeed becomes much easier to understand after ~ a year. this thread included some discussion about making APL-family languages easier to read for novices: https://news.ycombinator.com/item?id=20728715 I'm of the op
4.
▲
by
gandercrews
6y ago
its a golfed example to show that its possible to use APL as a cli tool. I would not put any code into production that looks like this. Generally it would go into a library. APL has an initially steep learning curve, because it is so distin
5.
▲
by
gandercrews
6y ago
I admit, GNU APL gets sluggish when dealing with values with more than ~100k elements. For most ad-hoc work it is satisfactory and can let you sketch out ideas before attempting to push the performance characteristics.
6.
▲
by
gandercrews
6y ago
dyalog has a few more operators. for example @ & ⍠. It lets you use statement separators in lambdas. In gnu apl you can simulate that with '⊣'. It allows multiline lambdas. Dyalog uses ⍺⍺ & ⍵⍵ for operators vs ⍶ & ⍹. D
7.
▲
by
gandercrews
6y ago
I tend to agree with your broader points. In my personal life I often reach for APL to do ad-hoc data analysis. It has grown on me in the last year and has fundamentally changed how I perceive and write code. However, I don't think I c
8.
▲
by
gandercrews
6y ago
gnu apl is an often overlooked but extremely solid APL implementation that plays nice w/ unix. slightly verbose example but heres gnu apl as a pipe-like interface. Often this would be abstracted to a library that gets included when you