Better HN
topnewbestaskshowjobs
Log inSign up

abrudz

238 karma · joined Nov 14, 2019 (7y ago) · 93 submissions

https://apl.wiki/adam
Submissions

comment 9mo ago · link · parent

I don't think I did anything special. I just uninstalled "Notepad", and that revealed the good old Notepad.

comment 10mo ago · link · parent

Yes, it can also a fork where A is an array while B and C are function and a tacit atop where either B is a monadic operator and A its array or function operand or A is a function and C is a monadic operator with B being its array or function operand. Finally, it can be a single derived function where B and C are monadic operators while A is B's array or function operand.

comment 10mo ago · link · parent

I'll be happy to give you a live personalised intro in https://apl.chat or head over to https://challenge.dyalog.com/ for an automated guided introduction (with a chance of winning a prize).

comment 1y ago · link · parent

⍨

comment 1y ago · link · parent

https://apl.quest might be of interest.

comment 1y ago · link · parent

Also (mind the year this is from!):

— Can you teach a computer to write poetry?

— If you can teach it--yes, there's nothing easier. One of the things is that you could do, for example, you could simply give it a collection of poems or prose or whatever you have, and then provide a program which selects pieces from these, either individual words, individual phrases, individual passages, and so on, and merges them together according to some criterion, which you would then write into the program, and also with a certain element of chance. Usually, you know, you'd say, "Well, you want to pick this sometimes, that sometimes." Yes, you can write it, but you raise the question, what would be the point?

comment 1y ago · link · parent

Try it online at https://blazorcanvas20210704221924.azurewebsites.net/mcmpoc

comment 1y ago · link · parent

Think "normal" call syntax like

  foo(bar(baz(42)))
and then remove the superfluous parens

  foo bar baz 42
The expression is evaluated from right to left.

Now, let's make two of the functions into object members:

  A.foo(bar(B.baz(42)))
Remove the parens, extracting the methods from their objects, instead feeding each object as a left argument to its former member function:

  A foo bar B baz 42
This is normal APL-style call syntax; right-to-left if you want.

comment 1y ago · link · parent

See https://github.com/Isaac-Flath/anki and https://github.com/aeamaea/APL_Anki_Decks

comment 2y ago · link · parent

APL brings another couple of ternaries (besides for those mentioned with regards to J):

  x f[k] y
This one is universal among traditional APLs (though some modern APLs, including J, remove it). However, it is traditionally only used for a concept of application along an axis of APL's multidimentional arrays, and only for a strictly limited set of built-in "operators". That said, GNU APL and NARS2000 both allow it on user-defined functions (which have infix syntax, just like "operators").

  x n.f y
This is infix application of the function f from the namespace n, so n must have namespace value, but it is still a proper argument because n isn't just an identifier, but can also be an expression:

  x (expression).f y
In fact, the expression can be an entire (multidimentional!) array of namespaces:

  x (namespace1 namespace2).f y
is equivalent to

  (x[1] namespace1.f y[1])(x[2] namespace2.f y[2])
Furthermore, f can be a built-in "operator" which appears to exist in every namespace, but which also takes the current namespace into consideration. For example, x⍳y is the position of y in x and if io0 is a namespace wherein indexing is 0-based and io1 is a namespace wherein indexing is 1-based, we can write:

  'AX' 'BX' (ns0 ns1).⍳ 'X'
and get the result 1 2 because X is at position 1 in AX with 0-based indexing but at position 2 of BX with 1-based indexing. (I'm not saying you should write code like this, but you could.)

comment 2y ago · link · parent

Correct. Now try parsing `x (f1 f2 f3 f4 f5 f6) y`!

comment 2y ago · link · parent

It was about APL that Alan J. Perlis said "A language that doesn't affect the way you think about programming, is not worth knowing." (number 19 of https://cpsc.yale.edu/epigrams-programming)

comment 2y ago · link · parent

Have you looked at dfns (https://en.wikipedia.org/wiki/Direct_function)? They allow you something very similar. Compare Dijkstra's GCL:

  if a < b → c := true
   □ a ≥ b → c := false
  fi
To an APL dfn with "guards":

  c ← {
        a < b : true
        a ≥ b : false
      }
As in GCL, if none of the guards hold true, the dfn (braces) will terminate without return value, and thus the code will abort with an error.

comment 2y ago · link · parent

I wrote a program to launch and kill tight loop threads such that Windows Task Manager's performance graph would spell out text (though of course with spaces below lines in letters filled out).

comment 2y ago · link · parent

No, it appears on page 210 (logical page 220).

comment 2y ago · link · parent

It is indeed Dyalog APL (evident by certain features used, and also what Co-dfns requires). And yes, I agree, especially since this uses the ".apl" file extension of GNU APL, rather than the ".apls" that Dyalog uses for shell scripts. Oddly enough, the "⎕IO←0" appears outside the ":Namespace" which means it cannot be used by other APL code.

comment 2y ago · link · parent

Yes, https://apl.wiki/Co-dfns

comment 2y ago · link · parent

The paper's author speaks up in some episodes of the APL Campfire (https://apl.wiki/APL_Campfire):

- https://www.youtube.com/watch?v=w1VMeSzJLyE&list=PLYKQVqyrAE...

- https://www.youtube.com/watch?v=_jBQ53cRi0s&list=PLYKQVqyrAE...

- https://www.youtube.com/watch?v=a65K-0jaWc4&list=PLYKQVqyrAE...

comment 2y ago · link · parent

That's actually a historical quirk, because modern keyboards have = where old APL keyboards had × and - where old APL keyboards had +. You'd press Shift+ for - and Shift× for ÷ meaning that Shift gives the inverse function. Similarly, they Shift/ for \ (which is the inverse of / in APL).

See https://en.wikipedia.org/wiki/APL_(programming_language)#/me...

comment 2y ago · link · parent

Dyalog APL's RIDE interface doesn't even need you to find the symbol on a language bar; just hover the mouse over it, and a tooltip appears: https://i.imgur.com/XtzRGUs.png

comment 2y ago · link · parent

That's a very good point, but it requires a lot of code:

  <form id=theme>
    <label for=theme-l>light</label><input id=theme-l type=radio name=theme value=l>
    <input id=theme-d type=radio name=theme value=d checked><label for=theme-d>dark</label>
  </form>
  <style>
    input:checked{position:relative;z-index:1}
    input+input{margin-left:-1em}
  </style>
It is ugly, hard to style right, doesn't have toggle semantics, and needs strange code like theme.theme.value to get the value.

I'd much rather write:

  <select type=switch id=theme>
    <option value=l>light</option>
    <option value=d selected>dark</option>
  </select>
And it'd be an actual switch with one label on each side and I'd get the value with theme.value

comment 2y ago · link · parent

Please don't support making switches be an alternative to checkboxes, since it isn't clear what the current state means. I do like the idea of switches, but they should only be used to select one of two labelled choices but usually not yes/no, as a checkbox does well there. See e.g. https://abrudz.github.io/sans/ where I use four switches to choose between binary non-yes/no options.

Make a new element or input type that makes it easy to do switches right, with two labels.

comment 2y ago · link · parent

But to me as a relatively experienced APLer, it reads very clearly as "return if there are no non-ASCII chars in `w`" (and if there are, the indices of those chars will be stored in `i` and the code point of every char will be stored in `c`).

comment 2y ago · link · parent

J is quite stable. In a set of simple examples, everything would be backwards compatible.

comment 2y ago · link · parent

Seems a bit strange to put spaces around (some!) J primitives, but not around K primtives.

comment 2y ago · link · parent

No, it stems from North American use of ÷ for division, which is then ASCIIfied to %.

comment 2y ago · link · parent

The original array lang is APL:

    dot←+.×
but why give it a name when spelling it out is as short as the shortest reasonable name for it (and then you might need to put spaces around the name).

comment 2y ago · link · parent

That's not Eratosthene's sieve, but rather a naive O(n²) algorithm, implementing "a prime never occurs in the multiplication table".

comment 2y ago · link · parent

Try that experience at https://tryapl.org

Enter 1+2 where the cursor is below the copyright notice.

Now click or use arrow keys to navigate up and change the 2 to a 4 and hit Enter again.

comment 2y ago · link · parent

https://blog.vero.site/post/noulith seems to be familiar with both APL and J, and draw some inspiration from them…
1234