« first day (1352 days earlier)      last day (1285 days later) » 
04:00 - 21:0021:00 - 22:00

4:45 AM
In J, I can do I. 0 0 4 1 0 to produce 2 2 2 2 3. Why can I not do I.inv 2 2 2 2 3 to produce 0 0 4 1?
 
@Jonah J simply does not support inverses not defined in this list.
 
 
5 hours later…
9:56 AM
0
Q: APL: array's element replacement and multiplication

Parisa ZaeriLet's say in APL language, I have a 2D array of shape 10x3. I cannot figure it out how to: replace all the occurrence of some specific numbers (e.g. 1, 2, 3, 4) in the entire array with 0, 10, 100, 1000 respectively. So I want to map 1 to 0, 2 to 10, 3 to 100 and 4 to 1000 in the entire array.

 
10:22 AM
@Adám speaking of this ^ question, isn't the APLCart description back-to-front here: aplcart.info/?q=replace%20all%20val#
 
@xpqz It is. Thanks.
 
@xpqz I presume that's Dyalog? What does the @ do in Dyalog?
 
I think of it as a Swiss-army chainsaw to alter vectors and matrices.
 
@xpqz Uh, it works on higher (and lower) rank arrays too.
@EliasMårtenson In the most summarised form, it modifies@locations.
 
⋄ 50@(5∘=)10 3⍴⍳30
 
10:29 AM
 
But also ⋄ -@2 3 5 7 ⍳10
 
@Adám 1 ¯2 ¯3 4 ¯5 6 ¯7 8 9 10
 
⋄ (-@2 3 5 7) 10×⍳10
 
@Adám 10 ¯20 ¯30 40 ¯50 60 ¯70 80 90 100
 
@Adám that's odd. Which arguments belong to the @ and which are part of the data? WHat does this do?
⋄ -@2 3 5 7 ⍳10 ⍳5
 
10:32 AM
@EliasMårtenson RANK ERROR
 
⋄ -@2 3 5 7 ⊢⍳10 ⍳5
 
RGS
@EliasMårtenson, in your code Dyalog APL sees 2 3 5 7 ⍳10 ⍳5 as a whole array
 
@xpqz RANK ERROR
 
Meh
 
@RGS Uh, no.
 
RGS
10:33 AM
Also ⍳10 ⍳5 is something weird
 
You can't look up numbers in a scalar.
 
Doesn't Dyalog have some option to turn on nicer error messages? GNU APL has the )MORE command, which at least sometimes provides more detail.
⋄ ⍳10 ⍳5
 
@EliasMårtenson It always gives nicer error messages, but the bot doesn't convey them.
 
@EliasMårtenson RANK ERROR
 
RGS
I'm assuming Elias did mean 2 3 5 7 (⍳10) (⍳5)
 
10:34 AM
Too many ⍳s
⋄ -@2 3 5 7⊢⍳10
 
@xpqz 1 ¯2 ¯3 4 ¯5 6 ¯7 8 9 10
 
⋄ -@ 2 3 4 (⍳10) (⍳5)
 
@EliasMårtenson Illegal code
 
@EliasMårtenson It is a normal dyadic operator. The array to the immediate right is the right operand, and the rest (from the next function and onwards) is the right argument.
 
You need the tack
 
RGS
10:35 AM
         -@ 2 3 4 (⍳10) (⍳5)
┌─┬─┬─────────────────────────────────────┐
│-│@│┌─┬─┬─┬───────────────────┬─────────┐│
│ │ ││2│3│4│0 1 2 3 4 5 6 7 8 9│0 1 2 3 4││
│ │ │└─┴─┴─┴───────────────────┴─────────┘│
└─┴─┴─────────────────────────────────────┘
 
@xpqz Or any other function.
 
RGS
@EliasMårtenson this ^ is what your code returns if ⎕IO←0
 
@EliasMårtenson ^ … which the bot doesn't allow returning because it is a function.
 
I still find all the different @-versions hard to grasp, esp when dealing with functions on both sides.
 
RGS
Totally unrelated to the discussion at hands but I have come to appreciate the expression (1+÷)⍣≡ 1 a LOT. I just find it very elegant. And I even surprised a mathematician friend of mine, who for some reason wasn't aware that the golden ratio is a fixed point of f(x) = 1 + (1÷x)
 
10:40 AM
@xpqz Does this help?
 
@Adám it's my go-to resource :) but even reading "At: apply X∘f to modify positions identified by Boolean mask (g Y) in Y" leads to a great deal of head scratching each time for me, although I eventually get it right. Your answer to the ^above SO question does help a lot for me.
 
@RGS I like 1+∘÷⍣≡1 or even +∘÷⍣≡⍨1 more :-)
 
The example you gave
 
@xpqz Any ideas on how I can formulate it to make it clearer?
@xpqz What?
 
{replacements[specific ⍳ ⍵]} @ {⍵ ∊ specific} array
would make a great link from APLCart. It shows a non-trivial, but fairly common use-case I think.
 
10:50 AM
1+∘÷⍣≡1 is so cool
 
@xpqz Will do. {⍺⍺(⊂⍤⍳⌷⊣)@(∊∘⍺⍺)⍵} does the trick with the same syntax as ⎕R. However, it isn't major cell oriented…
Uh, no, that's obviously wrong. {⍺⍺(⍵⍵⌷⍨∘⊂⍳)@(∊∘⍺⍺)⍵} it is.
 
11:06 AM
Wow -- that's a keeper!
specific {⍺⍺(⍵⍵⌷⍨∘⊂⍳)@(∊∘⍺⍺)⍵} replacements⊢array
 
Well, you need {⍺⍺(⍵⍵⌷⍨∘⊂⍳)@((≢⍺⍺)≥⍺⍺∘⍳)⍵} for major cell support. Which one should I include? Both?
 
Both maybe?
 
Yeah, on it.
Meh, the high rank version doesn't work due to (a quirk in) @'s definition.
 
11:21 AM
What does other APLs use for line continuation? If I want to break a line, similar to the backslash in shellscript for example?
 
@EliasMårtenson The only APL I know of with line continuation is NARS2000, and it doesn't seem to be a specific byte, but rather something handled by the IDE. It is indicated by a user-definable symbol on the continuing line rather than at the end of the continued line. I have proposed using a trailing backtick ` as line continuation character. I think PowerShell uses that too.
 
@Adám +←1
 
RGS
I was going to look for the first time +← 1 was used in this room as the APL version of +1 but the search functionality is terrible and ignores the ← altogether. Is there a workaround for this?
@Adám "on Linux, default is the Windows key" ahaha
 
@Adám - PowerShell does indeed use the backtick as a continuation character; it also allows a pipe | to end the line and the cmdlet/script that you're piping to start the next line.
 
11:39 AM
Heh, you can already now hack line continuation (except in between left arguments and functions, between operators and operands, and inside strands):
      1 2 3+{⍵
       }10 20 30
11 22 33
 
RGS
@Adám in your keyboard isn't the square root sign over at AltGr + Shift + S, V?
I can't seem to be able to type it...
 
Strand continuation (both sides must be strands on their own):
      1 2 3{⍺,⍵
       }4 5 6
1 2 3 4 5 6
 
RGS
nvm, √ is actually AltGr + Shift + S, AltGr + 9
 
@RGS (or) not V (vee)
@RGS Yeah, the idea is that it "paints" √¯: ∨`
 
RGS
@Adám ∨OrNotVVee? :D
@Adám yup I get it. I had it almost memorised, except I thought it was lowercase v!
Also, ∨¯
 
11:55 AM
@Adám so you suggest I use the backquote?
It will be much easier to implement a continuation character at the end of the line rather than one at the beginning of the next line, due to the way the tokeniser works.
 
@EliasMårtenson Sure; it is the only commonly used character that isn't already used in APL.
 
@Adám well, that and @
I'm using @ for character escaping. I.e. the character A is @A
"foo" ≡ @f @o @o
 
@EliasMårtenson But that isn't a commonly used line continuation character.
 
Also, # isn't a common APL character either.
True. But I've never seen ` used for that either :-)
 
PowerShell uses `
@EliasMårtenson Doesn't 'A' make more sense? So 'A' is a scalar but "A" is a vector?
 
12:03 PM
@Adám 'a' doesn't make much sense, since it only accepts a single character. I guess 'a could be used, but I already use that syntax for general quoting.
 
@EliasMårtenson Also, as mentioned above @ is a really powerful operator in some APLs (though I would have made it even more powerful if I had had my say).
 
You can, for example, quote the symbol foo using 'foo, which returns the raw symbol instead of evaluating it as a variable. It's the same idea as in Lisp.
 
@EliasMårtenson Do you make a difference between single and double quotes then? And do you really need single character quoting that often?
 
Yes. Double quotes are for strings.
 
And single quotes?
 
12:04 PM
@Adám how so?
 
@Adám you're right not it's not needed that often. But there needs to be syntax to describe a single character, even if you don't use it often :-)
 
@EliasMårtenson So "A" is a 1-element vector?
 
Single quote is a general quoting operation as mentioned above. It's taken from Lisp. It's used to prevent evaluation.
 
Oh.
 
@Adám Yes. That is correct. I find the inconsistency in APL where 'a' is a character, but '' and 'aa' are both vectors so ugly I couldn't force myself to implement it. GNU APL already uses "a" to represent the 1-element vector, so all I did was take the GNU APL syntax for strings and get rid of the single-quoted version.
 
12:07 PM
@dzaima ah, i copied the "non-high-rank" one and saw it did what i expected it to do
 
@EliasMårtenson But isn't this inconsistent with 1 being a scalar while 1 2 is a vector? How do you write a 1-element numeric vector?
 
Also, in light of Unicode, the standard APL way of handling it is dangerous. Where 'ä' might be a character or a two-element vecotor depending on whether ä is the single character or a followed by a combining character.
 
@Adám that too is annoying and stupid, but, unlike with characters, there's not much that could be done without resorting to a separate strand separator as in BQN (or just throwing out stranding in general)
 
@dzaima Uh, a separate strand separator doesn't help, does it?
 
@Adám That would be ,1 just like APL. I agree it's not entirly consistent, but at least it's pretty clear. Much more so than trying to make sense of the concept of a "character" in a Unicode world. BQN does it differently, and in a very interesting way. I preferred to go with mostly-APL-compatible though.
 
12:10 PM
@Adám i guess that's true. So no stranding :)
 
@dzaima @ can take a list of indices of major cells rather than a list of indices of scalars, so you might think that it can take a mask of major cells rather than a mask of scalars too, but it can't.
@dzaima Yup. Iverson was against stranding from the outset. It wasn't in Iverson's notation, only in the first APL implementation.
 
Also, I decided to use " for strings because if someone wants to translate APL code to KAP, they would have to change the string/character syntax, and that would hopefully avoid mistakes.
 
@Adám understandable, it's stupid as notation
 
@EliasMårtenson KAP?
 
@dzaima hat do you mean by stranding?
@Adám That's the name of my implementation.
 
12:12 PM
@EliasMårtenson Adjacent arrays become an array. E.g. 1 2 becomes a vector.
 
You mean 'foo' 'bar' becoming 'foobar' rather than ('foo') ('bar') ?
 
@EliasMårtenson No, 'foo' 'bar' meaning (⊂'foo'),(⊂'bar')
 
@EliasMårtenson no, stranding would be it becoming ('foo') ('bar') (which is still stranding, but with redundant parentheses :p)
 
The lack of a dedicated array notation (like JSON) causes this mess.
If I was to start over, I'd probably extend JSON, so JSON would be a subset of the language.
 
@Adám I don't know. I find it works reasonably well.
 
12:15 PM
@EliasMårtenson how about a 1-item vector, containing 1 2?
 
@EliasMårtenson It has indeed worked reasonably well for over half a century, but it is still annoying at times.
 
That would be (⊂ 1 2)
 
@EliasMårtenson it means you necessarily need separate syntax for 1-item vectors
 
@EliasMårtenson Nope, that's a scalar.
 
@EliasMårtenson not (,⊂1 2)?
 
12:16 PM
Yes of course.
 
@EliasMårtenson so the progression of 3→1 items is (1 2)(3 4)(5 6)(1 2)(3 4)(,⊂1 2) - i.e. not pretty
 
You're right. One-element vectors vs scalars is indeed a notational problen.
 
@dzaima (fwiw there's for ,⍥⊂ in Extended and dzaima/APL)
 
Need to go have some dinner.
 
How many BQn answers are there on CGCC?
 
12:18 PM
@EliasMårtenson Even worse, even with your syntax "abc" "def" "ghi""abc" "def""abc" is inconsistent with "abc""ab""a"
@Razetime None, I think.
 
Well then, don't mind if I do
 
@Adám i don't think it's worth not replacing worse syntax because it's at least somewhat-ish-ish consistent-ish
 
Well, I like "a" ≡ ,'a' and abandoning strand notation altogether.
 
(and i think strands and character [vector] literals are separate enough syntactically for the connection to be useful at all)
 
Lately, I'm thinking about what an APL that uses scalar atomic strings would be like…
 
12:25 PM
@Adám to manipulate them APLily, you'd have to often temporarily convert them to vectors of characters, which would probably quickly turn into a divide of functions taking charvecs & strings in contexts of string manipulation. Otherwise, it'd be like k's symbols, no?
@dzaima (or you could of course create a copy of every built-in to work on strings instead of arrays, but that's not good for quite obvious reasons)
 
I'm trying to make a solution to the Josephus problem with ⍣≡ but I'm not sure how to use it
already have a recursive solution here: 1+{⍺>1:⍺|⍵+(⍺-1)∇ ⍵ ⋄ 0}
29
Q: Josephus problem (counting out)

HowardThe challenge Write a function that takes two positive integers n and k as arguments and returns the number of the last person remaining out of n after counting out each k-th person. This is a code-golf challenge, so the shortest code wins. The problem n people (numbered from 1 to n) are standing...

I tried {¯1↓⍺⌽⍵}⍣≡0
But I get a value error
 
12:40 PM
@Razetime (f⍣function) X will always at least call f X, so you're calling {¯1↓⍺⌽⍵} monadically
 
oh,
how does it work for two then?
 
RGS
@Razetime two arguments?
 
@Razetime A (f⍣g) B is equivalent to ({A f ⍵}⍣g) B
 
RGS
btw, you can read f⍣≡ "find the fixed point of f" so you have to make sure your f has, as fixed point, the solution to your problem
 
@dzaima I was thinking that + could merge strings and then we just need to be able to split them. $ could do that, and +/⍥1 would be its inverse. Then most operations could be done ⍢$. But then again, how often do you really need to manipulate the value of strings using primitives?
 
12:49 PM
yep its not fixed point
more of repeat n times
 
@Razetime Maybe have a look at lesson 35.
 
RGS
@Razetime that'd be (f⍣n)⍵ or ⍺(f⍣n)⍵
 
@Razetime ^ is lesson 34.
 
@Adám depends on the use-case. For things dealing with actual text (i.e. website, database), probably ±never, for text generation or parsing (e.g. HTML, SVG), probably always
 
@dzaima For text generation, it'd probably mostly be concatenation, which would be +. For manipulation, you'd use ⍢$ and for lookups and comparisons etc. you'd use ⍥$.
 
12:52 PM
ok I got it
but it's still not clear hwo to do it for the problem
 
RGS
@Razetime what pieces have you put together? in pseudo-code or prose or wtv
 
I need ⍺(f⍣⍵)⍳⍵
 
@Adám using ⍢$ and ⍥$ literally everywhere is annoying though, i'd assume most would switch to chararrs throughout all manipulations and stringify only on the final output
 
RGS
@Razetime notice Bubbler repeats n-1 times, and probably so will you
 
12:55 PM
@Jonah Here's the last time it was requested that I know of. Roger is opposed, but he doesn't develop J any more. It's now supported in Dyalog 18.0 (⍸⍣¯1) and BQN.
 
RGS
If you have n people, you will only strikeout n-1
 
@dzaima You'd just wrap the entire algorithm in ⍥$ or ⍢$.
 
@Adám so you'd wrap each individual function (assuming thing done is complicated enough to warrant multiple functions) in effectively boilerplate
 
@RGS ah yep
 
@dzaima $ing only on output still seems better to me. Easier to remember what types functions take, and as a bonus you don't have boilerplate
 
RGS
1:00 PM
@Razetime I have a basic train. I am no code golf genius and from what I've seen you are smart, so I'm sure you can get smth similar to (or better than) what I have
 
@RGS still haven't gotten very familiar with trains
also I'm reading the thing adam gave
 
RGS
@Razetime notice that f∘h is a train :) in my case, f is actually f⍣g so my solution is of the form f⍣g∘h (-- not saying this is the best or only way to go about it!)
yeah go ahead, I can try to help if you have any questions... and there's plenty of capable ppl here to back me up :P
 
@rak1507 It's freezing, is that what you mean?
 
I mean the 'cannot exit while fixing a class' stuff
 
1:09 PM
 
the page just freezes here
 
ah
 
@Razetime there's 128kb of text there
 
oh nice
 
1:24 PM
({1↓⍺⌽⍵}⍣{1=≢⍵})⍳
I tried this
but it gives me a rank error
 
RGS
@Razetime it "works" for me, albeit not returning the correct result
did you assign it to a function? or use it in-line?
 
assigned to a function
 
RGS
if you assign to a function, you may want to have ({1↓⍺⌽⍵}⍣{1=≢⍵})∘⍳
recall that ⍺ (fg) ⍵ is f ⍺ g ⍵
 
@Razetime you want {1=≢⍺}
 
RGS
so your ⍳ was getting fed ⍺ and ⍵, not just ⍵
finally, what dzaima said ^
 
1:26 PM
yep fixed that
 
RGS
in f⍣g, g's left argument is the most recent computation and g's right argument is the previous one
 
@dzaima but then you get to the extremely annoying fact that f⍣g executes f at least once
 
it was expectiong a 0 indexed k
@RGS yep just read that and fixd it lol
in ({1↓⍺⌽⍵}⍣{1=≢⍺})∘⍳ how do I add 1 to the left arg?
 
@Razetime also you don't need the parentheses
 
cool
 
RGS
1:31 PM
@Razetime operators bind from the left, so that f[op]g[op]h is equivalent to (f[op]g)[op]h
 
@Razetime i don't think there's an easy way to do exactly that, but there's a way to fix it at the cost of 1 char anyways
 
@dzaima how does it work?
 
@Razetime no "APL magic", just using a property of what you want to achieve sneaked in
 
I know that
what did you do?
 
@Razetime you don't want to try to find it?
 
1:35 PM
nope
 
@Razetime … 1↓¯1↓
 
ah my answer was wrong
 
2:09 PM
@rak1507 It is a bug in the hacky way TIO is set up with 17.1. 18.0 has better script support.
 
2:30 PM
@dzaima (maybe @EliasMårtenson?) Think I've figured out a decent module system for BQN. It can be extended to a full namespace system (probably even OOP as well), but can also be statically expanded into list creation and assignment by the compiler so it doesn't require any runtime support.
is the "namespace export" character, and a block that contains it at the top level returns a namespace. It can be used in place of definition like a⇐3, or alone like a‿b‿c⇐ as a complete statement. In the second case the exported variables have to be declared elsewhere. I think it should also be allowed at the beginning of a header, which mostly be redundant but guards against removing the last export and having the block's behavior change wildly.
In the restricted version I'm defining now, can only be used in immediate blocks, and at the top level in a file (which behaves just like an immediate block). This means it's always evaluated exactly once—you can't conditionally export a variable. Such a block or file import can only be used in a destructuring assignment, and not in any other way, so that the namespace can't leak out as a value.
 
@Marshall so namespaces are first-class objects?
Hmm, your second sentence suggests that they are, but are not accessible to user programs?
 
@EliasMårtenson No, because of the restrictions I'm adding, but if these restrictions are lifted then they would be first class. This frees implementations to choose to support just the basics and avoid the implementation costs, or have full namespaces.
 
@Marshall so no way of having a math module and using math.Sin without spilling Sin into a scope as a variable?
 
@Marshall Do you have some example code showing the behaviour? It would make it easier to full understand your suggestion.
 
@dzaima oh, that restricted version doesn't really even have .
 
2:43 PM
@EliasMårtenson Here's one that exports three values from a block.
The general form for the target destructuring assignment is like a list, except that each element can be followed by a : and a name. With a :, the thing on the left is the target used on the outside, and the name on the right matches the exported name. Without one, only a single name is allowed and it's used inside and outside. If there are no :s, using strand notation for the whole thing is fine but probably confusing.
But the target has to be some kind of list: you can't just assign the whole thing a name in the restricted version.
 
@Marshall Thanks for the links. Interesting discussion.
 
I guess a file import would be something like •Import "file.bqn" although it's a little weird because •Import wouldn't act like a true function (in the restricted version). It has to be called (that is, it can't be an operand, list element, etc.) and the result has to be used in destructuring assignment.
There should be some kind of mechanism to indicate whether a file import needs to be reevaluated or an old copy can be used. Either two different •Import functions, or a declaration in the file itself.
 
Announcement: BAA Webinar in a few minutes: "The Seats in the House of Representatives" Zoom: 858 532 665 Passcode: 100000(×/⊤)1920 12 17
 
@Marshall i'd probably make 𝕨 of •Import be a list of arguments to pass, which, if given, forces re-evaluation (otherwise reuse should be fine)
@Marshall wouldn't the file name need to be constant too, for the compiler to be able to desugar the namespace access?
 
3:00 PM
@dzaima That sounds good. The arguments would go into •args I guess. And 𝕨 doesn't really have to be a list, right?
 
@Marshall right, it doesn't (but then it strays even further from commandline arguments which must be a vector of char vectors, so the two should probably be separated)
 
@dzaima If the compiler's being called again when you actually import the file, then you can tell it what names you want to get out so it can return a list of those values. The receiver just needs to destructure that list, which is the same regardless of where it comes from.
@dzaima Sounds like a limitation of what arguments the shell can pass rather than what BQN can handle.
 
@Marshall ah, okay
@Marshall i mean, yeah, it is exactly that. (i'm not saying it should be restricted to a vector, but more that it shouldn't be encouraged)
 
@dzaima Okay, that's pretty much my position as well.
 
@Marshall "it should also be allowed at the beginning of a header" - does "it" there refer to the single character , i.e. ⇐v: being the full header?
 
3:10 PM
@dzaima That's right.
 
@dzaima though some way for the file to say whether or not it takes arguments would be nice
 
@dzaima Isn't a comment at the top describing the arguments good enough? It could also say if you should pass in a dummy argument (I would use @) to keep state from getting corrupted.
 
@dzaima actually, the restricted version means that the •Import caller cannot mutate the state of the cached return (assuming the functions don't mutate themselves). Should the namespace be cloned for each invocation otherwise?
@Marshall what about a F←{b+↩1} being inserted in that?
 
@dzaima (Needs a function header for F) Variables are exported by value when the block finishes. If you want to export something that can be changed it needs to be an operation.
Or from the namespace perspective I guess it's more accurate to say that destructuring is what pulls out the values. Namespaces themselves should be mutable.
 
@Marshall makes sense - so a namespace is really a (mutable?) dictionary, completely separate from the closure
(heh, ⟨a:b ⋄ c0‿c1:c ⋄ d⟩ is equivalent to {a⇐b ⋄ c0‿c1⇐c ⋄ d⇐} with some assumptions about variable scoping, with the bonus of being able to evaluate things in the middle)
 
3:24 PM
@dzaima I would say the namespace is exactly the closure except that only certain names are exposed. Mutation from the inside works the same as a closure, but I don't know what the semantics would be for mutation from the outside.
The differences between a namespace block and a block that returns a dictionary are that the namespace is mutable and its keys have to be symbols. Symbols are definitely not a subset of strings because they are case- and underscore-invariant.
@dzaima But the unbonus of not being able to access previously-defined members.
 
@Marshall {a⇐1 ⋄ b⇐a} should work, no?
@Marshall but mutating the namespace never modifies the corresponding closure and vice versa, unless i've misunderstood something
 
@dzaima Oh, I had your bonus the wrong way around. I think I meant nearly the same thing you did (that is, ⟨a:1 ⋄ b:a⟩ doesn't work).
 
i did write it the wrong way around didn't i
 
@dzaima Changing the closure should change the namespace, but it can't change which names are exported, only their values. I don't know how changing the namespace should work.
 
so either closures store name→index pairs, or namespaces do that
@Marshall you could say that the symbols are all-lowercase, no-underscore strings, in which case symbols are a subset of strings
 
3:37 PM
@dzaima Depends on whether you want to support , I guess.
 
@dzaima (but strings would be pretty weird as a superset of symbols)
@Marshall i mean, it has to be done if namespaces are first-class objects and you can access items by name arbitrarily (and you don't want overhead for each variable in each closure/namespace of the name)
 
@dzaima I meant whether it's the closure or the namespace that stores the table. I agree one of them has to with first-class namespaces, or even (performant) reusable scripts.
And can't really act like a namespace because it also needs to expose the names in scopes above it.
 
@Marshall ah, i stated the two options because they're functionally equivalent ( can't define new variables anyways)
@dzaima wait it can? :|
@dzaima i guess i never made it execute in a fresh namespace
 
On the other hand... with restricted namespaces it makes no sense to export variables from enclosing scopes because the namespace has to be destructured in the scope above it, which already has access to those variables. With general namespaces you might want to extend to allow that though.
 
3:53 PM
how different, if at all, would first class namespaces and dictionaries be?
 
@dzaima Isn't this the question I answered above?
 
@Marshall i was considering making that a reply to that, but i guess it actually mostly answers that question. i was more wondering whether there'd be any common syntax or logic, or would they be kept entirely separate
 
@dzaima I definitely don't think you can unify them, which is the main reason I've been hesitant to support either one.
 
(i was thinking of wanting a mutable hashmap-style object of arbitrary BQN object keys→values, but i guess "mutable" there is sort of not needed in practice (but does mean an implementation wanting any write efficiency over a keys→values pair must refcount))
 
For algorithms I think you usually want it to be immutable with refcounting.
 
4:03 PM
and i guess for the cases where you want mutability, creating a namespace/closure of it to avoid refcount≥2 and all operations on it from it works
@dzaima (actually "and all operations on it from it" isn't needed)
 
RGS
4:17 PM
In the windows IDE under Action I only see "Interrupt". Does the interpreter automatically perform the weakest interrupt that works?
Also, the docs say ⎕DL can be stopped with a strong interrupt, but doing ⎕DL 1000 in RIDE and then Action > Weak Interrupt also interrupts it...
 
@RGS We should fix that.
@RGS No, for a strong interrupt, do systray icon→Strong Interrupt.
 
RGS
@Adám ah ok so the Windows IDE only performs weak interrupts?
 
@RGS Yeah, if you need a strong one, the IDE GUI probably isn't responsive anyway.
 
RGS
also, both strong and weak interrupts give me the possibility of resuming function execution?
except that weak interrupt stops at the end of a statement and strong interrupt stops as soon as it cans (and then execution will have to repeat the statement I stopped at)?
Because I read their description and I thought the strong interrupt would just tear the function execution apart, but that is not what happened in RIDE when I tried it, so maybe I misunderstood
 
Yes.
 
RGS
4:24 PM
ah
 
@RGS Logged as issue 18563
 
RGS
@Adám ty. it goes without saying that in the windows IDE same happens if I do action > interrupt, right? :)
 
hey guys
I'm doing an assignment on organizational structures
I need to analyze 3 orgs
So I wanna write about dyalog for one of them
where can I chat about this?
 
4:58 PM
@Razetime Here is fine, but do you want an interview with one of our CxOs?
 
5:14 PM
@Adám This isn't a big project, just need to write about 2 pages for each company.
I'll just chat here.
 
@RGS RIDE is erratic when it comes to interrupts (at least on the Mac). I find that if I'm sending output to the screen with ⎕← especially, no matter which interrupt you try, it keeps on uninterrupted.
 
@xpqz Ah, that's probably because the interrupt only affects the interpreter. If it has already sent output back to RIDE, it is V8 that needs the interrupt.
 
with {⎕←⍵}⍣{0}1 & a strong interrupt i get in a state where RIDE has stopped outputting, no interrupts do anything and the dyalog process is continuing using CPU
 
RGS
5:31 PM
@xpqz I did read that neither weak nor strong interrupts can stop a primitive, so probably that ⎕← is trying to finish outputting everything before actually giving you back control of the ide
 
5:58 PM
@Marshall shouldn't the start be ⟨a:alias, b, c:c0‿c1⟩?
 
@dzaima Yes, I think that makes more sense.
 
@dzaima Can you email support@ about that?
 
6:19 PM
@Adám sure; seems ]rows on causes this
 
6:53 PM
@dzaima Added import/export to the grammar spec. Changes are kind of scattered; search for .
 
@Marshall just started working on the impl too. kind of stuck deciding on how best to handle namespace returning on the bytecode side
 
@dzaima I think you just mark all the exported variables compile-time, and then have an instruction to return the current scope as a namespace?
 
@Marshall the problem is marking which locals to export
 
Assuming you want first-class namespaces. I'm not going to add them (yet) and will just build and destructure a list with the required values.
@dzaima Needs an extra per-function mask, I guess.
 
as i don't want to add another "section" to the compilable stuff, i'm currently thinking about a RETD (annoyingly my RETN already takes up "return namespace", maybe best to rename it?), which returns a namespace from local vars with indexes objs[N] (objs being the list of constants), but that wouldn't work on vms which don't know variable names
@Marshall and also a variable name list (for non-mine vms)
@dzaima i guess the alternative of having both the names and indexes in the constant isn't too bad
 
7:09 PM
@dzaima I'd say just to make the name and mask fields for a block optional and generate them for namespace blocks and blocks that (deeply) contain . Any VM that supports a namespace creation instruction should be able to read those fields.
 
@Marshall why would matter here?
 
@dzaima It needs to know variable names, but not the mask field. Sorry, stated that wrong.
 
my already existing optional 5th per-block element (a list of per-body wanted arity for whenever headers need to be •compiled) makes that a bit of a mess, but i guess it's fine
@dzaima though i'd need to reorder it to allow for the variable name list to be optional
@dzaima oh but i still need the variable count even when the names aren't required
 
7:25 PM
@dzaima Use a "none" value instead of depending on list length.
@dzaima Or that.
@dzaima You could also allow SETH to take · as assignment target for 𝕨, meaning it must not be there, right?
 
@Marshall a header of 𝕨𝕊𝕩 must become a somewhat stupid LOCO 0 2; LOCM 0 2; SETH to force-require though
@Marshall also that'd require something funky to allow •Comp to make a mutable · constant
@dzaima though i guess there's no syntax for that
 
@dzaima Okay, I did forget that it's hard to just push ·. 𝕨𝕊𝕩 just means no requirements, so I'm not sure what you mean there.
 
@Marshall yeah, realized that ∧∧
(what'd a header of (𝕨)𝕊𝕩: be?)
 
@dzaima Syntax error. headW doesn't allow parens around 𝕨.
Special names can only be used as normal identifiers in the BODY section; in the header they have a precise syntax.
 
@Marshall yeah, i didn't bother with that and my header syntax is precisely assignment left arg syntax
@dzaima (+ some basic sanity checking; it's pretty much a bug that this happens)
 
7:39 PM
@dzaima Well my BQN properly rejects any illegal header syntax.
 
@Marshall :D
 
7:52 PM
a strange thing is that the export mask should really be per-body, though it'd only be there for single-body cases
@dzaima though actually i guess nothing prevents it to be on 2 out of 3 headers of a modifier with first-class namespaces, other than that being a pretty stupid thing to do
 
@dzaima The list of variable names is really per-body too though.
 
@Marshall it already is (in the 5-item-per-block version)
@dzaima (example)
@dzaima so the idea is to add an optional 6th element (there, ⟨1‿0,0‿1⟩, for exporting a or c & d)
 
8:08 PM
@dzaima Kind of inconsistent that blocks are like a list-of-structs but bodies are more like a struct-of-lists. Maybe bodies could be moved to one big list with functions pointing into that?
A given block could even have two body lists, one for monadic and one dyadic (with ambivalent bodies in both).
 
@Marshall that ±had to be done to keep compatibility with what your compiler made, i would have probably made bodies be a list of structs too (which would be less array-y, but probably fine enough)
@Marshall but i do like that idea
 
@dzaima It's really easy to rearrange things now with the dc.bqn layer, so if you decide to do that just let me know how the format changes and I'll pick it up.
 
now the question is do i kill that string constant thing and just use chararr object constants for VAR_ while at this
@dzaima (the answer is yes)
(btw i'd like for DGenFn to come back, i.e. query the argument to •Comp without evaluating; but i'm probably the only one needing it, so a local change works)
 
8:25 PM
@dzaima Pretty small change though. I've just pushed it, with the name DCompile.
 
should the big body list be a struct-of-lists or list-of-structs?
 
@dzaima I'd say list-of-structs just to match blocks.
 
(i'm in the middle of like 3 refactorings but my (albeit very limited) tests still pass :D)
@dzaima (for some reason i just thought about that again - the try catch wrapping added 30-50ns per call, and i wrap each body evaluation in a try catch, potentially totaling a reasonable slowdown)
 
RGS
8:59 PM
 
I thought the day would never come!
 
04:00 - 21:0021:00 - 22:00

« first day (1352 days earlier)      last day (1285 days later) »