« first day (1370 days earlier)      last day (1268 days later) » 

9:13 AM
powershell BQN; I fixed "table" so it was doing (hopefully) the right kind of array concat, table and scan so the inner functions close over the outer function parameter, then traced with a daft mistake so it wasn't generating a range at all, still popping an empty stack
just narrowed it down to ... the bytecode says (approximately) pop an empty stack.
in JS instruction 3 is `zn=num();let a=s.splice(s.length-zn);s.push(list(a))` and if zn gets 0, it splices nothing off the stack and pushes an empty list.
In my stack pop version it always tried to pop *something* in case 3 because I hadn't realised it might need to handle pop/push zero things.
it's not until ≢ ↩ IsArray◶⟨⟩‿≢ ⊘ (1-Match) in the runtime that an empty list appears
still can't build the runtime, but it's another inch closer. now churns through 7500 instructions before crashing on, apparently, passing the stack itself into + and doing s+1. Which might mean it's screwing up the environment, or it's another reasonable thing to do in JavaScript where []+1 is "1"
 
@Adám I ended up with ⍵⌷⍨⊃⍒(⊃⍺),⊖2-/⊖⍺. I don't fully understand how your version works; I can see what this results in:
2-⍨/0,12 23 36 46 62
but what is being commuted here?
nfc how that works.
 
@xpqz reads to me like a 2-window minus-commute reduce. (12 - 0) (23 - 12) (36 - 23) (46 - 36) (62 - 46)
 
@xpqz - is being commuted. Compare:
      2,/'abcdef'
┌──┬──┬──┬──┬──┐
│ab│bc│cd│de│ef│
└──┴──┴──┴──┴──┘
      2,⍨/'abcdef'
┌──┬──┬──┬──┬──┐
│ba│cb│dc│ed│fe│
└──┴──┴──┴──┴──┘
 
9:29 AM
oh man I had no idea you could do that
 
Btw, N f⍨/ is the same as ¯N f/ for N≤2 although that isn't so for N≥3.
@xpqz Try ⍵⌷⍨⊃⍒¯2-/0,⍺
 
So it does
Looking at it now it is obvious: 2-window reduction of commuted minus.
 
 
1 hour later…
10:45 AM
@dzaima mostly finished now, but still have to decide what to do with this
@dzaima if i were to box them, i'd have to add some information about that in the box, otherwise it can be ambiguous (and i definitely want strings to be printed as strings)
 
11:14 AM
@dzaima hm, this is an option, as the merging boxes otherwise always have at least one axis, and always guarantee that their contents are a matrix
 
11:35 AM
@TessellatingHeckler do you know where in the source it apparently does that? because it definitely shouldn't be
 
 
1 hour later…
12:51 PM
@dzaima Logged as 18596
 
1:04 PM
This is slow for an input vector containing ~16k integers 0-9:
{1↓⊖{10|⍺+⍵}\(⊖⍵),0} input
What can I do to make it better/faster?
 
@xpqz don't use scan with a custom function operand. makes it O(n^2)
 
@xpqz Just {1↓⊖10|+\(⊖⍵),0} if precision isn't an issue.
 
w-o-w
holy handgranade that flies
why is that so much faster?
 
@xpqz see {⎕←10|⍺+⍵}\⍳20
 
+\ has special code (which includes cheating by reordering things if the argument is floating point).
 
1:11 PM
\ is purely stupid and useless with a dfn operand
 
Ok, thanks -- I shall remember that lesson.
 
@dzaima this actually works kind of nicely
 
1:49 PM
Thanks to you, I implemented monadic ⍸ as well as ⍳ with array arguments.
Where "you" is whoever was online last night :-)
 
@EliasMårtenson does your only work on a boolean vector, or any numeric vector?
 
Any number ≥0
 
cool
 
Negative values are treated as 0, and non-numeric values gives an error.
@dzaima I followed Dyalogs documentation at first which says it's an error to give non-boolean arguments. However, I decided to try and realised what it does so I implemented it that way.
So this must be a recent change?
 
@EliasMårtenson 18.0
 
1:52 PM
Oh wait... 17 isn't the latest version. :-)
 
@EliasMårtenson also you should probably not copy the behavior that (⍳n)≡⍳,n
also ⍳⍬ is a valid operation
@dzaima (it's what backwards-compatible impls do because ⍳,2 was allowed way before ⍳2 2 was)
 
@EliasMårtenson Why treat negative values as zero? If the user wants ⍸0⌈x, which isn't very common, they should write that out themselves.
 
2:08 PM
@EliasMårtenson Why not simply ⍸←{(,⍵)/,⍳⍴⍵} ?
 
@dzaima Wait, thick double boxes for flat arrays? That's really confusing.
 
@Marshall thick - i've thought about swapping the thick & thin lines, but haven't made up my mind; double - i prefer separate layers to the N empty line spacing thing. also has the side-effect of reducing vertical space taken up
 
@dzaima Hmm, I did copy that behaviour. Rather blindly I must say.
 
On the other hand, I see now that my strategy for rank>2 character arrays is ambiguous, so I guess I have to do something about that.
 
@Marshall heh. (fwiw the first formatting update i made was a string formatter with the spacing (but no box) because i thought it was "the least bad")
 
2:18 PM
I think I just want a character at the top left of each 2-cell (mirroring the double quote), but I have to figure out what looks intuitive.
˙ is probably fine.
 
@Marshall you could also quote each layer
 
@dzaima I don't like this because it looks like there's something fundamentally different about 2-cells. Like the rows in a 2-cell are connected together but the 2-cells in the array aren't.
My first attempt puts a dot in front of every line that isn't for spacing, which is also interesting.
 
inverted looks good; but then the vector case has the think lines, which i don't particularly like
https://dzaima.github.io/paste#03VfNTsJAEL7vU0x60ltpUTl4kT/F/1fwTbBNOKiJREpoAgmJPwkGb3DTxATfpE/i7G673W23/kEJSIaw8@3udL9vppMFAKyg@c6/T1dBq1sigXcTtO4CrynZi@qitXGdQ5dKkBbh6xwTCnyAVoQtPgjnLLDF3DbsyHOeFM3XIkSFuE1TiE9A5hrybd5faPlqKXPWrY7KUUtc5W7slUEQNGp1UNhDpWqIWdg/MLL4ayWIVRjoDvymAx9J1oG/ZNE4lFicnCZYHB1LLM7O/8rC0x14qgNZRmkShwOax9kIsHyLmNkihrllKb1UbZJCfgWidWj@TXyGiQ82kKNLnYLsWLJjMweVcvFMD5qI3eu5QGpjDO0W5DMlXkJIQTyxaTDEaUBgH7YI65dmUzhlntvQqYReYpPymqYhnnBXl28/f7WsfNUCRS1Q1AKtWg6UJYlFR2BOtVZfQ4ntFZQYFI
 
2:35 PM
@dzaima I hate thinking.
 
@dzaima an alternative would be dashed lines for the merging arrays, but, that's, like, complicated and weird..
@Marshall well, they're less connected. how much the "less" is, though, depends.
 
3:32 PM
Does Dyalog have a special optimisation for +/⍳10000000? It's instantaneous while the equivalent {⍺+⍵}/⍳10000000 is incredibly slow.
 
@EliasMårtenson it's just that fast
dzaima/APL, which definitely doesn't have any optimizations for it, still takes 25ms to execute +/⍳10000000
(well, +/ is special-cased in both, but that's to be expected, otherwise Dyalog couldn't use vector instructions to compute it)
 
Perhaps I should rephrase then :-) Why is the version with a user function so much slower?
The fast version makes me sad, since although I do have some ideas that could speed KAP up by a few times (plus parallelisation) but I'll never get to milliseconds.
 
@EliasMårtenson because 1) +/ is fast; 2) calling dfns is slow (you have to parse it every time, you have to allocate a separate number object to pass to it whereas +/ can just act on a flat list of integers)
 
@dzaima So I guess Dyalog has some special-case for pure-integer arrays and such things?
Then one doesn't have generic code to access the elements.
 
⍳N (with N>2*16 but N<2*31) in Dyalog creates a 32-bit integer array (i.e. IntArray in kotlin), and +/ on that is a very optimized simple loop over that
@EliasMårtenson yeah, Dyalog has separate types for 1-bit, 8-bit, 16-bit and 32-bit integer arrays, along with 64-bit doubles, 128-bit doubles/complex numbers
dzaima/APL only has a special double array type (well, there's also a bit boolean array but that's unrelated; dzaima/BQN also adds an 32-bit int array type)
 
3:48 PM
I've considered doing the same, but getting access optimised will be harder since I use lazy evaluation.
However, there are other opportunities, like optimising a lazy expression at runtime.
 
@EliasMårtenson yeah, lazy evaluation kind of breaks on optimized array types
 
It's not going to be nearly as efficient as specialised arrays though.
 
4:33 PM
@EliasMårtenson Here's the talk on optimizing reductions.
 
5:02 PM
@Marshall Thank you for that.
 
@dzaima It's working now. I was optimizing by putting all the formatted elements into a flat array. Obviously that doesn't work here.
 
 
2 hours later…
6:39 PM
@dzaima is +/⍳N not special-cased to 2÷N×N+1 ?
@dzaima "p: 3106; counter 7513; state: 17; stack count: 3" in the compiled current r.bqn ("new runtime"); I haven't tried to dig into that yet
(p being bytecode position, counter being global number of times through the instruction loop)
 
6:51 PM
@TessellatingHeckler i don't think so, it starts slowing down with bigger values of N
@TessellatingHeckler could you post the latest source? i've managed to get powershell on linux
@dzaima also this clearly shows a linear increase in time taken
 
7:12 PM
@dzaima maybe it's not a common enough thing for the benefits to be worth the effort.
@dzaima latest source - I haven't been testing it in PS v7 or on Linux, so it might not do anything
 
7:27 PM
@TessellatingHeckler it's also good as a showcase of APL performance, and the benefits are definitely very tiny
@TessellatingHeckler doesn't even start
 
@dzaima oops, I commented out the tests at the end before pasting and missed commenting a couple of trailing } think the gist is updated now
 
still fails rather quickly :/
https://dzaima.github.io/paste/#0pZXdbtMwFMfv@xRHVbU1UpXWSdp8VFwBF5NAIMEd4sJ1vSUssY3t7LOdeBoejCfBcVnrbPMGwldN8tNR/@d3bIsC0BIIb5mmElAaL0FprGkBM/uLnO8@mueBKCB22cTLoo6du@zcy0Ydm7rswsvGHZu7bOplk45FvXCZF55buJcu98ILC7vxspkXTi3s5suQF84s7AbMIi@cd3DkBsz89pDVF7kJs2f8WYFRL@LBYP6QtgqjhUsvXqqdubTf4q52PHNpv0ZkBySOXNrvEdkRiROHzv0ikZ2R2E2Z@00iOySxmzL3q0R2ShI3Zf6MSzsmiZsyf8alnZOkl/LgMn64G2eDE3aB62r9QVCJdcVZAdOSN3S6vsFVg6dvOGkbyrSaSszWvJkKtfrOQqFQkaSDdxWjsBkAJClsAH79@AmjGxaEp1xSTMrbyUiFgotxsA2WX7CU@PprUUh6QaWi4xEOlt33VpXj8dGorpQG8y7Ybm0lU9WsDfzHuuvWfZ3PJQV6JSRVysQEfNo15/joGCrzAK
 
@dzaima I dunno what's up with that, those should be global variables everything can see. Try running it with . ./psbqn.ps1 (dot space path-to-file)
 
@TessellatingHeckler ah, that indeed makes more things happen
yep, fails at counter 7513
 
that sounds like it.
 
7:39 PM
Behold, the pinnacle of error-handling technology.
 
the only place I use a generic stack type is $s = [System.Collections.Generic.Stack[psobject]]::new() # Stack; how is that getting into the environment?? Looks like it happens at instruction 7509 instruction 21 get environment variable $e[0][1] and push it, it's a stack.
 
{(n k)←↓2 pco ⍵ ⋄ ×/(n-1)×(n*(k-1))} Is there a way to simplify this?
(Fast euler totient)
(Which would make a good aplcart entry imo)
 
@TessellatingHeckler seems it fails on the 12th invocation of +. The 12th invocation in the JS version calls it with both args being 0
 
More importantly, yesterday I changed the tokenizer to output source code positions of tokens. If the compiler can output token positions of instructions, then runtime errors can be located in the source.
@TessellatingHeckler A single quote only closes another single quote if it comes exactly two characters later.
 
7:41 PM
@Marshall character literals? ahh, PS doesn't have them, ' and " are both string; trips me up in C#
 
@TessellatingHeckler Yes. Although having a closing quote at all is a little silly.
 
@dzaima oh, the bytecode of both differ
 
@dzaima this is old-JS-vm-with-new-runtime hybrid, I don't have an equivalent JS to compare like for like. That drove me back to the old runtime for a while.
 
@dzaima copied the bytecode of the js version to PS, and still breaks on the 12th +
 
@dzaima seems like dzaima/bqn doesn't treat # as a comment line unless there's a space after it; is that deliberate?
 
7:50 PM
@TessellatingHeckler no; i don't seem to be able to reproduce that either
 
...
and neither can I now
ffs
ok, sorry, n/m. that drove me back to using the old runtime and JS to compare on Saturday, now it's not a thing.
 
@rak1507 Uh:
      ]runtime -c "{(n k)←↓2 pco ⍵ ⋄ ×/(n-1)×(n*(k-1))}100" "(+/1=⊢∨⍳)100"

  {(n k)←↓2 pco ⍵ ⋄ ×/(n-1)×(n*(k-1))}100 → 8.7E¯5 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  (+/1=⊢∨⍳)100                            → 7.7E¯6 | -92% ⎕⎕⎕⎕
 
@Adám uh
 
^
 
Aha, so we need the longer version for ⍵>1000
 
7:57 PM
@Adám but 0.01ms avg for <1000 isn't that bad
 
Even still, it's still a bit slow, is there any other clever way of calculating the totient I've not thought about?
Maybe using 3 pco
 
@rak1507 (n*(k-1))n*k-1
 
True
 
{×/⊃{(⍺-1)×⍺*⍵-1}/↓2 pco ⍵} is a bit shorter, but possibly also much more unclear
 
I'm not really going for code golf here
Is it any faster?
 
8:02 PM
@rak1507 shouldn't be
 
@rak1507 How about ×/⍤-∘≠⍨3∘pco ?
 
That's great
Definitely deserves an aplcart entry imo
      ]runtime -c '(×/⍤-∘≠⍨3∘pco)¨⍳10000' '{(n k)←↓2 pco ⍵ ⋄ ×/(n-1)×(n*(k-1))}¨⍳10000' '(+/1=⊢∨⍳)¨⍳10000'

  (×/⍤-∘≠⍨3∘pco)¨⍳10000                       → 1.2E¯1 |     0% ⎕⎕
  {(n k)←↓2 pco ⍵ ⋄ ×/(n-1)×(n*(k-1))}¨⍳10000 → 1.5E¯1 |   +29% ⎕⎕⎕
  (+/1=⊢∨⍳)¨⍳10000                            → 2.1E0  | +1654% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
Which spelling do we prefer, ×/⍤-∘≠⍨3∘pco or (×/⊢-≠)3∘pco ?
 
Second one is clearer to me, I've not compared their speeds
Thanks
 
@Adám definitely the second one
 
8:09 PM
Is there an even faster way that is capable of producing the totients up to [insert large number here] without using ¨?
Maybe some memoisation, because totient(pq) = totient(p)×totient(q)
(When p and q are coprime)
 
8:21 PM
@rak1507 Done.
 
Nice, thanks
 
I still think it'd be neat if ×/⍣¯1 gave prime factors. As an Easter egg.
 
Haha yeah that would be fun
What if {⍵[⍋⍵]}⍣¯1 shuffled an array as well
 
@Adám NARS2000 does that
 
@rak1507 But ?⍨∘≢⊃¨⊂ is much shorter.
 
8:25 PM
But it's also less fun :(
 
@dzaima Ooh, I've never looked at what NARS2000 manages to invert.
 
@dzaima OK, mostly a subset of Dyalog's. ×/⍣¯1 is nice, and so is +∘÷/⍣¯1 but can someone explain its dyadic form?
 
ngn
@rak1507 yes
 
to what
 
ngn
8:31 PM
@rak1507 there is a faster method of calculating totients up to n
 
I'll have a look
What's the difference between dfns.factors and 3 dfns.pco? Why would you use one over the other?
 
@rak1507 I suspect factors predates pco as the latter has many clever tricks up its sleeve, while factors is a simple sieve.
 
factors seems faster than pco in the few tests I've done
 
Yeah, I've found that pco is quite slow for small numbers. Probably a huge overhead due to the massive code.
3pco 1e6    → 1.9E¯5 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
factors 1e6 → 1.5E¯5 | -25% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
3pco 1e7    → 2.2E¯5 |  0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
factors 1e7 → 2.0E¯5 | -7% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
3pco 1e8    → 2.7E¯5 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
factors 1e8 → 4.0E¯5 | +49% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
Ah, interesting
Thanks
 
8:48 PM
So, should I add another totient entry for ⍵>1e7 ‽
 
Maybe ngn has some clever idea for a faster method, in which case, maybe, but it's quite obscure so it depends how much use it would get
Besides, I came up with a cleverer way of doing the problem that didn't even involve calculating totients at all
 
ngn
@rak1507 this line, if you can read k6. basically, start with an array of 0..n, go through each prime p and update every p-th entry multiplying it by (p-1)÷p
 
I can't read k6 but that makes sense
Wait, are those solutions to project euler?
 
ngn
@rak1507 yes, 1..100
 
cool, didn't know you did them
 
ngn
9:03 PM
good you can't read k6, otherwise they would be spoilers :)
 
I wouldn't cheat anyway
The only time I've ever looked up a solution is when I was accidentally pasting in ¯something instead of -something, I had the right answer but wasted hours
 
ngn
@rak1507 that's what i thought too, until i reached the one with pell's equation. how many have you solved so far?
 
A whole 34, not really done many so far
I thought q11 was particularly fun, used ⌺ for it
 
ngn
@rak1507 yeah, that's one way of doing it
 
9:18 PM
@TessellatingHeckler found an issue - in cases (10,19) you do &$call $f $s $w - that $s should be $x
 
@dzaima good spot, thanks! Marshall spotted a similar careless mistake in and after that I went looking at all the &$call locations for similar mistakes, and still missed it(?!)
 
also you sometimes check for existence without comparing to $null, but 0 is falsy. could that cause issues?
@dzaima (seems "sometimes" was once, and it didn't change anything)
 
@dzaima Yes it probably could; if($w) that won't trigger on 0
 
@dzaima adding a proper null check in makes it fail faster ¯\_(ツ)_/¯
@dzaima also an empty array is falsy, so checking for sh must be done properly too
 
9:37 PM
just gone through every if adding $null-ne to them; including , and fixing that call value, it doesn't fail faster, it runs to 8966 for me
 
@TessellatingHeckler without it, it ran to ~9200 for me
 
@dzaima checking for .sh kinda has to be $id.psobject.properties.Item('sh') not $x.sh because if x is an array, PowerShell may unroll it and look for .sh as a property of every item in the array and return an array of true/false as the result. Should probably change that in IsArray and = to match up
now gets to ~9286 maybe that's where you were seeing it break
 
@TessellatingHeckler probably different, that got to 9263, failing with "Indices in 𝕨 must be integers"
 
The size limit on dfns.pco never fails to annoy me
 
@dzaima sounds like the same error message; if it's the assert failing, I imagine it's asserting where $x=0 and the assert scriptblock needs $null -eq $x instead of !$x.
 
9:47 PM
@TessellatingHeckler no, the assert needs to actually check that 𝕩 is 0 (well, not equal to 1, but whatever)
i.e. in BQN "abc"!1 does nothing, whereas "abc"!0 assert-errors
 
@dzaima which assert now? I mean line 3
 
@TessellatingHeckler BQN assert, aka !
 
@dzaima ok; may as well swap that from $x-eq1 to 1-eq$x as well, constants are better on the left for various reasons. (current code with those changes, runs to ~12,400)
 
ah right, i am also using a different runtime version (as it's what i've got a formatted version of), that definitely changes some of the specific instruction counts; regardless, that works up to 12385 for me (stopping on $r=$r -as [psobject] with "You cannot call a method on a null-valued expression.")
@dzaima that's called from
 
@dzaima same stopping point/error as I have now. Sounds like $r is $null there
 
9:58 PM
@dzaima it tells that in the logs :|; but no, 𝕩 seems to be some System.Object[]
 
hrm, just before that it goes into case 16, pops $f off the stack which is ≢ and $x off the stack which is (1,2) but is not a BQN array with .sh, so making a & $list $x.sh tries to make a BQN array of $null
 
@dzaima it is failing on the first here; not sure if that gives me anything though :|
 
@dzaima how did you trace that error back to code?
 
10:13 PM
looked at ↓ at +10546 (the position of my error), "LOCO 0 2" is 𝕨, next is invoked ≢, so ≢𝕨, which is only in a couple places in the source
https://dzaima.github.io/paste/#0lL1Lry5Jdp431684rokHDcEZtxVrlSEDdTsyAZKHaEozD1zuPuwuu7uKqKoWzKEnBEnJMGhBkAe2BgIJUPBAEwEa@DJo/RP@Av8EZz6597czLl@u6ALRbFSvnV9kvJFxeWLFG@/erf7zs@9@/vHTf3D8t@34j59s/@X@3/7@z//XcPyb9@@28BL35fs//PJdIJB/9ZO4B4Y9MB7/Rt5t2/F/@z@//@GLP9iftREaCS17aHx95udvv/3HX/2TPyQsESYvTzwes331FvZHH/7ojwnLhNWuhPFawkhgIdDGEoZLCc@XkSMyRK@ElbDklVAJy10J07WEiUAjUC4l3IsX8uvz/ukf/9fv4vbpu7//q//tCA8b4fpSyvTy3Hx9biYwIM0hYnotgL6V88MfxS8Ji4SFsYLipYKoy5AIzU
@dzaima (seems URL is broken..)
@dzaima gist
@dzaima (fwiw i didn't update the string constants there when changing the runtime, so it's probably somewhat broken. but good enough for testing)
 
10:51 PM
@TessellatingHeckler also why the , for returning at case 25?
 
@dzaima "throw spaghetti at the wall and see what sticks" coding methodology. It's very popular. Consider function test { @(1) }; $x = test; $x.gettype() and see that you expect the test function to return an array, but actually it returns an int32. In the case where it returns an array of many things, it still gets unpacked/rerolled/and effectively shallow cloned.
The workaround for this is to roll it up into a nested array with , then as it gets unrolled, you only lose the workaround wrapper, and not the inner structure
if a BQN array came off the stack with a .sh property, got unrolled/rerolled, it would be a powershell array with no .sh property. (This might be happening somewhere).
(The reason behind this is, PowerShell is a shell first, programming language second. If you did PS C:\> $userNames | foreach-object { mkdir $_ } and it sent the entire array down the pipeline and tried to make one folder with all the names mashed into it, that would be useless. So it unrolls the array and sends the contents down the pipeline one at a time).
 
@TessellatingHeckler oh, that might indeed be happening
i've been seeing weird things with debug-printing, the object not being equally printed in different places
but why. powershell is weird
 
11:09 PM
@dzaima apparently because that's what Bash does, and they wanted it to be that kind of shell. If you run PS C:\> get-content file.txt | grep pattern and then you run PS C:\> function test {get-content file.txt}; test | grep pattern you want them to behave the same, and not the first one to feed individual lines into grep, and the second one to feed an array into grep. They make more sense as shell functions that behave like batch-scripted-shell-commands than as normal functions
it's not ... the best language ever, lol
for the same reason, return is a misdirection, it doesn't control the output of a function at all, only the control flow. Any expression result that isn't captured ends up in the output stream, so you don't have to write function test { return (get-content file.txt) }
 
11:24 PM
@TessellatingHeckler this is some weird behavior
@dzaima oh, there's a difference between "$x" and "$($x)" ಠ_ಠ
 
@dzaima I'm guessing that's the same unrolling effect; maybe there's a nested array on the stack?
PS C:\> $x=1,0; $y=@(,@(1,0)); "$x $y $($y)"
1 0 System.Object[] 1 0
 
@TessellatingHeckler no, just formatting
 
@dzaima yeah, I bet the sub-shell $() is unrolling the outer array and losing the nesting
i don't know exactly where it will/won't happen
 
also:
https://dzaima.github.io/paste/#0dVHLjtNAELz7K1q7I3Ys/MAhiZCtHFbLIuUAWeCEoghN7DY2sWeGmTE4WEFc@Q0OfNh@Ce1kUThAXVxyl2q6qgFGDOx9WEs@C5K5fxhYuWA20kpzP2P9mdclZ32Uq066UMiCuLZq@xFzF2mjNBpXo42WDlt@Zasr3x@@mNphWCnr4KISNrTVRXbI4C@M5p2tOH/EctE0wEpgPf33/cNJcAm5sAiz9PRN5unQoFv3QbkBWNjI6qbOkYcTP3uwGn14GfSjSbY1KHbZwVtHUbTxdArJk9l0nsExBRpIJk@fzTKopXWGhjSxTuS70zyFiXda27v/8TOZwtu9pXTR6hh6vYEwBO@d6mg1KZWDYwIBLbpKFaAkcdk1TfhZNB0WgL02aG2tZORdO4gr1WJcfBV1K@LnKu9alM7GhqpVbazt9pOkgpOUNoa8EiadTL3HwIQxsIBBCyNazkzAbOUDkQUzEAoL6z9H2fjn@9yd73NdFBzuv/8ir//g2z9A6hvh8IMy@6Us1VmcwlJSvrpY0QPCUbgUeOrDehPAnTAU6UZJJ6jgW2
but i should go sleep
 
you're gonna love this, but everything has a .Count, even scalars, even $null (.Count is 0 though so falsey)
 
11:36 PM
@TessellatingHeckler it was just for it to not error before the actual error
 
@dzaima oooohkay, that's weird
I see it fail at instruction 12409, and back at 12346 is a call to "Is 1 0 -- " (IsArray) and it's not a .sh BQN array there, so it's going into some wrong codebranch after that at least. before that at 12343 it's loaded from instruction 21, environment e[0][2]. Wish there was a backtracking undo debugger.
 

« first day (1370 days earlier)      last day (1268 days later) »