« first day (1276 days earlier)      last day (1379 days later) » 

12:41 AM
progress; left are inner blocks, ·-related things, ⍎, read/write •, and then deciding on what level do i want to integrate this (it'll be less debuggable, but as it'd probably be used for anything that needs to be fast, i can afford to make my interpreter more about debugging)
https://dzaima.github.io/paste/#0xRzLjtvI8a6vaMxcJOyAw36Q3dTEAbxje@OFvXBie4Fkd2BQGs5Ya5kUKMr2ZmEghyBINjnklhxzzT1AcguQ/ZP5knQ3H032g6Lkka3DDNVdXVVdr66uIgQAmHyXvImXIL753X9nN3/4K@T/Ax/c/Pn3gH/9J6wef/ob/4Lk83h885cfb/7497EXjG9@/M9nk8kEfPa/f/3075s//WMi0EhUIzrin9VmtlzMwXwZr9fg819@5V0nqQ@Sd0WSXq7B3SePvCLLlmvvyy@SdATA60Wa5eBNkq
 
1:02 AM
@dzaima Plain should be replaced with functions •in and •out, where •in has some argument saying how much you want to read (number of lines?).
 
1:14 AM
@Marshall i'll keep that in mind, but first i want to get it to work on the current things
 
2:09 AM
the Utf8 string constant thing in java class files.. doesn't actually encode the strings in utf-8. ಠ____ಠ
 
 
2 hours later…
4:02 AM
@dzaima yay
 
 
4 hours later…
8:24 AM
CMC: Given ⍺←0 or 1 and ⍵←any vector, remove the -th element from (0-based indexing).
 
@Bubbler ⍺ can only be ⍬ or 1?
 
@xpqz Zero or one, not zilde.
 
@Bubbler How about
(0@⍺⊢1⍴⍨≢⍵)/⍵
 
ngn
8:55 AM
@Bubbler @xpqz ↑,1↓↓
in k (k6 or earlier): _ with swapped args
 
9:16 AM
@ngn It feels like a small but significant victory that I managed to un-tacit that to
(⍺↑⍵),1↓⍺↓⍵
 
9:42 AM
CMC: Given an array, determine if it a "⎕OR".
 
ngn
@Adám {1⍬≡(≡⍵)(⍴⍵)}
 
@ngn I have 7.
 
ngn
@Adám 1≡≡∧⍬≡⍴
 
That's a nice one. I had 1≡⍥,≡,⍴
 
ngn
@Adám 1≡⍴⍴≡
 
9:51 AM
Real golf, super inefficient, but short.
 
RGS
10:19 AM
@xpqz a nice vector of 1s is =⍨⍵
 
RGS
10:31 AM
@Adám random idea for aplcart/quiz: allow to filter for estimated difficulty, e.g. easy/hard or easy/medium/hard; some descriptions already have words like "medium" and "hard" characterising the task so I figured this wouldn't be too difficult
 
10:42 AM
@RGS They all have a difficulty stated. And yes, I thought about having three buttons: [Next easy task], [Next medium task], [Next hard task].
 
@RGS Or maybe ~≡¨?
 
RGS
11:20 AM
@xpqz I believe that one might give an error
 
@RGS How so?
      ~≡¨1 2 3 4
┌→──────┐
│1 1 1 1│
└~──────┘
 
RGS
But I was being completely general; for your use case above ofc it works
 
@xpqz that only works on arrays of scalars. On those you can even do ≢¨
 
RGS
@RGS it even shows it can error of the rank of the things in the major cells is geq to 2
 
Interesting -- the way =⍨ drills into nested arrays I think means that ⍵/⍨0@⍺⊢=⍨⍵ wouldn't "do what I mean"
 
RGS
11:30 AM
But in the spirit of your approach I'd say 1⍨¨ is nicer, although one byte longer than ≢¨
 
ngn
11:50 AM
@xpqz no need for there. to support nested, it could be ⍵/⍨⍺≠⍳≢⍵.
 
 
1 hour later…
12:55 PM
 
@dzaima But note that I've deliberately computed large constants outside of functions, based on the assumption that dzaima/BQN doesn't have constant folding. I don't think this choice has any effect for DGenFn, but I moved rcp and or outside of Compile for example. There are more cases of this in md.bqn.
 
@Marshall oh, it doesn't touch variables, nor does it call any functions ever. (at least not until i do something about variables, i do want to have a non-hashmap variable system for when there are no s in sight)
it's just for array constants & derived primitives & trains
 
1:16 PM
@dzaima That probably shows up a lot more often actually. Would also be interesting to see inlining/expansion for primitive modifiers and trains.
@dzaima Would be nice to have the typical frame/index format for lexical variables so I can do the lexical scoping in the compiler.
 
@Marshall right, for the java-compiled version it'd probably be better than the regular operator tree walking
@Marshall how does what you have in mind handle accessing parent frame variables?
 
@dzaima That's what the frame number is for. I don't remember the details exactly; let me see if I can find a page on it somewhere...
 
@Marshall ah, so every load/store has 2 number args
 
@dzaima Yes.
 
1:36 PM
@dzaima hmm, is it correct to get whether hashmap variables must be used just by looking at if there's an in the body?
 
@dzaima Sounds right, to my surprise. And I guess if the variables are numbered then all you need is a list of names for them, which never has to be accessed outside of .
 
@dzaima (note that to be able to jump in the middle of the bytecode i need a jump per wanted location, so currently only jumping to start & after a RETN work)
 
Some literature on compiled lexical scoping.
That's probably harder than just making each scope have a pointer to its parent, which seems like the obvious solution but takes more time to access variables in enclosing scopes. You could also combine the frame and variable index into one by going to the next higher scope if the index is higher than the number of variables in the scopes viewed so far. Or you could keep a pointer to every enclosing scope so accesses are constant time.
 
2:00 PM
@Marshall i still plan to keep using my Scope objects which hold a pointer to their parent, just add an alternate variable storage & alternates for VARO/VARM
the case of accessing a variable 10 scopes up should be rare enough for me to not worry about it currently
 
@dzaima Probably best to do the single-index thing then.
 
i'll go with a parent count & index for now
(pushed the current changes)
 
 
2 hours later…
4:23 PM
I think i'll be switching to the block arguments (𝕨𝕩𝕗𝕘𝕊𝕣) being indexed variables, and the two systems can just live together (the hashmap system could even fall back to searching linearly trough the index system, e.g. if you )cs into an index-based function and want to make new variables or something)
 
4:33 PM
@dzaima or the hashmap system could be fully removed, and the indexed system just extends the table if that's needed. The variable resolution and slot allocation still happen at compile-time and so not be slow ever (except if you're compiling many things)
that'd have the side-effect that x←1 ⋄ {𝕊: ⍎"x←2" ⋄ x∾⍎"x"}0 gives 1‿2; that's just fine for the REPL, and easy enough to get around for code usage (just use )
the only needed change to the bytecode is that variables must now also store their depth, the strings could be kept around if that's desired
 
5:15 PM
@dzaima Not sure exactly what you're proposing but I would say the hashmap should just just be a map from variable name to slot index. I'd be inclined to say shouldn't be able to declare variables (more generally, only that's lexically inside a particular block, or headers, should be able to declare variables), but you could also make it add slots along with entries in the hashmap.
And of course there's nothing preventing you from storing a list of names initially and only turning it into a hash map when you feel like it.
 
@Marshall the thing with allowing in is that the REPL needs to be able to create new variables in an existing scope, and once that's possible, extending is trivial
the "easy" way of getting around s weirdness would be that it creates a new scope for itself, so any s aren't visible outside, but that's purely a restriction
 
 
1 hour later…
6:52 PM
c.bqn now compiles all but two lines of testref.bqn, about 5kB. Scaling looks linear.
 
@Marshall tests pass with the new variable system, though nothing's actually using it (variables stored in a Value[], names in a String[], and a HashMap<String, Integer> for lookup)
 
@dzaima Does it have a bytecode interface yet?
 
@Marshall not quite (and i'm still undecided on how exactly to handle 𝕨𝕗𝕊𝕣𝕘𝕩 as being able to write those without lookup would be nice)
 
@dzaima They should just be local variables with no names, right? The ordering's not obvious but maybe 𝕤𝕩𝕨𝕣𝕗𝕘.
So the number of special names is 0 for f, 2 for m, 3 for d plus 3 for non-immediate, and the index of a special name is its index in that overall order minus 3 for immediate.
   𝕤𝕩𝕨𝕣𝕗𝕘
f1 ······
f0 012···
m1 ···01·
m0 01234·
d1 ···012
d0 012345
 
7:17 PM
@Marshall that's nice; if ignoring immediate modifiers, a contiguous segment starting from 0 is used by them (allowing for actual variables immediately after), and writing doesn't need to care about what's the type written to, and the 3 potentially wasted slots for immediate operators is fine. (otherwise they would still be regular named variables, included in whatever will govern the variable information for •COMP)
 
@dzaima Given that by far the most common case should be referring to a variable by index, I'd say to do the extra index computation when accessing special names by string and save the 3 slots.
 
@Marshall i guess that's also an acceptable method. i was thinking header dispatching would make that more complicated, but headers don't actually care about the raw argument variables themselves
 
 
4 hours later…
11:13 PM
can someone enlighten me why: '1'≡⍕1 returns 0 and not 1?
 
@code_report '1' is a character scalar, but returns a vector
@code_report (,'1')≡⍕1
 
11:27 PM
@Moonchild thanks! that solved my problem (on to the next one)
 

« first day (1276 days earlier)      last day (1379 days later) »