Skip to main content
Add explanation, shave a byte, fix old byte count
Source Link
juh
  • 993
  • 7
  • 15

dc, 3029 28 bytes

[z1-:az0!=L]dsLx0[;aplLx]dsLxaz0<L]dsLx0[;aplLx]dsLx 

TakesTry it online!

0-indexed; takes input on the stack (just prepend it). If we assume input is already in a, cut off the first 16 bytes. Will perish when the call stack overflows.

[ # Phase 1: shove stuff into an array z1- # if there are 7 things on the stack, push 6 :a # store whatever was on top into e.g. a[6] z0<L # loop while stack isn't empty ]dsLx # execute immediately and with extreme prejudice 0 # first index to check out [ # Phase 2: the challenge ;a # push a[tos] p # print it lLx # loop forever ]dsLx # autobots, roll out 

Try it online!I feel like the 0!= should be reducible to 1> never mind, I just can't read. Woohoo!

dc, 30 bytes

[z1-:az0!=L]dsLx0[;aplLx]dsLx 

Takes input on the stack. If we assume input is already in a, cut off the first 16 bytes.

Try it online!

dc, 29 28 bytes

[z1-:az0<L]dsLx0[;aplLx]dsLx 

Try it online!

0-indexed; takes input on the stack (just prepend it). If we assume input is already in a, cut off the first 16 bytes. Will perish when the call stack overflows.

[ # Phase 1: shove stuff into an array z1- # if there are 7 things on the stack, push 6 :a # store whatever was on top into e.g. a[6] z0<L # loop while stack isn't empty ]dsLx # execute immediately and with extreme prejudice 0 # first index to check out [ # Phase 2: the challenge ;a # push a[tos] p # print it lLx # loop forever ]dsLx # autobots, roll out 

I feel like the 0!= should be reducible to 1> never mind, I just can't read. Woohoo!

Source Link
juh
  • 993
  • 7
  • 15

dc, 30 bytes

[z1-:az0!=L]dsLx0[;aplLx]dsLx 

Takes input on the stack. If we assume input is already in a, cut off the first 16 bytes.

Try it online!