« first day (803 days earlier)      last day (1865 days later) » 

8:24 AM
I think I have a fairly good golfed version of the Padovan sequence for this challenge: codegolf.stackexchange.com/questions/182797/…
⎕←2⌷{(2⌷2+/⍵),⍵}⍣6⊢1 1 0
 
@Sherlock9
4
 
Is there any way I could golf this further?
 
Ven
8:44 AM
@Sherlock9 1 1 0 is part of the bytecount?
 
Yep. It's the starting array
 
Ven
2+/ not easy to train-ize :(
 
9:01 AM
@Sherlock9 (),⍵⍵,⍨
 
Ven
⎕← 2⌷(2∘⌷∘(2∘+/),⊢)⍣6 ⍝ doesn't even work :-(
 
⎕←2⌷2(⊢,⍨2⌷+/)⍣6⊢1 1 0
 
@Adám
4
 
Ven
Oh.
Didn't realize ⍣ would quietly pass along its ⍺
 
9:39 AM
@Adám Oh much belated thanks!
 
@Sherlock9 Sorry, I should have pinged you.
 
I didn't see the first ping either, so that's alright :D
 
Is it just me, or do you sometimes wish there was a neat way to do A f A g A h B ?
 
It isn't just you
Darned if I have a good solution though. Or at least one that I'm sure won't have run into some language issue I don't yet know about
 
It would require a different and incompatible definition of trains.
Hm, actually…
(f g A h)B ←→ A f A g A h B but there's no obvious dyadic form of that.
And it isn't a very self-explanatory definition, nor is it nice that the left end of the train depends on the rightmost end.
 
Ven
10:18 AM
So f g h, except stacked? In which case do you need that one?
 
@Ven I'm not sure what you mean. (f g h)B is (f B) g (h b). (f g A h)B would be equivalent to A(⊣f⊣g h)B
 
Ven
Right. I meant that it'd be f(g(h..)) instead of g(f, h)
@Adám I wondered why @ doesn't pass its ⍺ to its ⍵⍵
 
@Ven What would it then pass if called monadically?
 
Ven
It wouldn't pass it then.
 
10:34 AM
@Ven I'm not sure (that we can ever find out, now that its author isn't with us any more). It does seem a bit odd to mix levels (main data vs replacement/modifier) like that, and forces writing ⍵⍵ to ignore left arg (just as annoying as with e.g. and ), but I can see the occasional use. Maybe if you think of @ as a special case of it makes more sense that it shouldn't pass in , as is really part of ⍺⍺ rather than a proper argument.
What do I mean by being a part of ⍺⍺? Note that A f@g B is exactly the same as A∘f@g B and A@g B is exactly the same as A∘⊣@g B so you can see that for @ isn't really a proper argument, but just an operand shorthand.
 
Ven
no I see what you mean
I'd just have a use for it sometimes.
 
@Ven It isn't hard to define or inline it when needed. APL isn't a golfing language.
 
Ven
Oh, for sure. I'm just sayin' I'd have a use for it when golfing
 
@ is a special case of in that A f@g B and A∘f@g B are the same as A∘f⍢{(,g ⍵)/,⍵}B but not the same as A f⍢{(,g ⍵)/,⍵}B which would be (,g A)/,A)f@g B so you can see here too that passing A into g makes no sense for and therefore no sense for @ either, the latter being a special case of the former.
 
Ven
(,g A)/,A)f@g B is probably missing a ( at the start
 
10:45 AM
@Ven Indeed.
What could be consistent, is that the A f⍢g B would supply the "opposite" argument as left argument to g, but then what would the inverse application look like‽
 
Ven
And honestly, in a non-golfing-related tangent, I sometimes would like a better idiom for (g A)/A
Well, f/⊢ is not select, so I can't write that.
 
@Ven That is idiomatic, although I tend to write A/⍨g A. Yeah, I know that a few people have wanted the "filter" operator {⍵⌿⍨⍺⍺ ⍵} but @arcfide argues fiercely that it constitutes unnecessary abstaction.
 
Ven
Right, "idiom" is not the right word for that. I just want a better way :).
 
@Ven Right, your real problem is not the lack of a filter operator, but rather that slashes are schizophrenic.
 
Ven
Yup, pretty much.
 
10:50 AM
@Ven I'm very confident that f⊢⍤⌿⊢ will work in 18.0 (although maybe not spelled like that). It isn't as neat as a dedicated primitive, but we'd need four of them, and you'll quickly learn to read ⊢⍤⌿ as "filters".
 
Ven
Explanation, please?
 
@Ven ⊢⍤⌿ is simply the function (as opposed to the possibly-but-actually-unfortunately-in-this-case-operator)
@Ven I'm proposing that is "overloaded" so that f⍤g means (f g) which cures schizophrenia because an operator cannot be an operand, so ⊢⍤/ forces / to be a function and (⊢ g) is the same as g so ⊢⍤/ is the function /
 
Ven
11:24 AM
Is J's " overloaded in some other way?
 
@Ven Yes, f"g means f applied with rank of whatever the built-in default rank of the g function is.
 
Ven
ah alright. Thank you.
 
@Ven But J already has "atop" as @ even though it doesn't have mentally ill primitives ;-) however, atop is essential in J because (f g)B isn't f g B and "dfns" are very awkward.
And K doesn't need "atop" because (f g h)B is f g h B
 
Ven
I remember little of the J I did, but I do remember dfns being a pain point
 
@Ven Yeah, I really like how dfns resemble a formalised inline version of the curly-left-brace in TMN.
 
12:19 PM
arthur whitney: "might be time to revive the rank operator." groups.google.com/d/msg/shaktidb/bAKz1ikMcjs/qYDV8DHaBwAJ
 
 
2 hours later…
ngn
1:52 PM
@Sherlock9 1 1 0 -> 3≠⍳3 (⎕io=1)
 
@ngn Grr, I was looking into something like that. How did I miss it‽
 
ngn
actually, can't we start with 3⍴1?
 
Oh I could also use 1 1 1, 3⍴1
@ngn Jinx :P
 
ngn
and it might be easier to return the whole sequence instead of the n-th term. i'm not sure
2 bytes shorter :) {{⍵,+/2↑¯3↑⍵}⍣⍵×⍳3} (⎕io←1)
 
Oh nice
 
ngn
2:01 PM
the length of the result is longer than ⍵ though. i don't know if that's allowed
 
Hm and just the 3⍴1 gets me to 18 bytes which is already shorter
 
ngn
@Sherlock9 ⊢3⍴1 -> ×⍳3
 
@ngn Edited it in. Thanks muchly, it's 17 bytes now
 
Ven
2:26 PM
⎕←2⊤152
 
@Ven
0
 
Ven
Huh. I don't think I understand how ⊤ works.
 
@Ven Most often, you want ⊥⍣¯1 instead of :
⍞←2(⊥⍣¯1)152
 
@Adám 1 0 0 1 1 0 0 0
 
@Ven treats a scalar left argument as a 1-element list, so you only get the trailing bit/digit.
 
Ven
2:30 PM
Ah yeah, thanks
⍞←1 0 0 1 1 0 0 0 (1=-⍥(+/))1 0 0 1 1 0 0 1
 
@Ven SYNTAX ERROR
 
Ven
Oh duh, there's no Extended there.
^ This works if I'm already working with binary representations, but I want (f A) .. (f B). Maybe I can abuse ⍢, or maybe I'm better off with a pair
 
⋄ Ö←{(⍵⍵ ⍺)⍺⍺(⍵⍵ ⍵)} ⋄ ⎕←1 0 0 1 1 0 0 0 (1=-Ö(+/))1 0 0 1 1 0 0 1
 
@Adám
0
 
@Ven Right, but that one is simple enough to model inline:
 
Ven
2:35 PM
Fair enough.
 
@Ven Actually, you can use extended, but it is a bit more awkward.
 
Ven
⍞←↑2(⊥⍣¯1)¨152 24
 
@Ven 1 0 0 1 1 0 0 0
 
Ven
Whoops, wrong command. Anyways: mix pads to the end. Not what I want, I'll have to find another solution
 
@Ven What were you trying to do?
 
Ven
2:37 PM
I am, however, not sure it matters for this challenge.
 
⎕←2⊥⍣¯1⊢152 24
 
@Adám
1 0
0 0
0 0
1 1
1 1
0 0
0 0
0 0
 
Ven
⍞←1=-/+⌿2(⊥⍣¯1)152 24
 
@Ven 1
 
Ven
I guess I can save a byte in Extended by replacing 1= with
 
2:42 PM
@Ven Uh, no, only if the result can never be 2 or ¯1
 
Ven
thinks of other schemes
 
#tio do apl-dyalog-extended ⎕←1=-/+⌿⊤152 24
 
@Adám 1
 
Ven
Dammit! I had seen that part of ⊤ last time I checked :(.
OK, now I need to write a checker that the code itself can have a single byte changed and not work
 
@Ven A single bit, that is, right?
@Ven That will be hard, e.g. and
 
Ven
2:47 PM
Yes. I need to check the codepage.
 
@Ven Then watch out for ⎕AV vs SBCS. Anyway, gotta go.
 
Ven
#tio do apl-dyalog-extended ⎕←(1=(-/)∘(+⌿)∘⊤)152 24
 
@Ven 1
 
Ven
⎕←(1=(-/)∘(+⌿)∘⊥)152 24
 
@Ven
SYNTAX ERROR
 
Ven
2:52 PM
OK, well, ⊥ and ⊤ won't be an issue it seems.
 
Ven
3:06 PM
Actually Extended is probably worst suited for this challenge
 
3:52 PM
#tio do apl-dyalog-extended ⎕←(1=1-/⍤⊥⊤)152 24
 
@Adám 1
 
@Ven ^^
 
Ven
@Adám Issue is that one-bit-changes have to mean an error. I can replace / with + (at least in ASCII) and it won't error
 
@Ven *one-bit
 
Ven
Right indeed.
 
4:27 PM
here's a program for SBCS mapping
 
 
1 hour later…
ngn
5:30 PM
0 1 1
1 0 0
0 1 0
cmc: produce this matrix or its transposition
(my cunning plan: ⊃+.×⍣⍵⍨ of that matrix is the th padovan number)
 
ngn
6:11 PM
wow. primes. who would have thought
 
6:26 PM
@ngn J, 9 bytes 1 p:i.3 3
 
ngn
in apl the best i have is 10: 2 5 4⊤⍨3⍴2 so the whole padovan solution ⊃+.×⍣⎕⍨2 5 4⊤⍨3⍴2 is 17 bytes - exactly as many as Ven's best
 
ngn
@Adám have you had any success persuading dyalog to adopt some of your extensions?
is a good one
@ngn a direct translation of Galen Ivanov's recursive solution is also 17 bytes: {⍵<3:1⋄+/∇¨⍵-2 3}
 
 
2 hours later…
8:42 PM
@Adám what does it mean when I see a function definition that looks like r←{something} FunctionName args
 
@nathanrogers Optional left arg
 
oh well that's wierd
 
@nathanrogers Dfns and tacit functions are always ambivalent, but in Dyalog APL tradsfns have to declare themselves so. Other APL's don't give you a choice for tradfns (i.e. they are also always ambivalent).
 
oh tacit
 
@nathanrogers fixed
 

« first day (803 days earlier)      last day (1865 days later) »