« first day (1373 days earlier)      last day (1264 days later) » 

1:55 AM
<sxmx> Thanks for the input all
 
 
3 hours later…
4:41 AM
{10↑⌽(⊂∘⍋⌷⊢)⌽{(⊂⍺,':'),⊂≢⍵}⌸{⍵/⍨⍵∊⎕D,¯1⎕C⎕A}¯1⎕C⍵}
problem is, i need to right align the right column
 
5:25 AM
How to right align: reverse each row, mix() to left align, then reverse the matrix horizontally
 
5:52 AM
if I have ,(⊢∘.,∘.,⍨)'abcde' to generate all triple combinations of 'aaa', 'aab', ... 'eee' is there a way to remove the double outer product?
∘.,⍨⍣2 makes quads not triples, so I'm thinking no, but wouldn't surprise me if there is
 
∘.,⍣2⍨
 
@Bubbler oh that's nice!
 
∘.,⍣2⍨ y → y(∘.,⍣2)y → y∘.,y∘.,y
Compare it to (∘.,⍨⍣2)y → ∘.,⍨∘.,⍨y → ∘.,⍨y∘.,y → (y∘.,y)∘.,y∘.,y
 
@Bubbler which y is the one in the middle...
@Bubbler that expansion makes sense, indeed
 
6:25 AM
@Bubbler So, ⊖↑⌽?
 
@Razetime Nope, ⌽↑⌽¨
That is, when you have nested list of rows without blanks on the right side
 
oh ok
 
If you have a column of numbers, right-align on a number column is actually free:
      g←{10↑⌽(⊂∘⍋⌷⊢)⌽{(⊂⍺,':'),⊂≢⍵}⌸{⍵/⍨⍵∊⎕D,¯1⎕C⎕A}¯1⎕C⍵}
      ∊⍤1 g (?26⍴100)/⎕A
v:  3
f:  5
j:  6
x:  7
p: 11
l: 14
g: 19
b: 25
c: 28
k: 33
Or...
      g←{10↑⌽(⊂∘⍋⌷⊢)⌽{⍺':',≢⍵}⌸{⍵/⍨⍵∊⎕D,¯1⎕C⎕A}¯1⎕C⍵}
      g (?26⍴100)/⎕A
o:  5
w:  6
h:  7
t: 15
j: 21
y: 23
b: 26
a: 29
n: 36
g: 37
@Razetime Do you see what's going on?
 
6:42 AM
yep make sense
 
 
2 hours later…
9:10 AM
@EliasMårtenson Is there an outer product in KAP?
 
@rak1507 ∘.f does exist and works just like in Dyalog
 
Ah, maybe ∘.f⍨ doesn't work for some reason
 
@rak1507 yeah, it seems broken
 
Outer product seems a bit buggy anyway
 
@rak1507 how so?
 
9:19 AM
1 ∘., 2
Error: Index out of bounds: Reading index 0 from scalar
Unless that's intentional
 
Does it give the same error for 1 ∘.+ 2?
 
@rak1507 that's probably a bug (along with -¨4)
 
yes
 
That's definitely a bug - outer product between two scalars should give a scalar, according to shape arithmetic ⍬,⍬ → ⍬
 
@EliasMårtenson fwiw i think it'd make sense to make valueAt(p: Int) return the simple scalar itself when p==0
 
ngn
10:04 AM
@dzaima or even for any p, to facilitate scalar extension
 
@ngn that'd then need to be for any scalar, not just simple ones, which then introduces a penalty on all arrays which could possibly be scalars
(my valueAt equivalent (Value get(int i);) doesn't error for any argument on some scalars, and i have abused that)
 
 
3 hours later…
1:09 PM
It's time to announce BQNcrate ⊔˜. Like APLcart, for when you would rather have BQN.
I'll be translating more entries from APLcart over time. After removing the system and dfns stuff, there are about a thousand left. Some of them are pretty long and could take a while, though.
 
@Marshall nice.
 
 
2 hours later…
3:04 PM
@Marshall A crate of bacon sounds like a lot
 
 
1 hour later…
4:16 PM
@RikedyP Hopefully it can live up to its namesake.
 
 
3 hours later…
@JeffZeitlin The feed bot should report it shortly too.
 
@JeffZeitlin I'm thinking that should be doable with =⍤1 1 ?
nope, but maybe ≡⍤1 1
 
0
Q: Finding matching rows

August KarlstromGiven two matrices A and B with the same number of columns I would like to know if there are any rows which are the same in A and B. In Dyalog APL I can use the function split like this: (↓A) ∊ ↓B Is there a way to calculate the same result without the split function?

 
7:48 PM
@JeffZeitlin Answered. Thanks!
 
8:16 PM
@TessellatingHeckler The compiler now produces source indices for bytes (per-opcode might make more sense, but per-byte is much easier). You can enable them in cjs.bqn by passing a -i flag before any other arguments.
I'll see if I can get the JS runtime to use them for error messages; it's trivial for a bytecode interpreter but a little harder for a transpiler since it doesn't naturally have access to the current bytecode index. It needs to produce code that sets a source index.
 
@Marshall That's interesting! I've done a git pull and cjs.bqn -i r and the output looks the same, where do the source indexes appear / what do they look like?
 
@TessellatingHeckler There should be four lines, with the last as the list of indices.
 
@Marshall right right, more clear in vim than in less, I see them. So if the first one is 35 that says "first bytecode comes from source[35]"?
 
@TessellatingHeckler Yes. Although for r.bqn the relevant source is actually the output from pr.bqn and not r.bqn itself. You can get that source by sticking •←ref at the end of pr.bqn and running it.
It's probably not too hard to build a back-translation to indices in r.bqn. E_proc and E_redef would have to return the length of each character in the output instead of actually doing the substitution.
 
8:35 PM
using the indices info for dzaima/BQN errors:
https://dzaima.github.io/paste/#0vVPLSsNAFN3PV1y7k17bmaoLgxZq0qKgba26LdS0SrBNNMaFqOBCah@K1geCIPWJioJLF6KL@ifzBX6Cd2x1oQU3xSRnTu7NuXdmzhAAkPVbQ5dbe4buFBasfE5WN42UilPLtqzfgSzuKQ29yo2L0cKC43q@QCBIz5zlBYcn4sGsGZhZtH0MAIyUb/X99OjOL8tXitf7fGzUNh3XzZlexJ1birqu42owu2ybnuXYQDowM/l8LgsFx85kLRWsUCs/9uDbMb49oawWUZZOUG5XCCVcw8YDJW4ItziIYZTlMxyi8YpwTTgnXKCsXBKIr6ms9Eq5HZTFGuEAIRaJCMDGPTaeqecLyp0yBmmsEvapbJdQU7JhkhHpTTKaFCWSlUPsUlv@40pDJy81YfeSlzHnWa/G6ED0xHjSUu59Ocoaj3/f7MchsdZCiTkHHlJTJacnRyCkgfrIY8CFShqxuAGCMoK3VhSLi4SKB1pxKjoVZ@Gw6P/sJGAsoSeAf9Y0E1@thaYOv0
 
@dzaima That was fast.
 
@Marshall not much i had to do - just create a new token type and write the indices in
(the bytecode is there (with a weird pointer) because the source of the full created blocks is null, and i report both the containing block and specific pointer. though probably a bytecode pointer just pointing at the start of the function is pointless)
 
where is the compiler code, is it cjs c from c.bqn? I can't build it, and currently fails trying to [math]::floor() a function, might be able to track back from here to the code
 
@TessellatingHeckler ./cjs.bqn -i c works for me. If you override your runtime with its result, doing lastLine[errorOffset] should give you the index of the error in c.bqn (that's assuming the error isn't in the runtime, at which point it gets a lot more complicated; getting a full stacktrace of all the offsets would also be helpful)
 
9:46 PM
Damn it, gradually increasing the order of magnitude approaching a project euler problem, ⍳9 works, tried ⍳10, ws full! :(
 
@rak1507 What size workspace do you use?
 
Default
 
@rak1507 You know you can increase it?
 
It feels like cheating, especially when I use terrible inefficient code
 
:-)
 
9:49 PM
The fact it stops it from working feels fair
@EliasMårtenson Does KAP have an equivalent to ↓?
 
@rak1507 exists as-is
 
Hmm, didn't seem to work for me (then again, maybe pasting dyalog stuff into KAP and expecting it to work first time is not that great an idea)
 
CMP: Have you ever needed monadic on an array of rank>2?
 
Also, when I type ↓ into the prompt, pressing enter doesn't seem to do anything (which is weird)
@Adám I actually was going to use that today (rank 3), before I decided to fiddle around with ⌿[2]
Maybe it was /[2], can't remember
 
@dzaima (though it requires (≢⍺)≡≢⍴⍵ and errors on ∨/⍺≥⍴⍵)
 
9:55 PM
@rak1507 Is it still so that it does "nothing" on error?
@rak1507 They are the same.
 
⍸{∧/∧/2=⌿[2]{⍵[⍋⍵]}⍤1⊢10⊥⍣¯1⍤0⊢⍵×⍤0 1⍳6}{⍵+10*1+⌊10⍟⍵}⍳100000
It was this horrible bit of code here
 
⎕IO?
 
1
 
Doesn't KAP use 0 only?
 
Oh yeah, true, shouldn't make a difference for my issue
Not being able to type ↓ and press enter is weird
 
9:57 PM
Many implementations don't have 10⊥⍣¯1
@rak1507 Look in the console. Errors are reported there.
 
@rak1507 doesn't seem any different from just + and enter
 
"An operation is not implemented: One-argument drop is only supported for 1-dimensional arrays"
Yeah
:(
 
@rak1507 Try ⊂⍤
 
ah, monadic
@Adám no
 
Oh. Maybe ⊂[ax]
 
10:00 PM
Seems there's no ≢ either
 
Monadic or dyadic? (or both?)
 
@Adám it's probably the most common built-in i've used in common with rank>2 arrays :p
 
Monadic, dyadic seems to exist
I can probably get away with using ⍴
 
@dzaima What for?
 
@Adám to not have rank>2 arrays
 
10:01 PM
@rak1507 monadic is simply ⊃1,⍨⍴
 
Yeah
 
@dzaima Sure, but didn't you need ⊂⍤¯1 then?
 
Value [object Object] is not a numeric value (type=array)
 
@Adám more complicated to type/remember. ↑¨↓↓ ftw
 
Well that is inconvenient
Oh it's because ⍤ doesn't exist
 
10:03 PM
(hard refresh if you don't see a stack trace)
 
@dzaima Ah, so you didn't actually need but ⊂⍤¯1
 
@Marshall nice
 
@Marshall Neat.
 
1 2 3 ⌽ 3 3 ⍴ ⍳9 doesn't work in KAP, dyadic ⌽ doesn't seem implemented for array left arguments (maybe?), any workarounds?
 
@Adám yeah, but that's because is stupid, not because I don't need
 
10:06 PM
@dzaima Well, yes, it should have been ⊂⍤¯1
@rak1507 Of course, that calls for but you can split (!) do an each, then mix.
 
@Adám but you can't split
 
Exactly what I thought of, until I realised monadic ↓ isn't a thing either
 
Didn't ⊂[ax] work?
 
@Adám nope
 
↑1 2 3 ⌽¨,/ 3 3 ⍴ ⍳9 then.
 
10:08 PM
Nope
That doesn't work either
 
@Adám
 
@dzaima Yeah, I just realised.
 
and that does work
 
A nested APL without ⊂[ax] and without is severely handicapped.
 
@Adám yay for dzaima/APL!
 
10:10 PM
Well, maybe everything can be done with crazy combos of ,/ and ⊂¨ and ⊃¨ and mix.
 
All I need is lazy evaluation!!! :(((
 
@dzaima (and it still has the stupid so it's the worst it could be)
 
Maybe I should actually come up with a better algorithm that doesn't need a 3.6 million item array
 
@rak1507 an array of what?
 
Where each item is a vector of 10 items
 
10:12 PM
!
 
ah, nested array. still, 36M items + 3.6M vectors is imo low enough for holding in ram
 
Maybe not in 256 MB only
 
@rak1507 Of what kinds of items?
 
numbers
 
What kinds of numbers?
 
10:13 PM
pretty small numbers, although I don't know if dyalog differentiates
ints from 0 to 10
 
@rak1507 It does: 1-bit, 1-byte, 2-byte, and 4-byte ints, 8-byte and 16-byte floats.
 
Should fit in 1 byte then
 
@rak1507 still should roughly fit, unless you copy the array
 
Takes 201 600 032 bytes
 
I have a ¨↓ in my code, I'll try refactoring it a bit
 
10:15 PM
@Adám huh, that's a lot more overhead than i expected
 
@dzaima Because it is nested. 3.6 M pocket headers…
↑a takes 36 000 040 bytes.
 
@Adám dzaima/APL takes only 100MB, and that's including all of Javas overhead (it already takes 40MB on a fresh REPL)
 
@dzaima You don't have a fixed header size, do you?
 
@dzaima actually i'm fairly certain that cannot be correct
yep, i'm stupid, forgot an ಠ______ಠ
650mb. that's more correct
 
Oh, that's a lot more than Dyalog.
 
10:21 PM
well, they are all 8-byte doubles
 
There goes my hopes of using dzaima APL for this
 
@rak1507 well, by default it'll happily use all your RAM :p
 
@dzaima That still only takes 432 000 032 in Dyalog.
 
Maybe this bruteforce won't work and I'll have to actually think about this :(
 
@dzaima How much space do and ⊂⍬ take?
 
10:24 PM
yeah. 288mb being the minimum, there's ~100B avg waste per vector in dzaima/APL and 80B in Dyalog
@Adám can't say precisely, but 1e7⍴⊂⍬ takes 600MB and 1e7⍴⊂⊂⍬ takes 1GB
 
vs 400 and 720
 
@dzaima (fwiw 1e7⍴⊂⍬ being 40MB (well, 41.1MB) suggests that java is using 4-byte pointers)
 
@dzaima Wait, then you can't address more than 4 GB‽
 
@Adám 32GB IIRC, based on the fact that object pointers otherwise would always end with a couple 0 bits
@dzaima (note that in my test for that was an empty DoubleArr, each with its own new double[0])
 
Ah, OK, but still very limited. It'd be a total waste on a machine with 128 GB RAM.
 
10:36 PM
@Adám it can be switched off. probably does that itself on systems with >32gb ram
 
10:50 PM
@Adám {2,/,()}¨⍳1e7 takes 441mb (2,/,() being the first way i found to create a fresh EmptyArr without other overhead)
 
@dzaima ()?
 
@Adám empty namespace, i.e. simple scalar with a prototype of null
though {2,/⍮1}¨⍳1e7 also works and also gives 441MB (as the prototype is a constant static variable)
 
@dzaima Is that not the same as 1e7⍴⊂0⍴⊂2⍴0?
 
@Adám 0⍴⊂2⍴0 is a SingleItemArr not an EmptyArr; and 1e7⍴⊂X is a SingleItemArr too, so the whole expression only takes a couple hundred bytes. Forcing proper efficient duplication of all the s is the hard part
(remember that ⊢¨1e7⍴⊂⍳1e6 takes "only" 50MB as ⍳1e6 isn't duplicated, so why would in ⊢¨1e7⍴⊂⍬ be?)
 

« first day (1373 days earlier)      last day (1264 days later) »