« first day (1692 days earlier)      last day (978 days later) » 

1:58 AM
@Adám asumming there is benchmark info, which is faster, loops or →? or are loops derived from →?
 
2:40 AM
You should set the property to report timeout (and close) as events and not errors.
So, before you create the server instance.
DRC.SetProp '.' 'EventMode' 1 ⍝ set the EventMode property on the Root object
Then timeout events will have 4 elements.
 
nwat.
@Brian Is it better to contact via mail, or from here?
 
 
2 hours later…
4:29 AM
CMC: generate a concentric square on a N×N array where N ≥ 3 and N is odd.
Example:
1 1 1 1 1 1 1
1 0 0 0 0 0 1
1 0 1 1 1 0 1
1 0 1 0 1 0 1
1 0 1 1 1 0 1
1 0 0 0 0 0 1
1 1 1 1 1 1 1
 
5:16 AM
@CrisLuengo Hi there. Interested in APL?
 
@Adám I am very curious about it.
In part because I can't make heads or tails from that code I read over at Code Review...
 
Ah, hi.
 
I've followed a link starred in this chat, an intro book on APL.
It makes the case for APL saying it's more compact than JS, with the example of the max operation: ⌈/. In MATLAB it's max(list). So I want to learn: how similar are MATLAB and APL?
 
@CrisLuengo not very similar, in terms that the concept of "rank" is unique to APL (and its friends)
 
@CrisLuengo In some ways very similar, in that both are strong with mathematics, especially matrix/linear algebra, but I'd say that APL has a much neater and harmonised notation, making it decidedly fun to use. I don't think I've ever hear the term "fun" applied to MATLAB :-)
 
5:27 AM
Indeed! :)
 
Also, APL has various functional forms that can make code outright beautiful to look at. Again, not exactly a characteristic of MATLAB.
@CrisLuengo That book is very nice indeed. If you want some engaging video introductions, check out e.g. "Will You Play With Me?" and "Algorithms as a Tool of Thought" from dyalog.tv/APLSeeds21
 
@Adám Thanks!
I've got APL installed, I'm ready to start learning. :)
 
@CrisLuengo Cool. As I mentioned, that starred booked is good, but everyone learns differently, so let point out that additional things are linked from apl.wiki/learning_resources and in general, apl.wiki is a good place to find info.
Of course, people here are always eager to answer any questions that come up.
 
5:42 AM
I'm sure there'll be a lot of questions. :)
Does the UI list all the symbols in the language? Or is that just the most used symbols?
 
Yes the IDE lists all the symbols with tooltips for mini examples
But be ware that there are "idioms" for a variety of combinations of primitives, and you can check out at aplcart.info
 
@CrisLuengo Those are pretty much all of them. The only ones missing are syntactic in nature, like {} and () and [;]
 
How to you comment "oneliners"? I don't think fix would accepts comments outside the { } pair.
 
@LdBeth If you use Link, you can simply put a comment outside the {}. Similarly, 2⎕FIX⊂'foo←{⍵ ⍵ ⍵} ⍝ comment' "just works".
 
6:06 AM
oh, that's nice to have
I realized it just fix won't allow the text begin with comment line.
 
6:38 AM
@LdBeth 2⎕FIX'⍝inital comment' 'foo←{⍵ ⍵ ⍵} ⍝ comment' works for me.
 
6:53 AM
@WongJiaHau {((⌽,S⍤1)⊖⍪S←(2|⍵)∘↓)2|∘.⌈⍨⍳⌈⍵÷2} but I'm not very happy about it.
 
7:04 AM
@WongJiaHau what should the output be when N is 5?
 
@user41805
0 0 0 0 0
0 1 1 1 0
0 1 0 1 0
0 1 1 1 0
0 0 0 0 0
@Adám why are you not happy with the solution?
 
Seems long and awkward.
 
7:18 AM
@WongJiaHau {{~¯1⊖¯1⌽⍵↑⍨2+⍴⍵}⍣(⌊⍵÷2)⊢1 1⍴1} a less mathy way
and slower
 
i don't have anything much better {(1=4|⍵)=2|(⌊/⊢,⍵-1+⊢)¨⍳⍵ ⍵} (⎕io←0)
 
Cannot perform operation when # is referenced by session namespace.
⎕SE.Dyalog...Array...H
I get this when attempt to )clear, with the master branch link
 
@Razetime that doesn't work on 5, but ⊢1 1⍴1 can become ⍪1
@Razetime but were the challenge this, i'd get {2|(⌊/⊢,⍵+1-⊢)¨⍳⍵ ⍵} for ⎕io←1
but using the same approach as yours you can ⍣4 it, {(1⍪⌽∘⍉)⍣4∘~⍣(⌊⍵÷2)⍪1}
 
7:42 AM
@LdBeth Huh, that shouldn't happen. If you can repro it from a clear workspace, please log an issue. Meanwhile, doing a Link.Break should work around it.
 
@WongJiaHau {2|∘.⌈⍨(⊢⌊⌽)⍳⍵}, outermost layer is always 1
 
@Bubbler i don't think your solution works
 
Oh lol, should be
⋄ {2|∘.⌊⍨(⊢⌊⌽)⍳⍵}¨ 3 5 7
2
 
@Bubbler
┌─────┬─────────┬─────────────┐
│1 1 1│1 1 1 1 1│1 1 1 1 1 1 1│
│1 0 1│1 0 0 0 1│1 0 0 0 0 0 1│
│1 1 1│1 0 1 0 1│1 0 1 1 1 0 1│
│     │1 0 0 0 1│1 0 1 0 1 0 1│
│     │1 1 1 1 1│1 0 1 1 1 0 1│
│     │         │1 0 0 0 0 0 1│
│     │         │1 1 1 1 1 1 1│
└─────┴─────────┴─────────────┘
 
@Bubbler wow that's concise
@Bubbler how do you thought of this solution?
 
7:55 AM
start with ⍳ N N, and think about the relation
 
aw, I thought of something similar while on my phone but bubbler beat me to it
 
@WongJiaHau (Self-)outer product is a common trick to build a matrix with certain symmetry, and the specific output is easy to construct by going through a pyramid
2
(Spotting the latter takes practice)
 
by pyramid do you mean (⊢⌊⌽)⍳⍵ ?
 
Yes
 
is that a common idiom?
 
8:01 AM
Or more like ∘.⌊⍨(⊢⌊⌽)⍳⍵
 
@Bubbler nice
 
this is subtle
 
(⊢⌊⌽)⍳⍵ -> ⌊∘⌽⍨⍳⍵
 
Not quite an idiom, but more like a pattern I like to use
Full train is 12 chars: 2|⍳∘.⌊⍨⍤⌊⌽⍤⍳
 
@Adám Not sure whether green points have much to do with accomplishment:) Since I stated doing a lot of programming for my job I stopped doing much in my free time, but it's still on my "things to do some day"-list:) I actually came here to share the link to this room with CrisLuengo who commented on a recent answer of yours on CR. - And I was a little bit surprized (positively) how the apl-orchard has grown quite a bit since I visited last!
 
8:15 AM
@Adám it seems due to the linked source dir contains "apla" arrays, and somehow associated to ⎕SE.Dyalog which prevents the )clear action.
 
9:10 AM
@LdBeth What is your ⎕SE.Link.Version?
 
9:52 AM
@Adám 3.0.0, just downloaded from github's main branch today
 
10:02 AM
@LdBeth OK, great. We'll look into it.
 
is there ⍪ in J?
 
Yes, ,
 
for monadic it's ,. in J
 
@rak1507 Wait, monadic or dyadic.
 
monadic
 
10:15 AM
Ah, then yes, ,.
 
great, thanks
 
the dyadic case is that, J is more unified that the default axis is always the first one.
 
ah, it does alignment, annoying, was trying to see if there was something shorter than echo"0]x for code.golf
 
@rak1507 ":"0]
 
10:23 AM
@rak1507 Just like for APL, Code is the script without implicit output, and Input is the Session with implicit output.
 
yeah but I'm confused about why (1+*)/~ is different to */~
 
@rak1507 Btw, the ] can be a space.
No general stranding on J, only flat numeric vector literals.
 
10:40 AM
is there a b←1 2 in J? (a b)=:1 2 doesn't work
 
@rak1507 i think rank
see (1+*)"0/~]i.10
@rak1507 btw there's a code-golf.io discord and primo was there the last time i checked
 
@user41805 nice thanks
 
@rak1507 'a b'=:1 2
 
@Adám ugh
why does j (ab)use strings for everything
 
ikr
iirc, J also makes a difference between a=: and (a)=:
 
10:51 AM
@rak1507 and btw, anarchy golf has some challenges that reveal source codes, so you can see there for some j tricks (of an older version of j)
 
yeah, I try not to look at anagol too much, but I might for small things like the outputting and whatever
 
> If the rank of u is not 0, it doesn't produce a table
it's (1+*)"0/~i.10 that you expected
So, unlike Dyalog APL where people do not care rank unless it is needed, in J rank should always be considered when making tacit (and direct) definitions
 
how annoying
 
@TryAPL it is just my font or do all boxes look misaligned?
 
It's your font
which browser do you use?
 
11:02 AM
@LdBeth chrome rn (on android)
otherwise firefox
 
@pVCaecidiosporeadduced it looks misaligned to me by default (linux chromium), but i have a userstyle overriding the font
 
The CSS says the font families are Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif, just make sure any of them is installed.
 
 
1 hour later…
12:20 PM
@rak1507 What's the APL version of the third line?
 
@Adám @Brian I've localized all my vars in the tradfn, how do i get rid of this error?
1043  ERR_ALREADY_INITIALIZED  DLL probably loaded more than once
MakeN[22] InitInstance
 
12:33 PM
@MasterQuiz Other than (1+×)⍨⍳10?
@xificurC Long time no see!
 
12:48 PM
@Adám It's the first time I see J code, I thought that /~ was ∘.f⍨
 
Me too, but apparently trains have infinite rank.
 
1:16 PM
@Adám indeed
 
 
2 hours later…
3:11 PM
@Adám Is there a way to get ⎕CY to import locally?
 
@Razetime You mean as local names in a dfn?
 
in a tradfn
cause it says DLL loaded more than once
when i try to run my server function
 Server ;DRC;C;Conga;server;data;S1;DiscordBot;⎕CY
 'Conga' ⎕CY 'conga' ⍝ import conga as C
 C←Conga
 DRC ← C.Init 'DiscordBot'
 DRC.SetProp '.' 'EventMode' 1
 server ← DRC.Srv 'S1' 'localhost' 8080 'http'
 flag ← 1
 :while flag

    (rc obj evt dat)←DRC.Wait 'S1'
     :if 'TIMEOUT'≢obj
         ⎕←'Received' dat
     :endif
   ⍝ :select evt
   ⍝ :case 'HTTPHeader'
   ⍝   ⎕←'request given:' data
   ⍝ :else
   ⍝   ⎕←'something else'
   ⍝ :endselect
 :endwhile
 
@Razetime
VALUE ERROR: Undefined name: dat
      ⎕←'Received'dat
                ∧
 
@Razetime You can use ⎕SHADOW to do it dynamically, or simply mention the names in the locals lines or the header.
@TryAPL Shh!
 
tryapl do be confused here
 
3:15 PM
I can't think of a good way to let the bot distinguish.
Maybe if the initial line doesn't begin with or ⎕←?
 
just use a trigger symbol which is on the layout but not used in APL
like ⍙ maybe
 
And remove reacting to and ⎕←? Nah, that'd be ugly.
 
well that's the best distinction i can find
or use one of the box synbols
like ⍰
 
It'd be awkward to use.
 
well, it's what most execution bots do.
otherwise we need a keyword
which is not very APLy
 
3:18 PM
No, no need. No multi-line thing will begin with ⎕← or if not intended for the bot.
@hyper-neutrino Would it be possible to make the bot ignore multi-line things that don't begin with those?
 
should be easy, let me give it a shot
@Adám okay, the bot now ignores codeblocks if they don't start with ⎕← or and if they do, runs every line that starts with one of those
a
⎕←4
⎕←4
a
⎕←5
 
@hyper-neutrino
4
5
 
@hyper-neutrino Hm, I think it should run every line, otherwise this won't work:
⋄ a←4
b←5
⎕←a+b
 
@Adám
VALUE ERROR: Undefined name: b
      a←4 ⋄ ⎕←a+b
              ∧
 
ok, so when I run my server tradfn a second time, it throws a dll error
 
3:26 PM
But maybe it is ok, and you simply have to have on every line you want run.
 
but running it a third time runs fine again
 
@Razetime Maybe a better idea to load Conga globally, but conditionally on Conga not already being present?
:If 0=⎕NC'Conga'
 
i think the problem is that I have to strong interrupt in order to stop my server
 
Oh.
 
so the DRC.Close doesn't execute
 
3:28 PM
Why don't you simply check a stop flag every time around the loop?
Then launch your server in a background thread with {Server}&⍬ and simply set the stop flag when you want it to stop.
 
@Razetime This can happen when you've tried to Init an Conga library instance with the same name. Did you have a 'DiscordBot' instance outside of Server as well? Were you doing something with Conga outside of Server and also copying it in withinServer?
 
nope, nothing outside the tradfn
 
(Alternative to {}&⍬ is giving Server an argument so you can do Server&⍬)
 
@Adám i'm not sure where i'd conditionally stop for this. It needs to keep listening for requests.
 
Even when you stop it?
Surely, when you were issuing strong interrupts, it stopped listening.
 
3:32 PM
yeah with an interrupt
but outside of an interrupt i'm not sure how i'd simply stop it
@Adám oh, this.
 
Yeah, in the session, simply set the global flag to make the server stop next time it hits the check.
 
@Adám the idea was that you could leave remarks but i guess you should use for that anyway
would you prefer only marked lines are run, so you need an extra , or that all lines are run, so you need a to leave remarks about a block of code?
 
@Razetime Also, is there a particular reason you're localizing Conga within Server?
 
I want a contained runnable server function is all
If it gets bigger I'll define an Init method
 
@hyper-neutrino I'm not sure. Leave it for now. It is quite unlikely to cause trouble, but if it does, I'll let you know.
 
3:36 PM
Alright, sounds good
 
That's a fair reason, I do the same in HttpCommand. You might want to check for ⎕INSTANCES Conga.LIB to see if there's are instances hanging around, and then if there are look at (⎕INSTANCES Conga.Lib).RootName to see if there's a DiscordBot instance and then close that.

Also, Adam's suggestion of setting flag←0 is spot on for stopping the listen loop. It's a wide idea to close Conga instances cleanly before restarting.
 
cool, thanks a lot.
I will now attempt to hook this with discord and listen
 
4:01 PM
so i have my server displaying some debug output, and it's quite a pain to type flag←0 in the console. Any way around it? @Adám
 
You could assign an F-key to flag←0<Enter>
 
sorta like a macro?
aha the PF ones are free i see
 
You're on RIDE, right?
 
yep
 
So the code would be flag←0<ER>
 
4:04 PM
it should be (|flag←0<ER>) right
 
Why the |?
 
i though that was the format for a moment
then i realized it was jsut a regex
 
4:29 PM
is there a http header parsing function in conga?
 
@Brian ^
 
i found a microservice presentation in the talks page: youtu.be/KKJMeGAWGaE are there any other good videos with relation to conga
ah there's two more from a month ago
 
@Razetime We are working on a searchable video library.
 
great
 
@Razetime There's not much in Conga itself for further parsing of HTTP requests. Both Jarvis and HttpCommand have some reasonably self-contained code. Jarvis looks at things from a server viewpoint, whereas HttpCommand is a client.
 
4:34 PM
ok, that's good
 
@Razetime If you need more guidance, drop me an email... it will be a lot easier to convey in the medium
 
sure, I will do that.
 
4:45 PM
In particular, the Request class and and Server and HandleRequest functions in Jarvis could be useful to look at.
Also, I'm finishing HttpServer, which is a generic HTTP server (based on Jarvis) that could be useful... I expect to publish a repository for it probably in late October.
 
 
4 hours later…
8:56 PM
can someone explain to me what does the colon after ~ does in J sort verb ?
sort
/:~ :/:
 
That doesn't look right.
Oh, wait, now I get it.
 
yes, I get an idea it is a train and before second verb is applied arguments are swapped with ~
 
This is monad-dyad definition.
It says the monadic form is sort-by-self and the dyadic form is sort-by.
 
ohh
 
Might be easier to read if written as /:~ : /: or even (/:~) : (/:)
 
9:00 PM
I have never seen : in tacit expresion
I get it now
 
I think it'd be equivalent to writing sort =: /:~~
 
9:19 PM
V this I am trying to sort  to V this
-------                                -------
|'b'|2|                                |'a'|1|
-------                                -------
|'a'|1|                                |'b'|2|
-------                                -------
|'c'|3|                                |'c'|3|
-------                                -------

Yes, I have inputed it by hand...
obviously it is sort on second column
 
   V=:'bac',&(<each)2 1 3
   (]/:]/"1) V
┌───┬───┐
│┌─┐│┌─┐│
││a│││1││
│└─┘│└─┘│
├───┼───┤
│┌─┐│┌─┐│
││b│││2││
│└─┘│└─┘│
├───┼───┤
│┌─┐│┌─┐│
││c│││3││
│└─┘│└─┘│
└───┴───┘
@alwalo Not obvious, it could also be sorted by the first column.
 
yes, I could think about some better placeholders, I will check it out now
 
@alwalo Maybe something like:
   ]V=:'abc',&<&>2 1 3
┌─┬─┐
│a│2│
├─┼─┤
│b│1│
├─┼─┤
│c│3│
└─┴─┘
   (]/:]/"1) V
┌─┬─┐
│b│1│
├─┼─┤
│a│2│
├─┼─┤
│c│3│
└─┴─┘
 
yes, I meant to say this but try to figure it out on my own, how to unboxed version, thank you so much !
 
A more general solution is n (]/:{"1) V for sorting by column n.
 
9:27 PM
jesus christ, I can feel my power groving each day but I still get stuck so often
I wonder when i will have more fluency
 
There are always more tricks to learn. Full disclosure: I don't know J at all.
You didn't see my dozen nonsense attempts trying to answer this ;-)
 
haha and yet you keep helping me. I even asked last week how easy it is going between J<>APL
it seems that it would be pretty easy
 
Yeah, I have cursory knowledge of J's vocabulary, and then I just use my APL skills and apply them using that vocabulary. For basic manipulations like this, it is all much the same.
The reason for my initial overly enclosed V is my unfamiliarity with J's array model, which differs a little from APL's.
 
*: each 1{"1 V
for example this squares column with numbers
any way to modify this whole table in-place ? so changes stick after verb is over
so if i displays V this column stays squared, it got mutated
if there is no such way I can probably append it manaully
it would be easy to make a dyadic verb, x is column, y is verb to be applied, I can try it
do you know what I am talking about Adam ? is there something like this in dyalog ? if you know i can research it further on my own
 
9:49 PM
@alwalo You'd have to assign V for the changes to stick, but you might want to look into amend }
@alwalo Dyalog has modified assignment which is in-place:
      V←3 5⍴⍳15
      V*@1⍤1⍨←2
      V
 0    2  2  3  4
 5   64  7  8  9
10 2048 12 13 14
Or using square brackets:
      V←3 5⍴⍳15
      V[;1]*←2
      V
 0   1  2  3  4
 5  36  7  8  9
10 121 12 13 14
 
ok, thank you
 
@alwalo Apparently, if you do an assignment to the same name immediately after amend, it is done in-place:
   ]V=:3 5$i.15
 0  1  2  3  4
 5  6  7  8  9
10 11 12 13 14
   V =: (*:1{"1 V) 1}"0 1 V
   V
 0   1  2  3  4
 5  36  7  8  9
10 121 12 13 14
 
ok, thats great that it is possible
 
10:52 PM
Yeah, amend in place is a special pattern, as written at the bottom of NuVoc amend page
 

« first day (1692 days earlier)      last day (978 days later) »