« first day (446 days earlier)      last day (2209 days later) » 

9:18 AM
For write access without 20 rep points, click lower-left giant avatar, click user profile, and email the URL to support@dyalog.com attn: Adám.
 
9:56 AM
0
Q: Interprocess Communications between Dyalog APL and q

Lurgid BeeHow would I connect a Dyalog APL Client to reach out to a q server? The protocol seems simple enough and very well documented when it comes to decoding the answer, but I can't seem to get past the very first step, the initial handshaking, either with Dyalog APL or VBA. For now, if I could get t...

 
10:33 AM
Dyalog are at the @aplgermany Spring meeting in Cologne this week. You can see more details and the full schedule here https://apl-germany.de/apl-germany-fruehjahrstagung-16-17-april-2018/
 
 
3 hours later…
1:12 PM
Don't forget to join our live webinar - Isolates and other APL Processes in the Cloud - on Thursday 19 April at 15:00 UTC where Morten will demonstrate how to launch APL processes on Amazon WebServices under program control https://dyalog.tv/Webinar
 
1:47 PM
@ngn I feel confident that you can shorten this significantly.
 
 
1 hour later…
2:58 PM
@Adám Hey, I was looking at the answer you linked there and I was wondering if you could tell me why ↑∪↓⍉(⍋∘⍋⍴⌸⊢) works for the Word Icicle challenge. My answer there is very convoluted.
 
Gitte now presents „News from Dyalog“ #DyalogAPL #APLGermany2018-1
 
3:35 PM
@J.Sallé Well, it is just taken from ngn, but I can try to explain it.
@J.Sallé Remember last lesson, how we substituted functions with non-computing functions that just report what they would do?
@J.Sallé So remember that ⍋⍋ gives you the cardinal numbers, i.e. the positions that the letters will occupy when sorted:
⍞←⍋⍋'Word Icicle!'
 
@Adám 4 11 12 7 1 3 5 9 6 10 8 2
 
W will be the 4th, o the 11th, etc. Now since we need to remove them in sort order, W will be the 4th to go, o the 11th to go, etc. This also means that there will be 4 Ws in its column, 11 os in its column, etc.
Now look at the arguments to 's operand:
⎕←(⍋∘⍋{⍺,'⍴''',⍵,''''}⌸⊢) 'Word Icicle!'
 
@Adám
 4 ⍴'W'
11 ⍴'o'
12 ⍴'r'
 7 ⍴'d'
 1 ⍴' '
 3 ⍴'I'
 5 ⍴'c'
 9 ⍴'i'
 6 ⍴'c'
10 ⍴'l'
 8 ⍴'e'
 2 ⍴'!'
 
So that gives:
⎕←(⍋∘⍋{⍺⍴⍵}⌸⊢) 'Word Icicle!'
 
@Adám
WWWW
ooooooooooo
rrrrrrrrrrrr
ddddddd

III
ccccc
iiiiiiiii
cccccc
llllllllll
eeeeeeee
!!
 
3:44 PM
And now we just need to transpose and remove duplicates:
⎕←∪↓⍉(⍋∘⍋{⍺⍴⍵}⌸⊢) 'Word Icicle!'
 
@Adám
┌────────────┬────────────┬────────────┬────────────┬────────────┬────────────┬────────────┬────────────┬────────────┬────────────┬────────────┐
│Word Icicle!│Word Icicle │Word  cicle │ ord  cicle │ ord   icle │ ord   i le │ or    i le │ or    i l  │ or      l  │ or         │  r         │
└────────────┴────────────┴────────────┴────────────┴────────────┴────────────┴────────────┴────────────┴────────────┴────────────┴────────────┘
 
And of course mix back together for nicer display:
⎕←↑∪↓⍉(⍋∘⍋{⍺⍴⍵}⌸⊢) 'Word Icicle!'
 
@Adám
Word Icicle!
Word Icicle
Word  cicle
 ord  cicle
 ord   icle
 ord   i le
 or    i le
 or    i l
 or      l
 or
  r
 
Btw, in 17.0, works on major cells, so ngn can save 2 bytes: ∪∘⍉⍋∘⍋⍴⌸⊢
@J.Sallé Clear?
 
@Adám Perfectly, thanks!
Sorry I wasn't responding, I was having lunch with my boss :p
@Adám Another question, is there a way to give multiple arguments to so it would rotate the argument multiple times? i.e. something like 1 2⌽'123' yielding 231 312 (I know that doesn't work like that, btw)
I'm trying to use but it'll only yield the last result
 
4:02 PM
@J.Sallé want to answer the challenge?
 
@EriktheOutgolfer yes
 
ngn
4:15 PM
@Adám thank you :)
 
@J.Sallé Like these?
⎕←1 2⌽¨⊂'123' ⋄ ⎕←1 2⌽⍤0 1⊢'123'
 
@Adám
┌───┬───┐
│231│312│
└───┴───┘
231
312
 
@Adám Aaaaah, the right argument needs to be enclosed!
That's what I was missing. Thanks a lot!
 
@J.Sallé Yes, remember APL's scalar extension. If the left is a vector and the right a scalar, the scalar is extended. makes anything into a scalar.
 
Yeah, I see it now
 
4:22 PM
@J.Sallé Here is a more array oriented way to do it:
⎕←1 2⌽2⌿⍉⍪'123'
 
@Adám
231
312
 
I sometimes think of some arguments as a bunch of scalars instead of vectors >.>
 
@ngn Feel free to rework into an explanation for your post.
 
4:38 PM
⎕←(+/⍎¨∘((⍳∘≢⊢)⌽¨⊂)÷∘≢⊢)'123'
 
@J.Sallé
222
 
Any golfing suggestions?
 
@J.Sallé (⍳∘≢⊢)
 
@Adám that's supposed to rotate the argument ⍳≢ times
 
@J.Sallé Right, but you clearly converted this from a dfn, right?
 
4:40 PM
Nope, did it from scratch
 
@J.Sallé Oh, my bad. Then how did you end up with (⍳∘≢⊢)? It is the monadic function ⍳∘≢ atop the no-op !
 
@Adám honestly? Trial and error. That was the only way that didn't throw a domain or length error
I guess I didn't change it as I built the function over it (that was the first thing I did)
 
@J.Sallé OK, and you've got the same issue with ≢⊢.
 
@Adám the rightmost one?
⎕←(+/⍎¨∘((⍳∘≢)⌽¨⊂)÷∘≢)'123'
 
@J.Sallé
DOMAIN ERROR
 
4:44 PM
@J.Sallé You have a stray between ÷ and .
 
Ah, I see
 
@J.Sallé You can remove the parens around ⍳∘≢ now that it is a single (derived) function.
 
I think I used ÷∘≢ reflexively and just added the when it threw the error
⎕←⎕←(+/⍎¨∘(⍳∘≢⌽¨⊂)÷≢)'123'
 
@J.Sallé
222
222
 
lol doubled the ⎕←
Sounds good though
 
4:46 PM
@J.Sallé Well, the good thing is that you're building up so much APL experience that you're doing things reflexively. APL becomes a way of thinking rather than coding.
 
@Adám yeah, that's kind of what I'm doing. I built this function really fast after you gave me the tip about rotating stuff
 
@J.Sallé Remember, any time you have (ParenthesisedExpression) Function SingleToken you can save a byte with SingleToken Function⍨ ParenthesisedExpression.
 
@Adám Oh, let me see
@Adám I can't actually see how that applies there though >.>
 
@J.Sallé (⍳∘≢⌽¨⊂)÷≢≢÷⍨⍳∘≢⌽¨⊂
 
@Adám oh, I tried doing that with ÷≢ instead of ≢÷
but it does make sense that you'd need to swap the tokens there
I think I broke something though
⎕←(+/⍎¨∘≢÷⍨⍳∘≢⌽¨⊂)'123'
 
4:51 PM
@J.Sallé Yeah, the execute part.
 
@J.Sallé
DOMAIN ERROR
 
@J.Sallé Now it tries to execute each of the length.
 
And I can't just do the same thing and swap arguments can I?
 
@J.Sallé No. because then you need parens again: (+/≢÷⍨⍎¨∘(⍳∘≢⌽¨⊂)) But I'll teach you a trick for this one.
 
Oooooooh I like tricks :D
 
4:56 PM
The problem here is that you want to call monadically on each one. Since you need the ¨, you can't do +/∘⍎¨ as that would require +/∘(⍎¨) to limit the ¨ to and not +/. But since you're only evaluating numbers, remember that numbers have the same value in every namespace, so you can use dyadic to evaluate them in a specific scalar (so that it distributes to each rotation vector) 1-char namespace: #⍎¨. Now you can write +/#≢÷⍨⍎¨⍳∘≢⌽¨⊂.
 
@Adám oh cool
I've never seen # used in APL before, I think?
Something seems to be broken though
 
@J.Sallé Lesson 16.
 
⎕←(+/#≢÷⍨⍎¨⍳∘≢⌽¨⊂)'123'
 
@J.Sallé
DOMAIN ERROR
 
@J.Sallé Yeah, I made a typo. Should be +/≢÷⍨#⍎¨⍳∘≢⌽¨⊂.
 
5:00 PM
Ah, okay
How do I explain the # on my post though?
Do I just say it's the root namespace?
 
@J.Sallé You don't need to. Notice the double loop?
 
@Adám not really? You mean the two ¨?
 
@J.Sallé Yeah.
 
Okay, then yes :p
 
@J.Sallé That's too much "pepper" (looks like pepper dots). You can fuse the loops: +/≢÷⍨#⍎¨⍳∘≢⌽¨⊂+/≢÷⍨⍳∘≢(⍎⌽)¨⊂. Since it costs you 2 (parens) and saves you 2 (# and ¨) it is free.
 
5:05 PM
@Adám geez that's a brain knot right there
Looks very simple, but it's doing a lot
I'll post it that version then!
 
@J.Sallé I hope it was a learning experience.
 
@Adám indeed it was
 

« first day (446 days earlier)      last day (2209 days later) »