« first day (1816 days earlier)      last day (856 days later) » 

6:21 PM
@hyper-neutrino Can you give chat.stackexchange.com/users/537199/user1130590 access?
 
@Adám done
 
New record?
@user1130590 Welcome. You should now have access. Since you're new to Stack Exchange chat, I highly recommend reading apl.wiki/APL_Orchard#Features. Feel free to introduce yourself too.
 
6:42 PM
@Adám, I feel I should know the answer to this question, but I don't. How do I merge an array of characters into a string?
⋄ '123'≡⍕⍳3 ⋄ '123'≡,⍕⍳3 ⋄ 'ABC'≡,/'A' 'B' 'C'
 
@AlexB
0
0
0
 
reduction will always reduce the rank, so your vector (of vectors) becomes enclosed to a scalar, ⊃,/ will do the trick.
However, in many cases, you can just use
@AlexB What are you trying to say/ask with the first two expressions?
 
⋄ '123'≡⊃⍕⍳3 ⋄ '123'≡⊃,⍕⍳3 ⋄ 'ABC'≡⊃,/'A' 'B' 'C'
 
@AlexB
0
0
1
 
⋄ '123'≡∊⍕⍳3 ⋄ '123'≡∊,⍕⍳3 ⋄ 'ABC'≡∊,/'A' 'B' 'C'
 
6:44 PM
⍕⍳3 will create a single character vector (with spaces). You'll want ∊⍕¨
 
@Adám I want to get a numeric string '123'
 
There's no such thing as "a numeric string".
You want the number 123?
 
@Adám You're right. I want a string that "looks like" a number.
@Adám This works. Thanks!
I didn't realize that ⍕ inserts spaces.
 
it gives a simple char array that looks like its arg
 
I should have known...
⋄ ≢⍕⍳3
 
6:47 PM
@AlexB 5
 
:)
 
if all your elements are digits 0-9 there's a faster way
 
Coming from other languages, I find this behavior a bit quirky. In most languages, merging chars does not result in any format.
@Adám this sounds like Python's repr()
@Adám which is...?
 
@AlexB JavaScript: "1,2,3"===[1,2,3].toString()
 
@Adám ha ha... JS is not a language... it's marginally better than PHP... absolutely horrifying...
 
6:50 PM
@AlexB No, just gives an "image" back, not an expression.
 
(at most JS and PHP are slangs — pidgin latin)
 
@AlexB Assuming ⎕IO←0: ⎕D[array]
 
@Adám ah, cool
 
@user1027871 Hi bienjensu. If you want to participate here, please email access@apl.chat
 
@AlexB but most langs provide some generic toString for arbitrary objects that can generate whatever they want. APLs is that, always returning a string that Somehow™ represents the argument. It's what you get as a printout from ⎕← or whatever
 
6:53 PM
@dzaima OK, so like Python's repr(). String equivalent of data struct.
 
Hey, say I have two arrays as described in this paste here sciops.net/paste/1642272589.3f6fe672. How would I return 'board' with the zeros replaced with corresponding elements from 'check'?
 
@AlexB it's more like str() really
 
@Adám thank you, I applied for access a while ago but never posted in the end.
 
@dzaima I guess you're right. repr() ought to return something that looks like the constructor.
(anyway, back to APL... ehm...)
 
APL's repr is ⎕SE.Dyalog.Utils.repObj
@user1027871 (check/⍨⍥,zeros←0=board)@{zeros}board works
 
7:05 PM
I had check[idx]@(idx←⍸0=board)⊢board
 
yeah
I was trying to avoid the ⍸ for efficiency but / is probably not efficient either
 
If you want in-place updating of board you can do board[idx]←check[idx←⍸0=board]
 
check⊣@(0∘=)¨board is short (but probably slow)
 
Ouch.
 
would be nice if you didn't need the ¨ there
but then I suppose that breaks the case where you know what elements you want :/
 
7:08 PM
check{⍺⊣⍣(0=⍵)⊢⍵}¨board too.
Most elegant? board(,¨⊃¨⍨0=⊣)check
 
nah :P it's nice but ⊣@(0∘=)¨ is nicer if not going for speed
 
(⊢⌿⊢⊖⍨0=⊢⌿)↑check board is cute too.
 
yeah, that's nice
 
Speed doesn't really matter here, because board is already a bad array for speed.
 
thank you for the help
 
7:24 PM
Well, I hope we didn't confuse you with too much information!
 
I'm spending some time comprehending the terser solutions, haha
 
Let us know if you want any explained.
 

« first day (1816 days earlier)      last day (856 days later) »