Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

+11, oof
Source Link
chunes
  • 27.8k
  • 3
  • 32
  • 55

Factor, (削除) 73 (削除ここまで) 72(削除) 72 (削除ここまで) 83 bytes

: f ( x -- ) dup real? [ drop ] [ 1 cut 1 short cut* rot .append . [ f ] each ] if ;

Try it online! Try it online!

Recursive function that (maybe) slices both ends off the input, prints them, then calls itself on all the remaining elements until an atom (real number) is reached. ((Now handles arrays with a single element properly at the cost of 11 bytes...))

Factor, (削除) 73 (削除ここまで) 72 bytes

: f ( x -- ) dup real? [ drop ] [ 1 cut 1 cut* rot . . [ f ] each ] if ;

Try it online!

Recursive function that slices both ends off the input, prints them, then calls itself on all the remaining elements until an atom (real number) is reached.

Factor, (削除) 73 (削除ここまで) (削除) 72 (削除ここまで) 83 bytes

: f ( x -- ) dup real? [ drop ] [ 1 cut 1 short cut* rot append . [ f ] each ] if ;

Try it online!

Recursive function that (maybe) slices both ends off the input, prints them, then calls itself on all the remaining elements until an atom (real number) is reached. ((Now handles arrays with a single element properly at the cost of 11 bytes...))

-1
Source Link
chunes
  • 27.8k
  • 3
  • 32
  • 55

Factor, 73(削除) 73 (削除ここまで) 72 bytes

: f ( x -- ) dup real? [ drop ] [ 1 cut 1 cut* .rot swap. . [ f ] each ] if ;

Try it online! Try it online!

Recursive function that slices both ends off the input, prints them, then calls itself on all the remaining elements until an atom (real number) is reached.

Factor, 73 bytes

: f ( x -- ) dup real? [ drop ] [ 1 cut 1 cut* . swap . [ f ] each ] if ;

Try it online!

Recursive function that slices both ends off the input, prints them, then calls itself on all the remaining elements until an atom (real number) is reached.

Factor, (削除) 73 (削除ここまで) 72 bytes

: f ( x -- ) dup real? [ drop ] [ 1 cut 1 cut* rot . . [ f ] each ] if ;

Try it online!

Recursive function that slices both ends off the input, prints them, then calls itself on all the remaining elements until an atom (real number) is reached.

Source Link
chunes
  • 27.8k
  • 3
  • 32
  • 55

Factor, 73 bytes

: f ( x -- ) dup real? [ drop ] [ 1 cut 1 cut* . swap . [ f ] each ] if ;

Try it online!

Recursive function that slices both ends off the input, prints them, then calls itself on all the remaining elements until an atom (real number) is reached.

AltStyle によって変換されたページ (->オリジナル) /