Timeline for Exit Code Golfing
Current License: CC BY-SA 4.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 7 at 0:15 | comment | added | whirlingstars | See, in theory I should know these things because I've lurked here for a while, but in practice I just forget that that works | |
Dec 7 at 0:12 | comment | added | emanresu A |
(side note: ~-x is a fairly common golfing idiom for x-1 with higher precedence, so you can use e.g. 2/~-x instead of 2/(x-1) )
|
|
S Dec 7 at 0:04 | review | First answers | |||
Dec 7 at 13:25 | |||||
S Dec 7 at 0:04 | history | edited | whirlingstars | CC BY-SA 4.0 |
Add emanresu A's -12 cut
|
Dec 7 at 0:03 | comment | added | whirlingstars | I was under the assumption that all non-implemented codes had to return 0, but that wasn't actually stated, so I changed it to your version. (Also added the TIO link) | |
Dec 6 at 23:36 | comment | added | emanresu A | also (ran into comment char limit) here's a TIO link with a bash script testing all three cases, so other people can test this. | |
Dec 6 at 23:33 | comment | added | emanresu A |
Welcome to Code Golf, and nice first answer! There are quite a few ways you can shorten this: Since you only need to support exit codes 0, 1 and 139, you can just check that V is at least 2, and you can do this concisely with 1//(V:=int(input())-1)or string_at(0) . If given 0, V will be -1, 1//V will be -1, so string_at won't be evaluated; if given 1, V=0 and 1//0 crashes; if given 139 1//139 is 0 so the string_at gets evaluated with a segfault. Putting this together gives 52 bytes from ctypes import*;1//~-int(input())or string_at(0) .
|
|
Dec 6 at 23:31 | review | Late answers | |||
Dec 7 at 0:27 | |||||
S Dec 6 at 23:14 | review | First answers | |||
Dec 6 at 23:36 | |||||
S Dec 6 at 23:14 | history | answered | whirlingstars | CC BY-SA 4.0 |