Search code examples
stringpropertiesassignapldyalog

Changing caption in Dyalog APL


I'm working in Dyalog APL version 17.0 and I'm having some trouble getting a line to execute:

SYNTAX ERROR
switch[10] ('CP.B',(⍕zloc),'.Caption')←capt
                                      ∧

capt is a character vector, and zloc is a scalar number. I know a lot of people don't use this language, but any help would be appreciated.


Solution

  • Assuming you're meaning to imitate executing CP.B_.Caption←capt for a given number replacing the underscore, this would work:

    ⍎'CP.B',(⍕zloc),'.Caption←capt'
    

    Try it online!

    You're trying to assign a vector to to an unnamed character vector, which isn't valid in APL. This code, instead, evaluates a full APL expression.

    If possible, however, storing CP's contents as an array would be much better.