apl

How to use rank operator instead of each in APL

陌路散爱 提交于 2019-12-22 10:43:46
问题 I have dummytxt←'abcdefghijk' texttoadd←'down' rfikv←20 30 50 and need following output defghijk20down defghijk30down defghijk50down I can do it with: scenv←(¯10↑¨(⊂dummytxt),¨⍕¨rfikv),¨⊂texttoadd but please help me to write without each operator but using rank ⍤ I use Dyalog APL, but please do not use trains. Thank you 回答1: Expressions using Each , like f¨x , can be expressed in terms of Rank as {⊂f⊃⍵}⍤0⊢x (note that ⊢ is to separate the array right operand, 0 from the array right argument x

Error Handling in APL

 ̄綄美尐妖づ 提交于 2019-12-12 12:22:59
问题 I am currently working on an APL program for a class and have run into an issue with error handling. In a function I made, I want to check to see that the input is an integer. If it is not, I want to return an error message and not run the rest of the function. So far, I compare to see if it's equal to the floor of itself. If not, I don't want the function to run and want it to stop. It works if I put 4.2 and gives an error message, but doesn't work if I put something like 'A' in or 'ABCDEF'

Interesting bug in APL2 on IBM Mainframe regarding ⊥

流过昼夜 提交于 2019-12-11 07:13:14
问题 In this environment we measure efficiency in number of consumed Service Units. I'll convert the current dateTime to milliseconds to illustrate the bug: 0 100 100 100 100 100 1000⊥⎕TS ⍝ this statement consumes around 150 SUs 0 100 100 100 100 100 1000.0⊥⎕TS ⍝ this statement consumes around 5 SUs What's going on here? Well, by attaching .0 to any of the terms in the left argument, we're telling the interpreter to go into float mode. Without it, it first tries to handle the operation with

Problems when trying to use arrays in APL. What have I missed?

爷,独闯天下 提交于 2019-12-10 18:58:25
问题 I obviously have missed some things about how to extract elements from arrays in APL and hope that someone can see what I have missed and how I should do to get the expected results in a way that I can reproduce in a meaningful way. I am relatively new in learning APL and I am more used to languages like Python and C. The data types and array manipulating tools in APL seem to confuse me, a little. Consider the following code and please tell why the expected (by me) result, ┌→─────┐ │42 666│ └

How to build own Each operator using Rank operator in Dyalog APL

送分小仙女□ 提交于 2019-12-07 17:16:51
问题 I saw answer in this question How to use rank operator instead of each in APL how to build own Each operator using Rank ⍤ . Monadic Each f¨x can be represented as {⊂f⊃⍵}⍤0⊢x Dyadic Each x f¨y can be represented as x{⊂(⊃⍺)f(⊃⍵)}⍤0⊢y In terms of this please answer following questions: Why Each ¨ operator can be represented as Each←{⍺←⊢ ⋄ ⍺ ⍺⍺{×⎕NC'⍺':⊂(⊃⍺)⍺⍺(⊃⍵) ⋄ ⊂⍺⍺⊃⍵}⍤0⊢⍵} What means ⍺⍺ in the expression above Thank you in advance for your answers. 回答1: This definition basically combines the

Conditional function in APL

戏子无情 提交于 2019-12-07 00:45:07
问题 Is there a symbol or well-known idiom for the conditional function, in any of the APL dialects? I'm sure I'm missing something, because it's such a basic language element. In other languages it's called conditional operator , but I will avoid that term here, because an APL operator is something else entirely. For example C and friends have x ? T : F LISPs have (if x T F) Python has T if x else F and so on. I know modern APLs have :If and friends, but they are imperative statements to control

How to use rank operator instead of each in APL

梦想的初衷 提交于 2019-12-05 20:19:54
I have dummytxt←'abcdefghijk' texttoadd←'down' rfikv←20 30 50 and need following output defghijk20down defghijk30down defghijk50down I can do it with: scenv←(¯10↑¨(⊂dummytxt),¨⍕¨rfikv),¨⊂texttoadd but please help me to write without each operator but using rank ⍤ I use Dyalog APL, but please do not use trains. Thank you Expressions using Each , like f¨x , can be expressed in terms of Rank as {⊂f⊃⍵}⍤0⊢x (note that ⊢ is to separate the array right operand, 0 from the array right argument x ). In other words, on the scalars of the argument we: disclose the scalar: ⊃⍵ apply the function: f⊃⍵

How to build own Each operator using Rank operator in Dyalog APL

喜欢而已 提交于 2019-12-05 19:20:21
I saw answer in this question How to use rank operator instead of each in APL how to build own Each operator using Rank ⍤ . Monadic Each f¨x can be represented as {⊂f⊃⍵}⍤0⊢x Dyadic Each x f¨y can be represented as x{⊂(⊃⍺)f(⊃⍵)}⍤0⊢y In terms of this please answer following questions: Why Each ¨ operator can be represented as Each←{⍺←⊢ ⋄ ⍺ ⍺⍺{×⎕NC'⍺':⊂(⊃⍺)⍺⍺(⊃⍵) ⋄ ⊂⍺⍺⊃⍵}⍤0⊢⍵} What means ⍺⍺ in the expression above Thank you in advance for your answers. This definition basically combines the monadic and dyadic cases which you listed above. ×⎕NC'⍺' will return 1 if ⍺ exists and 0 otherwise, so it

Conditional function in APL

余生颓废 提交于 2019-12-05 05:09:40
Is there a symbol or well-known idiom for the conditional function, in any of the APL dialects? I'm sure I'm missing something, because it's such a basic language element. In other languages it's called conditional operator , but I will avoid that term here, because an APL operator is something else entirely. For example C and friends have x ? T : F LISPs have (if x T F) Python has T if x else F and so on. I know modern APLs have :If and friends, but they are imperative statements to control program flow: they don't return a value, cannot be used inside an expression and certainly cannot be

Is there any open source implementation of APL? [closed]

◇◆丶佛笑我妖孽 提交于 2019-12-03 16:17:13
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . I am aware of J & K; but neither are open source. I'm also aware of A+, but that seems outdated. Is there any decent open source