APL study session 10

Discussion of the 10th study group can go here. Overview

[ <<< session 9 | session 11 >>>]

This is a wiki post - feel free to edit to add links from the lesson or other useful info.


Study session resources

Study session links

Study session covers

  • Equal Sign
  • Not equal
  • Equal Underbar
  • Equal Underbar Slash
  • Key
1 Like

Jeremy, In the Dyalog editor, once inputted a quad, there is a drop-down menu for pre-defined arrays. Those arrays are mutable. Check out Namespace.

Here are some examples:

I had a personal issue come up which is why I missed this session.

Or ⎕ML is related to Migration Level!? confusing :thinking:

1 Like

It appears that it is related to the “Migration Level” .

⎕ML determines the degree of migration of the Dyalog APL language towards IBM’s APL2. Setting this variable to other than its default value of 1 changes the interpretation of certain symbols and language constructs. ⎕ML has Namespace scope.

1 Like

It is a bit more involved than that. You may want to have a look at APL Wiki’s article on quad names.

Thanks for the link. Since Dyalog does not support ⎕a, how can we evaluate lower cases?

Does APL have something like islower(), isupper() or isinstance() in Python?

Monadic ⎕C is casefold

Dyadic ⎕C is casemap; 1 ⎕C text for uppercase and ¯1 ⎕C text for lowercase.

You can then construct islower←{⍵≡¯1 ⎕C ⍵} and isupper←{⍵≡1 ⎕C ⍵}

The closest parallel to Python’s isinstance() would be something like istype←{⍵∊⍨⎕DR ⍺} where the left argument is the data and the right argument a data representation code, e.g. 11 for Boolean, 80 for 1-byte character, 163 for 2-byte integer, 326 for pointer-array, 645 for binary float, etc. See ⎕DR documentation for details.

1 Like

Here are my solutions to the Dyalog 2022 phase 1 competition problem that was discussed in the class.
The first one builds on Jeremy’s solution and solves the ordering issue by supplying the desired order (ACGT) as a prefix and then subtract 1 from the tallies to account for the added prefix. This works because the keys in the operator result are always sorted based on what the operators sees on the RHS first.

Solution 1:
Solution 2
{(+/=)⍨ ∘ ⍵ ¨ 'ACGT'}