ang 1 4
1.325817664
parc 1 4
1 4
⎕SE.Dyalog.Utils.repObj parc 1 4
1 2⍴1 4
ang/parc 1 4
0.7853981634
⎕SE.Dyalog.Utils.repObj +/parc 2 4
,6
my ang function breaks when i do ang/parc 1 4. i did some tests and i have no idea why.
if you want the full spesific function then:
ang←12○1 0J1+.×⊢
parc←(2,⍨(≢1↓⊢))⍴1↓2/⊢
i should maybe specify the problem. ang 1 4 gives the right answer which is 1.32... but when used after parce it gives 0.785 which is wrong
> Some of the notes in this workspace contain sections that are merely the musings of the author. They may not be entirely factual and you should check the content with a reliable source (Wikipedia) before repeating them to a discerning audi- ence.
I knew that ⍞⍠⌸⌺ are ⎕ + ':=⋄, but failed to notice the same about ⌽⊖⍉
I also prepared a solution for the Quest. Really looking forward to this one :)
> APL\360 supported many overstrikes, and these were the only way to type composite glyphs. Since typewriters couldn't remove typed characters, editing could be cumbersome, and so some innovative overstrikes were allowed for the odd case where one was correcting a typographical error. For example, F and L would form E.
@Richard ⍵∩'()' removes all characters that aren't parentheses. 1,1,¨ adds some random 1s in it to make it valid syntax. ⍕ formats it to a string, then ⍎ evaluates it as APL code. If it errors, it's got mismatched parantheses as APL syntax doesn't allow that
I tried to rebuild my solution so it can check also different parentheses. Maybe the other solutions are more suitable for that? (the stencil operator was a good suggestion from somebody else, so was the @)
I like the symmetry of g, but unfortunately it is slower
f ← {1 ¯1 0['()'⍳⍵]}
g ← '('∘= - =∘')'
]runtime -c 'f t' 'g t'
f t → 2.2E¯4 | 0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
g t → 2.5E¯4 | +12% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
Kind of like the mathematicians observing the shed, two people walking out, then two people walking in, one mathematician to the other: Now the shed is empty again!
What's a good (efficient) way to generate all permutations of a string up to a certain length, with replacement? So for 'ABC' and 3, I'd want 'A B C AA AB AC AAA AAB AAC ABA ACA ... etc.
What is the best way to convert a 2D array A with columns specified in 2D cartesian coordinates into the corresponding 2D array B with columns specified in complex coordinates, so that we obtain B[;i] ≡ A[;i]+0j1×A[;i+1] where i∊¯1↓2⌷⍴A?
Alternatively we can put it like this, say you have a 2D array A, let's call its columns x1 y1 x2 y2 ... xn yn. What is the best way to construct an array with columns (x1+0j1×y1) (x2+0j1×y2) ... (xn+0j1×yn)?
@11Kilobytes so the full function would be {1 0J1+.×⍤1⊢⍵⍴⍨(≢⍵),2,⍨2÷⍨⊃⌽⍴⍵} which reshapes into 3d and then does a dot product with 1 0J1 for each of the two elements