« first day (1261 days earlier)      last day (1394 days later) » 

12:25 AM
@dzaima Yes, the 1 disappears from the shape somehow! BQN is supposed to be immune to this stuff. Do you have any idea what's causing it?
 
@Marshall ah, it's my fault :|
 
@dzaima I'd been slowly approaching the same conclusion. Looks like it might be one of those bugs where the fix makes the code simpler, though.
 
ah, i'm comparing item amounts not ranks for deciding which side to extend
 
And also that line has too many vowels in it.
 
12:43 AM
yay (with as a temporary try-catch and •RAND as APLs ?)
 
I settled on for try-catch, except that I'm not sure it should be an operator at all. It would be hard to catch errors in value blocks or operators. So there should at least be some kind of block-based version.
 
@Marshall when there's some syntax for throwing an error, an equivalent header would kind of make sense
 
@dzaima I think ! is good enough (it should also allow a left argument giving the error message though).
 
@Marshall still as an assert?
 
@dzaima Yes.
 
12:57 AM
so you intend to have no separation in errors?
 
@dzaima No. Don't use errors unless someone is doing something wrong. I get that typed exceptions are sometimes helpful but I think they're too complicated for BQN.
 
@Marshall i wouldn't say typed exceptions are helpful (or even useful), but they're still nice to have. I guess catching based on the message could still work though
 
 
4 hours later…
5:20 AM
@RGS You can always just ask, and I'll answer when I can.
 
@Adám Just found that and handle high-rank left arg in a different way ( takes vectors over the last axis; does over the first). Is that intended?
 
5:41 AM
@Bubbler Intentional? Yes; all the APLs I have access to agree.
@Bubbler is defined in terms of outer product, so its left argument relates to the leading axes. is defined in terms of inner product, so its left argument has to be transposed.
 
@Adám I guessed so, but how is it an outer product?
 
@Bubbler The APL2 documentation excels at having formal definitions for primitives: and .
(Maybe we should include those on APL Wiki.)
 
5:58 AM
Oh, wow.
 
6:24 AM
@Adám I think I found an alternative model without any enclosure
 
@Bubbler APL2 routinely uses enclosures to reorder things, but any way, not quite the same on non-integers.
 
Huh.
 
7:02 AM
@Adám A new version roughly equals the built-in , but the floating-point error is really big
 
RGS
7:13 AM
@Adám thanks, I know. But I wanted something more interactive. I'll come and trouble you in a bit, for now I'll just give you context. I was solving the problem of, given some numbers and a target value N, determine if and how N can be made with the input numbers and the four arithmetic operations, assuming each input number has to be used exactly once.
 
OK.
 
@RGS If brute force is allowed, one way would be to generate all possible parenthesis insertions, all possible permutations of numbers, and all possible selections of +-×÷, then outer product, eval each, filter the expressions that yield N.
 
RGS
@Bubbler brute force is allowed and I sort of did that, but because my command of array-oriented programming is limited, I used some recursion. The recursion is on the amount of available numbers. If I still have 2 or more numbers available, I generate all combinations of picking two of them up and combining them with the operators and collect the results. Then I recurse.
At the same time I also kept a string representation of how I got to that point, with the expressions in prefix order so I didn't have to bother with ()
 
7:36 AM
I'd generate the parentheses like this. In the case of four numbers, there are 5 ways to parenthesize the entire expression:
(((x?x)?x)?x)
((x?(x?x))?x)
((x?x)?(x?x))
(x?((x?x)?x))
(x?(x?(x?x)))
Each placement can be encoded with before which number each ( appears, like 111 112 113 122 123.
It shouldn't be too hard to generate and filter the ( placements, and then derive the indexes of (, ), x, ?.
Then combine the four using e.g. @ and then it.
 
8:05 AM
@Adám Looks like 7th and 9th entries here are somewhat wrong (the former should have 1+ and optionally at the far left; the latter has wrong ¨ in the description)
 
@Bubbler You're right about the 7th, but I don't see the issue with the 9th.
However, it should be Jv and not Yv.
 
8:24 AM
Oh, I guess I misread the description.
 
RGS
8:48 AM
Ok @Adám so like I said I am using recursion to solve the problem I mentioned. What I don't appreciate much is this function (which is doing most of the work):
Combine←{
    ⍝ Recursive dyadic function combining the numbers ⍵ which have been obtained by the expressions ⍺
    ⎕DIV←1
    ⍺←⍕¨¨⍵ ⍝ default string representations of input numbers
    1=l←≢⊃⍵: ⍺ ⍵  ⍝ if no more numbers to combine, return
    U←{ ⍝ unpack pairs of nested results
        ⊃{(wl wr)←⍵ ⋄ (al ar)←⍺ ⋄ (al,wl)(ar,wr)}/⍵
    }
    C ← {
        ⍝ Combine two numbers of ⍵ with the dyadic function in ⍺
        (r v) ← ⍵
        (li ri) ← ↓⍉idx⌿⍨sub← ≠v[idx]
        newv ← v[li] (⍎⍺) v[ri]
Use it like Combine ⊂3 4 5, there is one outer function who calls this combine and then filters the return result by the value we actually care about
The job of this Combine is to combine any two available numbers with any of the four arithmetic operations, in a string in the third-to-last line.
And I guess it kind of bothers me that I have to use a string when I really want to "iterate" over a set of functions
but oh well, now that this is working I guess this is more suitable for a code review question, no?
 
I guess so.
 
@RGS I was just about to suggest that :)
 
RGS
yeah so can you move this to the trash, please? :P
 
No reason to. Others can learn from your thoughts.
 
RGS
Oh ok then. Will post the code review now ○/
 
RGS
9:20 AM
@Adám If they do, they might also want to follow-up with reading this
@Adám in the doc page about Edit Object there is an extra "are" in "Objects specified in nms that cannot be edited are silently ignored. Objects qualified with a namespace path are (e.g. a.b.c.foo) are silently ignored if the namespace does not exist."
(last sentence of the page)
 
0
Q: Solving the game of 24 recursively in APL

RGSThe "game of 24" as I called it in the title is a maths game in which you are given four numbers and have to combine them in an expression using only the four basic arithmetic operations +, -, × and ÷ (and possibly using parenthesis) to achieve the final result of 24. You must use each digit exac...

 
@RGS Thanks. Fixed.
 
RGS
@Adám np but the fix doesn't show online yet, or should it?
 
@RGS No, it has been fixed in the source, but we only update the online docs every once in a while.
 
RGS
@Adám understood ○/
 
 
1 hour later…
10:43 AM
@Bubbler Done.
 
RGS
11:38 AM
@Adám say I created a file with )ed ⍟GameOf24 and forgot to save it explicitly... but the file itself got fixed a bunch of times; is there a default location in which I can find my file?
(the interpreter -- in fact the whole computer -- was closed in the mean time)
 
11:49 AM
@RGS It only gets fixed into the workspace. If you don't save the workspace, and don't close the interpreter with )continue then it is lost.
 
RGS
@Adám alrighty... thank God I pasted it in the code review question :P
 
@RGS Btw, )ed doesn't create a file unless you have Link'ed the namespace.
 
RGS
@Adám perhaps a more correct sentence would've been "I opened an editor with )ed ⍟GameOf24"
@Adám +← 1 quite interesting but believe it or not I haven't gotten around to studying the proper ways of managing APL code and whatnot, so I am not sure that is what I want to do
 
@RGS The "proper" way is using Link, which would save to file whenever you close the editor.
 
 
2 hours later…
RGS
1:46 PM
@Nic @Adám can I solve this "permanently" in my computer by saving the file with the fix edited in? or should I expect a fix for this soon? or what is the best way of going about it?
 
2:32 PM
@RGS Due to various issues with 18.0, we are going to issue a new one when those have been addressed. You can replace the file meanwhile, but then the installer might not update the changed file, so you'd want to uninstall and clean up your install dir before installing.
Announcement: I'm giving a webinar on Features of Dyalog version 18.0 in Depth - Part 3 in half an hour.
 
RGS
@Adám I'm gonna miss it :'(
@Adám ok thanks
 
 
3 hours later…
RGS
5:31 PM
@Adám just got bitten by the fact that a b ← c works in the way that it shouldn't...
@Marshall been meaning to ask this, if not too personal: since you left Dyalog and are developing BQN, how are you going to make ends meet?
 
 
2 hours later…
7:41 PM
@RGS I do plan on finding work again at some point. I hope I haven't given too many people the impression that I plan to work on BQN full time in the long term, since it's not the case.
 
@RGS a or b a function?
 
@Marshall I also misunderstood! Where are you looking to work?
 
8:33 PM
@RGS What did you expect?
 
RGS
@Adám trying to type on my phone, misclicked. Can't recall the exact setting; I was producing a two element vector but then I had to save an intermediate value and so inserted a var ← to the left of it, but because I was referencing a variable right after that and didn't enclose this particular assignment, my code was interpreted as an unstructured assignment (or whatever it is called :/)
 
@RGS Ah, so you wanted a(b←c) but got (a b)←c?
 
RGS
@Adám exactly.
 
@RGS OK, but that wouldn't work anyway. We need the juxtapose function, then you'd write a⍮b←c
 
RGS
@Adám so something like a b ←c shouldn't work at all?
 
8:44 PM
@RGS Well, I'd say it should be allowed if a or b is a function.
 
RGS
@Marshall I was just curious :)
@Adám ah, if b is a function then it is modified assignment and if a is a function it just assigns to b?
 
@RGS Assigns to be and returns a c.
 
RGS
9:27 PM
@Adám yes, I meant the assignment part, then the rest of the code would execute as usual
 
Right. Maybe it'd be good to always be strict and require on pass-through values, and ∘⊢ on modifier functions? I mean, even in tradfns.
 
RGS
10:06 PM
@Adám what do you mean? "pass-through values and ∘⊢ on modifier functions"..?
 
@RGS If F is a function and a is a variable name, then never write F a←42 only F⊢a←42 and never write a F←42 only a F∘⊢←b
 
RGS
@Adám ah to make intentions more clear? I don't mind :)
 
 
1 hour later…
11:16 PM
I forgot to mention it yesterday -- I just completed the APL wiki pages for primitive functions (except the ones I can't really explain).
Now on to the real game, primitive operators...
 
@Bubbler Amazing job! (I added "see also" relationships to them all too.) You can't explain materialise? I added Range today.
 
@Adám Because I haven't ever had a chance to use it. Though of course I can copy paste the Dyalog docs.
 
@Bubbler It is really simple. Identical to except if the argument is an object with a default property, in which case it returns the value of the default property.
E.g. if the argument is a .NET collection, it'll return the list of elements. A bit like x=>[...x] in JavaScript.
 
So basically it tries to cast anything to an array?
 
Yes.
@Bubbler E.g.:
      ba←⎕NEW System.Collections.BitArray(⊂1 0 1 1 0)
      ⍬≡⍴ba
1
      ⍴⌷ba
5
 
11:50 PM
@Adám Done.
I found another example code in an old lesson, which helped to quickly finish it :)
 
Cool. Then we're only missing Range in Extended and dzaima, and .. in NARS2000.
They all agree on the basic definition scalar…scalar, but Extended and NARS2000 go beyond that in two different ways.
 

« first day (1261 days earlier)      last day (1394 days later) »