« first day (915 days earlier)      last day (1742 days later) » 

ngn
7:09 AM
@Jonah regarding this: j's ^:_ is apl's ⍣≡ ("power limit")
"transitive closure" is the power limit of matrix self-multiplication in which + has been replaced with (boolean or): ∨.∧⍨⍣≡
note that the usual matrix multiplication is +.×, and for booleans × and are equivalent
transitive closure guarantees that if a[i;j] and a[j;k] are truthy, then a[i;k] will also be truthy
the neighbour relation is symmetric and reflexive, so its transitive closure will partition the elements into equivalence classes
members of the same class will have the same set of transitive neighbours
row i of the matrix is a boolean vector representing i's neighbours, so ≢∪ of all rows is the number of equivalence classes, ie the "islands"
 
 
7 hours later…
2:02 PM
@Adám Was fiddling with a JSON object in the REPL, apparently it didn't like it very much.
(Granted, the object was badly formatted because I had a brain fart and put some "s in the wrong place, but still...)
 
 
2 hours later…
3:43 PM
Okay, so: I have a JSON object deck, containing a single array of strings called list. How would I go about dealing X combinations of 7 strings in deck.list? I still have some trouble understanding .
The dealing of cards is pretty straightforward: deck.list[7?≢deck.list]
I just wanna do that about 200 times
 
@J.Sallé I assume the JSON part isn't important to the algorithm? from the docs of ? there doesn't seem to be a way other than {deck.list[7?≢deck.list]}¨⍳200 to repeatedly do the same deal
actually deck.list[↑7?¨200⍴≢deck.list] is a bit faster
 
@dzaima I was about to say. Or how about 7?⍤0⊢200⍴≢⍴
 
@dzaima Works great. Thanks!
I was trying to use and failing miserably
 
@J.Sallé yeah, is only useful when you really need the previous result, and don't need all the results at the end, both of which don't match here
 
I see
Okay, now I just got to transform each card into an object itself. This is gonna be fun (not)
 
ngn
4:02 PM
@J.Sallé are you implementing a card game?
 
@ngn A recommendation engine for Magic: the Gathering
It does already give some pretty good stats if you know what you're looking at. TIO link is too big to post here though
 
@J.Sallé You can always use a URL shortener if even a multiline msg isn't enough.
 
@Adám do you suggest any? I used to use google's, but it was discontinued
 
@J.Sallé I use tinyurl because it lets me choose the URL.
 
Ah, cool
Now the real work is to transform all those Strings into JSON objects themselves
Although there's already an API with mtg cards as JSON objects, so it's not gonna be much harder than learning how to use that
 
4:12 PM
a newline will trick SE to allow for longer messages:
https://tio.run/##VVVLbhtHEL1KQxtumMBZBcgm4EeUZYmKQFISAsOL4kxxpsHurnF/RI8Nbw0kiIJkkQt4lQMkQJBljsKLKFXd1Merma6prs97r2qgM1/VPRhq7mustvtPv@1//ePV8oeL/c@fBx@OjA7x6LvXR1NttVejtwnrVMWj4dESISraqNiiWvaOarFFBKuu0cXAp2tIJrvctDp06MV24uEWnZqA9k7OC9jWFPjsHXidrARJZpO8moEx4jH1tHNYs0uEiuxaTOC3ISIaNdERajRsGxsidvJ9J8Wdvn@PUY1JG/Q7Ym@2zXVoPQwGgUNXkXwvfo6r4fcwGLBV@8f0lIJadl67plQtzc4SF1mhXAsGXP38Za4dWBqqZdUSGcXeNxDRS7bjupE7c0ougnb8OvHJrg3HVhdYeeqIQZbMlkyNklPNwYc2Nw8NubBNxqhlslZn5Ft9C04tEDcSDELFGKixSZuNhLlyHKThDlytFvoWpalx8poxXKScfyQXbJ@PciOX2qvMDR9XaDuDQtwcj
 
Huh, weird. I thought I'd tried that.
 
@J.Sallé To avoid having to double quotes, you can put the JSON in Input:
 
@Adám Ah, nice trick.
I was using it that way because it's how I did it in the REPL
 
4:29 PM
@J.Sallé You can use the same trick in the REPL.
 
@Adám Yeah, TIL hahahah
@Adám question: is it possible to send http requests from the repl if I'm behind a corporate firewall?
 
@J.Sallé You'd have to allow APL access.
 
All I found about http requests in APL is in APLWiki and it doesn't seem apply for Dyalog
 
@J.Sallé Do you want a one-off request or do multiple over time?
 
For now, a single request will do for testing purposes
I can generalize it later when I need it
 
4:33 PM
@J.Sallé Look at this example:
     cmd←⎕NEW #.HttpCommand'POST'
     cmd.URL←'https://…'
     cmd.Params←…
     cmd.Headers←'Content-Type' 'application/octet-stream'
     data←cmd.Run.Data
 
@Adám Ah, great! I'll fiddle with it for a while
I'm getting a value error pointing to in ⎕NEW. Do I need to import anything?
 
@J.Sallé Yes, sorry ]load HttpCommand or if under program control, ⎕SE.SALT.Load'HttpCommand'
@J.Sallé In fact, if you only need it once, you can combine the Load and the New with ⎕SE.SALT.New'HttpCommand' 'POST'
 
4:53 PM
Oh, okay, I'll try that
 
5:15 PM
Note to self: never try to paste a ~20k objects long JSON into the REPL
It's still working on it though, so not all hope is lost
 
@J.Sallé Next time, put the cursor on a variable name (you probably want an unused one), then click the "Paste Object" button on the Object toolbar (second button, looks like a grid on a clipboard).
 
@Adám Ooooooh this is good info
I'll keep it in mind
 
E.g. you can copy text to the clipboard with (⎕NEW⊂'Clipboard').Text←'abc'
 

« first day (915 days earlier)      last day (1742 days later) »