« first day (1410 days earlier)      last day (54 days later) » 

9:42 AM
I'm sure there's a bit twiddle solution to this.
 
 
3 hours later…
1:35 PM
12
Q: The tedious array of 7 rules

GravitonThe rundown Create a program that generates an array of random length with random numbers, then apply a series of rules that alter the array. After the rules have been applied, print the sum of the array unless specified otherwise Array setup The array must be a random length between 5 and 10 inc...

wrote a solution to this: Try it online!
any good golfs?
 
 
1 hour later…
2:43 PM
@rak1507 I was pretty pleased when I figured out quickly that it would be a base-2 thing (the 128 and 8 gave it away, to be fair) - yours is a much neater solution than mine though
 
Yeah, I'm seeing a lot of solutions online that use the searching method, personally I thought it was quite obvious especially considering the problem name was 'Binary Boarding'
 
 
2 hours later…
ngn
4:24 PM
@Razetime in rule2 you're missing the condition "If rule 1 is applied". what happened to rule5?
 
4:58 PM
@ngn oh I missed rule 5
makes it a lot longer
 
 
1 hour later…
5:59 PM
@ab5tract Very nice. Btw, you can get rid of the last each with (↑ThanksAnnDates),⍸AnnOnThursday
@xpqz myns⍎'stringval'
 
Having to use execute so much is one thing I'm still not 100% content with
 
@rak1507 I just finished a long-winded proposal for a non-/ (and thus safe) way to assign and retrieve values.
 
!!! amazing
 
Well, Morten wasn't too happy based on his initial impression, as he had envisioned something simpler than what I suggested. But he did admit that my scheme was very versatile.
 
6:15 PM
I guess the simplest thing from my point of view would be being able to use bracket indexing like in other languages
 
I'm pretty sure that won't happen. Bracket syntax is anomalous and at times ambiguous. A proper function approach is more viable.
 
What about a function that did the same thing
⌷ is annoying at times anyway
 
You can't use to extract values from a namespace anyway.
 
I know, I was just saying if there was some new function f added so that NS f values would look them up, it could also work like array[indices] / array ⌷⍨ ⊂indices
 
True. Geoff wanted that instead of . when that was added.
Fyi, Morten's idea was value namespace.⎕SET 'name' and namespace.⎕GET 'name' while mine is namespace ⎕NS 'name' value and namespace ⎕NG 'name'.
 
6:23 PM
How would those work for initialising a namespace from an array of keys and an array of values? Or something like that
I think I prefer yours in general, but I don't really like quad name functions very much
 
@rak1507 Good question. Morten's would need the namespace initialised separately, e.g. values (⎕NS⍬).⎕SET names for an anonymous namespace or values (⍎name⎕NS⍬).⎕SET names for a named one. Mine will create a new unnamed namespace if used monadically: ⎕NS↓⍉↑names values or ⎕NS(↑names)values and a string left argument will use a new or existing namespace with that name: name⎕NS↓⍉↑names values or name⎕NS(↑names)values.
Notice that mine takes either name-value pairs or a matrix of names and a vector of values.
 
Yours seems more APL-y
 
ngn
i would have expected value@(⊂'name')⊢namespace for "set" and namespace[⊂'name'] for "get"
 
Also, my ⎕WG allows name-value pairs (or name-matrix, value-vector) and will use the values as fallback if that named is undefined.
@ngn That's not bad at all, other than needing a function alternative to brackets.
 
What about array ⊇ indices or namespace ⊇ keys, ⊇ looks similar to ⊃ which is already used for indexing.. or something
 
6:33 PM
Uh, you've swapped the arguments, no?
 
Oh yeah, oops
 
I'm all for ⊇←⌷⍨∘⊃⍨⍤0 99 but the old guard doesn't think yet a way to index is at all needed… "We already have !"
 
We don't already have a nice way of looking up values from a namespace though, and if that was used, it would be a nice bonus to include functionality for indexing
 
True. Nice spin. I'll mention it.
This is one thing that bothers me most about APL. All the most fundamental and important primitives are the ones with severe issues: ⍳Y, X∊Y, X/Y, and X⌷Y.
 
What are the issues with them, other than the last?
 
6:37 PM
on a one-element vector treats it as a scalar.
ravels its right-argument.
/ wants to be an operator.
 
So would you prefer ⍳,5 was equal to ,¨⍳5?
 
Yes.
 
That does make sense
I hadn't thought about that before
What about ∊?
Oh I think I see what you mean, just checking the major cells?
 
Exactly. Like X⍳Y and ∪Y
should be ⊢∘≢≥⍳⍨ instead of (⊢∘≢≥⍳⍨)∘,
 
Yeah, it's always simple enough to use x∊,y for the old functionality
 
6:41 PM
Exactly.
X~Y has the same issue, to an extent, but we can luckily get around it by looking at the rank of the left argument, so there's hope.
 
@Adám still think it's less a "fundamental issue" but preference of using matrices for actual 2D things instead of as forcibly merged vectors
major cell logic is useful if your data is of equal type, but if you had columns of float, boolean, and string, there's no nice way of both storing each efficiently and easy way to do logic on all of them
 
@dzaima Right, that's when you want inverted tables.
 
 
3 hours later…
9:56 PM
Just realised something potentially good for golfing (in very niche situations), +.×⍨ is the same as ⌹⌹
 
@rak1507 Nice! Btw, +.× is commutative, so does nothing.
 
Oh, oops!
...Are you sure?
 
If the arguments are vectors, yes, as it is the same as +/×
 
Oh right, yeah, but if they're matrices, it isn't
 
True. One also has to watch out for edge cases: 1 2 3+.×0 0 0 is fine, but 1 2 3⌹⌹0 0 0 isn't.
 
10:10 PM
Yeah, true
 

« first day (1410 days earlier)      last day (54 days later) »