« first day (1904 days earlier)      last day (767 days later) » 

12:24 AM
I’m no pro but I think that iterating over data is emphasized over recursion. E.g. ` ⎕IO←0⋄2*⍳5`
⋄⎕IO←0⋄2*⍳5
 
@doug 1 2 4 8 16
 
Hey all, anyone here know how session management stuff works on Dyalog?
 
It might be interesting to somehow scan to see the intermediate results.
 
12:51 AM
@arcfide Do you mean ⎕SE in the Windows IDE? Fonts, menus, storing your own code, etc.?
 
 
2 hours later…
2:57 AM
@att not sure what you mean, scan is always right to left. {2×⍺}\1 2 3 4 ←→ ({2×⍺}/1) ({2×⍺}/1 2) ({2×⍺}/1 2 3) ({2×⍺}/1 2 3 4)
and scan does not work by reusing previous result in general, only in a few special case of builtin function.
 
att
3:14 AM
that's left to right
I mean something like f\1 2 3 -> (f/1 2 3) (f/2 3) (f/3)
 
Easy, ⋄ +{⌽⊃((⊣⍺⍺⍨⊃⍤⊢),,⍤⊢)/⌽⍵}⍳6
 
@LdBeth 1 3 6 10 15 21
 
⋄ -{⌽⊃((⊣⍺⍺⍨⊃⍤⊢),,⍤⊢)/⌽⍵}⍳6
 
@LdBeth 1 ¯1 ¯4 ¯8 ¯13 ¯19
 
oh, what you specified is just ⌽f\1 2 3
or, whatever, ⋄ ,{⌽⍺⍺⍨\⌽⍵}⍳4
 
3:22 AM
@LdBeth
┌───────┬─────┬───┬─┐
│1 2 3 4│2 3 4│3 4│4│
└───────┴─────┴───┴─┘
 
it is just a matter of playing with .
 
4:05 AM
@att Usually left to right vs. right to left is an issue when dealing with linked lists. There is obviously an overhead to reversing an array but not nearly the same as when dealing with linked lists.
 
att
4:17 AM
@LdBeth ⋄{2×⍺}{⌽⍺⍺⍨\⌽⍵}⍳4
 
@att 8 8 6 4
 
4:35 AM
@att Also to be clear, the direction of the slash distinguishes between reduce and scan not between iterating from the left or the right. I do think think intuition for array languages is slightly different than functional languages. You might find K more intuitive than APL.
 
att
yes, I'm aware of what each slash means
 
4:54 AM
Oh, okay. I didn’t understand what you were getting at in your example above with f\1 2 3
Oh, I see now. Those are meant to represent the results.
 
@PaulMansour Probably not. arcfide is Aaron Hsu!
@arcfide You can have a look at how Jarvis and MiServer does it (assuming you mean keeping track individual online users' current communications with the server)
 
att
The way I can think of doing it now is like ⋄{2×⍺}{⊃((⊂⍺⍺∘⊃),⊢)/⍵}⍳4 which feels gimmicky
 
@att 2 4 6 4
 
@doug You can 'tc'⎕CY'dfns' and put tc between and its left operand:
      'tc'⎕cy'dfns'
      {1+2×⍵}tc⍣5⊢1
 ∇  1  =>  3
 ∇  3  =>  7
 ∇  7  =>  15
 ∇  15  =>  31
 ∇  31  =>  63
63
 
Right fold is just left fold on the reversed list with the arguments reversed at each invocation.
 
5:00 AM
⋄ {2×⍺}⍨\⌽⍳4
 
@PyGamer0 4 6 8 8
 
@Adám Thanks. Currently way over my head, but I’ll get there eventually.
 
tc is a monadic operator which just prints its operand and argument(s) and result, then applies the function. It is actually quite easy to implement yourself.
 
It makes sense. I still don’t have good intuition about when I should be looking to implement something myself.
@att I think in APL the focus is on manipulating the data rather than wresting control over the iteration.
 
att
the order matters when using functions like {2×⍺}
⋄{2×⍺}{⌽⍺⍺⍨\⌽⍵}⍳4
 
5:06 AM
@att 8 8 6 4
 
att
⋄{⍺⍵}{⌽⍺⍺⍨\⌽⍵}⍳4 vs ⋄{⍺⍵}{⊃(⊂⍤⍺⍺∘⊃,⊢)/⍵}⍳4
 
@att
┌───────────┬───────┬───┬─┐
│┌───────┬─┐│┌───┬─┐│3 4│4│
││┌───┬─┐│4│││2 3│4││   │ │
│││1 2│3││ ││└───┴─┘│   │ │
││└───┴─┘│ ││       │   │ │
│└───────┴─┘│       │   │ │
└───────────┴───────┴───┴─┘
┌───────────┬───────┬───┬─┐
│┌─┬───────┐│┌─┬───┐│3 4│4│
││1│┌─┬───┐│││2│3 4││   │ │
││ ││2│3 4│││└─┴───┘│   │ │
││ │└─┴───┘││       │   │ │
│└─┴───────┘│       │   │ │
└───────────┴───────┴───┴─┘
 
Absolutely but you can work the data to get the order you want at the right point.
 
5:23 AM
Nice visual
 
@doug You know you can get that display form in your local APL too, right?
 
5:57 AM
Yeah. I meant that this shows left and right folds pretty well.
 
 
1 hour later…
7:23 AM
@doug would this be the k equivalent? ngn.bitbucket.io/k/…
 
Yep. That’s pretty much what @att has above. In haskell though, you don’t actually have to do the flips because the recursion itself is happens differently. You could of course hand implement the recursion one way or the other.
 
7:43 AM
I am unable to get recursion to work. I think there’s something I’m fundamentally missing.
 
@doug What is your attempt?
 
⋄{1=≢⍵:⍵ ⋄ (⊃⍵)(⊂,(⊂∇))1↓⍵}1 2 3
 
@doug
┌─┬─┬──────┐
│2│3│┌┬─┬─┐│
│ │ │││3│3││
│ │ │└┴─┴─┘│
└─┴─┴──────┘
 
⋄{1=≢⍵:⍵ ⋄ (⊃⍵)(⊂,⊂)∇1↓⍵}1 2 3 4
 
@doug
┌──┬────┬──┬────┬──┬─────┬──┬────┬──┬────┬──┬─────┬──┬────┬──┬────┬──┬─────┬──┬────┬──┬────┬──┬─────┬──┬────┬──┬────┬──┬─────┬──┬────┬──┬────┬──┬─────┬──┬────┬──┬────┬──┬─────┬──┬────┬──┬────┬──┬─────┐
│┌┐│┌──┐│┌┐│┌──┐│┌┐│┌───┐│┌┐│┌──┐│┌┐│┌──┐│┌┐│┌───┐│┌┐│┌──┐│┌┐│┌──┐│┌┐│┌───┐│┌┐│┌──┐│┌┐│┌──┐│┌┐│┌───┐│┌┐│┌──┐│┌┐│┌──┐│┌┐│┌───┐│┌┐│┌──┐│┌┐│┌──┐│┌┐│┌───┐│┌┐│┌──┐│┌┐│┌──┐│┌┐│┌───┐│┌┐│┌──┐│┌┐│┌──┐│┌┐│┌───┐│
│││││┌┐││││││┌┐││││││┌─┐││││││┌┐││││││┌┐││││││┌─┐││││││┌┐││││││┌┐││││││┌─┐││││││┌┐││││││┌┐││││││┌─┐││││││┌┐││││││┌┐││││││┌─┐││││││┌┐││││││┌┐││││││┌─┐││││││┌┐││││││┌┐││││││┌─┐││││││┌┐│││││
 
7:48 AM
… and variants thereof including recursing in a separate statement.
 
⊂,⊂ is most likely not what you want, since it means (⍺⊂⍵),(⍺⊂⍵)
⋄ {1=≢⍵:⍵ ⋄ ⍵(∇1↓⍵)} 1 2 3
 
@Bubbler
┌─────┬───────┐
│1 2 3│┌───┬─┐│
│     ││2 3│3││
│     │└───┴─┘│
└─────┴───────┘
 
@doug ^ is this closer to what you want?
 
It’s exactly what I wanted, but I’m not sure I 100% understand why I got the results I did on my wrong code.
 
Your inner train is incorrect
 
7:55 AM
Err, not quite exactly. I wanted something more like (1;(2;3 4)). Sure it’s incorrect for my intentions but what if I wanted this code. What is it doing?
 
Oh.
⋄ {1=≢⍵:⍵ ⋄ (⊃⍵)(∇1↓⍵)} 1 2 3 4
 
@Bubbler
┌─┬─────────┐
│1│┌─┬─────┐│
│ ││2│┌─┬─┐││
│ ││ ││3│4│││
│ ││ │└─┴─┘││
│ │└─┴─────┘│
└─┴─────────┘
 
Yeah. Like that. I get your point but I’m still unclear how the mechanism of recursion works in the face of forks, etc.
 
totally normally works with forks.
 
Meaning?? How often is the recursive call called?
 
7:59 AM
I don't get what you want by "how often". It is just a normal function which happens to be a reference to the enclosing dfn.
 
Why is there no 1 in the output of my faulty code?
 
First one?
 
The 1..
 
(⊃⍵)(⊂,(⊂∇))1↓⍵ ←→ ((⊃⍵)⊂1↓⍵),(⊂(⊃⍵)∇1↓⍵))
 
Makes sense, but the argument to my function is an array with a 1 in front. Shouldn’t there be a 1 in the output somewhere?
 
8:02 AM
If ⍵ is 1 2 3, it becomes (1⊂2 3),(⊂1∇2 3)
See the problem?
 
Oh…. I see. Yes. It’s dyadic. The 1 is the left arg.
 
1⊂2 3 is 2 3 (partitioned enclose), and in 1∇2 3 the left argument 1 is ignored because you don't use in the dfn.
So there is no 1.
 
Couldn’t get it through my thick head that this is partition and not enclose.
 
⋄ {1=≢⍵:⍵ ⋄ (⊃⍵) ,⍥⊂∘∇ 1↓⍵} 1 2 3 4
 
@Bubbler
┌─┬─────────┐
│1│┌─┬─────┐│
│ ││2│┌─┬─┐││
│ ││ ││3│4│││
│ ││ │└─┴─┘││
│ │└─┴─────┘│
└─┴─────────┘
 
8:05 AM
I also didn’t realize that the ⍺ would get ignored though I wasn’t thinking that far ahead.
I think I’m up to speed. Thanks for your patience.
 
No problem.
 
8:19 AM
That’s a right fold and this is a left one ⋄{1=≢⍵:⍵⋄∇(↓2↑⍵),2↓⍵}⍳4 The function would be catenation but this is a minor cheat. Easy to fix.
 
@doug
┌───────────┐
│┌───────┬─┐│
││┌───┬─┐│4││
│││1 2│3││ ││
││└───┴─┘│ ││
│└───────┴─┘│
└───────────┘
 
@Bubbler’s last version makes the , explicit. You wouldn’t need the for a general function.
 
@Adám does aplcart read its entries from a file?
 
@PyGamer0 Yes, table.tsv.
 
how does it load and display it?
js?
 
8:32 AM
Yes, fetch.
Btw, in Dyalog 18.2 you can get that file (sans the header line) with t←⎕SE.Dyalog.Utils.APLcartTable 0 (or 1 if you want to refresh the cache).
 
 
3 hours later…
11:53 AM
What is the way to use apl characters with tty version which I use with putty? I tried to install Dyalog IME with help of IT department but for some reason I can't see keyboard layout in taskbar and don't have access to registry so I could do something there.
 
@kimmolinna which version of Windows are you using ? You do need to follow the steps described in help.dyalog.com/18.2/#UNIX_IUG/PuTTY.htm
@kimmolinna and dyalog.com/apl-font-keyboard.htm might help too.
 
The problem is that Dyalog UnicodeIME needs admin rights.
I don't any problems with my own laptop.
And I don't have any windows system installed on my Linux instance. Is there any possibilities to use prefix with tty as in Ride?
 
@kimmolinna That has been requested by others too (issue number 19789). I'll add your name there.
@kimmolinna Not sure if you are able to install such, but my Backtick keyboards should work just fine with PuTTY.
 
12:18 PM
I will check that.
@Adám I'm not able to install that. ;)
 
And you can't use RIDE instead of PuTTY?
 
I can. It is working nicely. But I can't use Jupyter Notebook and RIDE in same session. ;)
Or at least I don't know how to do it.
 
No, you can't.
 
But could I start a new RIDE from RIDE and then connect to that by using a different port.
No I can't.
 
12:52 PM
Maybe I have to figure out how to use github.com/DreymaR/BigBagKbdTrixPKL
 
@kimmolinna The interpreter can only use one RIDE protocol connection at any given time.
 
 
3 hours later…
 
1 hour later…
5:39 PM
@att Still hopes: ⋄ +{⍺⍺/¨⌽,⍨\⌽⍵}⍳4
 
@LdBeth 10 9 7 4
 
 
2 hours later…
7:32 PM
Regarding
1
A: We are going shopping!

AdámAPL (Dyalog Unicode), 70 bytes r←calculateTotal(prices coupons tax) r←+/prices××/∊1+(-coupons)tax÷100 Try it online! (∇s are only delimiters on TIO; not part of the definition) With default rules (no forced naming or input/output methods) this would be just 16 bytes: +/⎕××/1+.01×⎕,-⎕ Try it o...

+/⎕××/1+.01×⎕,-⎕ can be written as ⎕+.×1×.+.01×⎕,-⎕ — a rare instance of ×.+
 
 
2 hours later…
10:02 PM
Is there any type of laziness built into Dyalog APL? ...like the way in Haskell that you can make a function that will generate an infinitely long list, then just take the first 5, and the algorithm does not need intervention to stop.
 
no
 
@GreenSaguaro Yes, isolates.
      b←⎕AI[3] ⋄ 3↑⎕DL IÏ⍳5 ⋄ ⎕AI[3]-b
1.033 2.055 3.059
3069
This runs delays of 1, 2, 3, 4, and 5 seconds in parallel, but only needs the first 3 results, thus being able to return after only 3 seconds.
 
won't allow you to make infinitely long lists though
 
Nope, but the question was for "any type of laziness", not for "any type of infinite list".
 
10:18 PM
right. I did not know that lazily evaluated items already existed, I thought it was just an idea for the future
 
The idea for the future is to make f⍰ not even begin to evaluate until the result is needed. f∥ begins right away.
 

« first day (1904 days earlier)      last day (767 days later) »