The Nineteenth Byte

The Nineteenth Byte: General discussion for codegolf.stackexc...
Jul 25, 2023 16:43
Earlier I thought you were implying x+.×y is allowed too, because it's a tradfn body. I guess the actual meta is you don't have to count the tradfn header if it's only a name f, but you do have to count it if it's like x f y.
Jul 25, 2023 16:41
And the examples marked ⍝ Invalid, … in this post being invalid is very sensible to me :+1:
Jul 25, 2023 16:38
It sounds like in a sense, Python doesn't have implicit output by default (but the REPL is an exception), whereas Dyalog does have implicit output by default (but shell scripts are an exception)
Jul 25, 2023 16:36
Jul 25, 2023 16:31
That's interesting, I don't have Dyalog installed right now so I can't play with it, but I wish ATO supported that
Jul 25, 2023 16:26
VALUE ERROR: Undefined name: f
 f
 ∧
Jul 25, 2023 16:26
If I put that in ATO, I get
Jul 25, 2023 16:25
I tried to guess at what you mean by "tradfn body".
Jul 25, 2023 16:25
Like Ruben said, if there's a flag to make Dyalog do implicit output, that's ok but it should probably be in the post
Jul 25, 2023 16:24
In that sense it seemed analogous to that last Python program, to me
Jul 25, 2023 16:23
It makes sense to write up a meta consensus for APL that doesn't invalidate hundreds of APL answers of course. But I was surprised when I ran Ruben's code on ATO and it read two lines of input but didn't output anything.
Jul 25, 2023 16:21
I tried to make a fair comparison, but of course Python is not APL :) Anyway, in Python, the first four are allowed, the next two are snippets (invalid), and the last is a full program that doesn't output anything except in a REPL, so we don't normally allow this either, except I guess you could submit it as "Python REPL, 15 bytes"?
Jul 25, 2023 16:18
print(int(input())**2)   # ⎕←⎕*2
def f(x):return x**2     # ∇ r←f x ⋄ r←x*2 ⋄ ∇
lambda x:x**2            # {⍵*2}
2 .__rpow__              # *∘2

return x**2              # r←x*2
x**2                     # x*2

int(input())**2          # ⎕*2
Jul 25, 2023 16:04
What's the syntax for giving the body a name?
Jul 25, 2023 16:01
I don't know if APL has special conventions on the site, but we don't allow function bodies return x+1 or REPL programs for x in range(9):x*x in Python, right?
Jul 25, 2023 15:45
@RubenVerg Yep, that's it
Jul 25, 2023 15:45
I think this ⍸ behavior might originally be a K thing, where it's called &. J's I. does it too. Jelly used to have it, and it was called O, but it got replaced by T which doesn't do the duplicating, and O is ord now
Jul 25, 2023 15:28
Yep, that's right :) Ooh, you can then make it a tacit function to get something really short.
Jul 25, 2023 15:24
OK, gotcha! I see a nice byte save. Monadic ⍸ has a behavior I wish Jelly or Vyxal had, but I don't think they have it: ⍸3 5 is 1 1 1 2 2 2 2 2.
Jul 25, 2023 15:17
I think it needs either ⎕← to be a full program or {} to be a function. It looks kinda like they had it in {} and copied only the } and then also didn't count it to their byte total.
Jul 25, 2023 15:16
codegolf.stackexchange.com/a/263321/3852 I think this is a snippet, right?
 

 Vyxal

For discussion about Vyxal. Repo: github.com/Vyxal/Vyxal | Org: ...
Aug 24, 2022 17:55
then it's described as "Returns the first truthy argument, otherwise the first falsy argument." but that is also not what it does
Aug 24, 2022 17:54
it's documented as a or b but implemented as process_element("rhs or lhs", 2),
Aug 24, 2022 17:53
so what is up with 2 3∨ being 3?
Aug 22, 2022 19:17
oh, I see

⟨`A`|1⟩G # ok
⟨⟨0|`A`⟩|⟨0|1⟩⟩G # fails
Aug 22, 2022 19:14
I submitted an answer with a backslash before the 1 at first
Aug 22, 2022 19:09
this makes me realize I don't really understand why comparing "f0" and 1 (for example) is fine
Aug 22, 2022 19:03
so I thought "wow too bad, I bet there isn't a 1-byte max(key) builtin or something" and looked for key in elements.md and found the arrow :)
Aug 22, 2022 19:02
TypeError: '>' not supported between instances of 'str' and 'Zero'
Aug 22, 2022 19:01
@lyxal It's funny: I wanted to use G (and zip the other way around), but that was giving me str/int comparison errors between "R" and 0
Aug 22, 2022 18:54
removing that took me to 17, but the 16 is pretty different
Aug 22, 2022 18:53
@Steffan I had a 3-element lambda with an unnecessary : in it
Aug 22, 2022 18:51
I'm getting the hang of this Vyxal stuff (I submitted a 16)
 

­Trash

Where the trash goes.
Aug 8, 2022 20:28
I'm just summing lists
Aug 8, 2022 20:14
ok I got a 15 using slightly better stack manipulation
Aug 8, 2022 20:03
annoyingly, on ATO I don't have to tuck the [] and I can save 2 bytes, maybe because I'm putting the input only on STDIN there, whereas weekgolf also supplies it as a command line argument or something?
Aug 8, 2022 20:01
I start at [] [a] and do something to it n times
Aug 8, 2022 19:59
not sure what that means
Aug 8, 2022 19:54
so I am missing a byte somewhere else
Aug 8, 2022 19:54
I see, ⌈⌊ṫ and Ė combined with wf (to do that thing I need) comes out to the same length
Aug 8, 2022 19:52
oh huh, well you try replacing the whole thing with Ė :)
Aug 8, 2022 19:47
I'm looking for a single-byte command that'll turn 12 into [12] and also [12] into [12]. is that a thing?
 

 Jelly Hypertraining

Practice your Jelly :) Rules and stuff are here: golfingsucces...
Dec 25, 2021 20:51
(I must admit I don't totally understand how it's helpful on desktop, either)
Dec 25, 2021 20:51
cool, thanks!
Dec 25, 2021 14:30
I created about half of these with a search program that generates and runs random 3-byte Jelly programs, it's pretty wild to watch the outputs
Dec 25, 2021 14:18
I just realized there are two nice solutions to [9, 0, 0, 9]. Mine isn't, um, tacky
Dec 25, 2021 14:14
@hyper-neutrino That's a great output, I should include it in a future puzzle set!
Dec 25, 2021 11:26
I think it will only need td { display: inline-block; }
Dec 25, 2021 11:21
I can't scroll to see the rest. but enabling word wrap seems better anyway
Dec 25, 2021 11:19
@hyper-neutrino it would be nice if I could use the keyboard on mobile (on your TIO page) :)