2

I have a nested array with the following data:

┌→────────────────┐
│ ┌→────┐ ┌→────┐ │
│ │ABC12│ │DEF34│ │
│ └─────┘ └─────┘ │
└∊────────────────┘

I would like to remove the numbers from each, so that it looks like this:

┌→────────────┐
│ ┌→──┐ ┌→──┐ │
│ │ABC│ │DEF│ │
│ └───┘ └───┘ │
└∊────────────┘

I tried using the without function (~) with the each operator (¨) and a right argument of '0123456789' but I get a length error. I also tried putting each number in its own array like this:

┌→────────────────────────────────────────┐
│ ┌→┐ ┌→┐ ┌→┐ ┌→┐ ┌→┐ ┌→┐ ┌→┐ ┌→┐ ┌→┐ ┌→┐ │
│ │0│ │1│ │2│ │3│ │4│ │5│ │6│ │7│ │8│ │9│ │
│ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ │
└∊────────────────────────────────────────┘

but this too resulted in a length error. Any help would be appreciated.

4

2 回答 2

4
于 2020-08-21T05:52:55.287 回答
3

假设 Dyalog APL,您可以尝试从字符串中删除数字()的直接函数⎕D,应用于数组中的每个字符串,例如

      yourData
┌→────────────────┐
│ ┌→────┐ ┌→────┐ │
│ │ABC12│ │DEF34│ │
│ └─────┘ └─────┘ │
└∊────────────────┘
      {⍵~⎕D}¨yourData
┌→────────────┐
│ ┌→──┐ ┌→──┐ │
│ │ABC│ │DEF│ │
│ └───┘ └───┘ │
└∊────────────┘
于 2020-08-21T04:11:19.033 回答