Skip to main content
deleted 332 characters in body
Source Link
lyxal
  • 35.6k
  • 2
  • 69
  • 148

Vyxal, 15 13 1010 9 bytes

t≥AǔḢ)↔Ṫvg(:g…Ȯt=ǔḢ

Try it Online!Try it Online!

It's not every day I get to use recursion in a lambda Nevermind, I don't anymore.

-3 thanks to AndrovT

-1 by outputting items on newlines

Explained

t≥AǔḢ)↔Ṫvg(:g…Ȯt=ǔḢ
    ( )↔    # repeat the following, starting with the# input, until the result doesn't change, collecting intermittentlength valuestimes:
t≥  :g…       #  is get the tailminimum of the list greatertop thanof orthe equalstack towithout eachpopping itemand inprint thethat list?without Vectorises.popping
  A   Ȯt     #  is that true for all items?push Returnsthe 1tail ifof itthe isitem (implyingover the tailtop isof the minimumstack
 - it's less than or equal= to everything) or 0# otherwise. Big braindoes ideathat courtesyequal ofthe Androvmin?
   ǔ    ǔ   #  rotate the list right that many times (once if tail is min [placing tail at front] or no times at all).
          #  Remove the head of the list
       Ṫ   # discard the empty list at the end
        vg # and get the minimum of each list in the fixed point result

Vyxal, 15 13 10 bytes

t≥AǔḢ)↔Ṫvg

Try it Online!

It's not every day I get to use recursion in a lambda Nevermind, I don't anymore.

-3 thanks to AndrovT

Explained

t≥AǔḢ)↔Ṫvg
     )↔    # repeat the following, starting with the input, until the result doesn't change, collecting intermittent values:
t≥         #  is the tail of the list greater than or equal to each item in the list? Vectorises.
  A        #  is that true for all items? Returns 1 if it is (implying the tail is the minimum - it's less than or equal to everything) or 0 otherwise. Big brain idea courtesy of Androv
   ǔ       #  rotate the list right that many times (once if tail is min [placing tail at front] or no times at all).
          #  Remove the head of the list
       Ṫ   # discard the empty list at the end
        vg # and get the minimum of each list in the fixed point result

Vyxal, 15 13 10 9 bytes

(:g…Ȯt=ǔḢ

Try it Online!

It's not every day I get to use recursion in a lambda Nevermind, I don't anymore.

-3 thanks to AndrovT

-1 by outputting items on newlines

Explained

(:g…Ȯt=ǔḢ
(          # input length times:
 :g…       #   get the minimum of the top of the stack without popping and print that without popping
    Ȯt     #   push the tail of the item over the top of the stack
      =    #   does that equal the min?
       ǔ   #  rotate the list right that many times (once if tail is min [placing tail at front] or no times at all).
          #  Remove the head of the list
added 31 characters in body
Source Link
lyxal
  • 35.6k
  • 2
  • 69
  • 148

Vyxal, 15 13 10 bytes

t≥AǔḢ)↔Ṫvg

Try it Online!

It's not every day I get to use recursion in a lambda Nevermind, I don't anymore.

-3 thanks to AndrovT

Explained (old)

λ[₌tg~=n$¨iṪḢxJt≥AǔḢ)↔Ṫvg
λ     )↔    # repeat the following, starting with #the ainput, lambdauntil that
the [result doesn't change, collecting intermittent values:
t≥         # if it's argument isn't empty
  ₌tgis the tail of the list greater than or equal to #each item pushesin the last and smallest itemslist? ofVectorises.
 the argument
A     ~=   #  is that true for #all items? andReturns checks1 if they'reit equal,is without(implying popping
the tail is the minimum - it's less than ¨ior equal to everything) or #0 otherwise. ifBig theybrain are
idea courtesy of Androv
   ǔ n$      #    Pushrotate the argumentlist withoutright thethat lastmany item
times (once if tail is min [placing n$tail at front] or no times #at all).
 otherwise, push the argument without the first item 
  #  Remove the head of the list
     x  #  call this# lambdadiscard onthe thatempty list
    at the end
        Jvg #  and mergeget the original smallestminimum withof theeach resultlist ofin the recursionfixed point result

Vyxal, 15 13 10 bytes

t≥AǔḢ)↔Ṫvg

Try it Online!

It's not every day I get to use recursion in a lambda Nevermind, I don't anymore.

-3 thanks to AndrovT

Explained (old)

λ[₌tg~=n$¨iṪḢxJ
λ               # a lambda that
 [              # if it's argument isn't empty
  ₌tg           #  pushes the last and smallest items of the argument
     ~=         #  and checks if they're equal, without popping
         ¨i     #  if they are
       n$      #    Push the argument without the last item
       n$      #  otherwise, push the argument without the first item 
              x  #  call this lambda on that list
              J #  and merge the original smallest with the result of the recursion

Vyxal, 15 13 10 bytes

t≥AǔḢ)↔Ṫvg

Try it Online!

It's not every day I get to use recursion in a lambda Nevermind, I don't anymore.

-3 thanks to AndrovT

Explained

t≥AǔḢ)↔Ṫvg
     )↔    # repeat the following, starting with the input, until the result doesn't change, collecting intermittent values:
t≥         #  is the tail of the list greater than or equal to each item in the list? Vectorises.
  A        #  is that true for all items? Returns 1 if it is (implying the tail is the minimum - it's less than or equal to everything) or 0 otherwise. Big brain idea courtesy of Androv
   ǔ       #  rotate the list right that many times (once if tail is min [placing tail at front] or no times at all).
          #  Remove the head of the list
          # discard the empty list at the end
        vg # and get the minimum of each list in the fixed point result
added 31 characters in body
Source Link
lyxal
  • 35.6k
  • 2
  • 69
  • 148

Vyxal, 15 1313 10 bytes

₌tg=[Ṫ|Ḣt≥AǔḢ)↔Ṫvg

Try it Online!Try it Online!

It's not every day I get to use recursion in a lambda Nevermind, I don't anymore.

-3 thanks to AndrovT

Explained (old)

λ[₌tg~=n$¨iṪḢxJ
λ               # a lambda that
 [              # if it's argument isn't empty
  ₌tg           #  pushes the last and smallest items of the argument
     ~=         #  and checks if they're equal, without popping
         ¨i     #  if they are
       n$  Ṫ    #    Push the argument without the last item
       n$   Ḣ   #  otherwise, push the argument without the first item 
             x  #  call this lambda on that list
              J #  and merge the original smallest with the result of the recursion

Vyxal, 15 13 bytes

₌tg=[Ṫ|Ḣ)↔Ṫvg

Try it Online!

It's not every day I get to use recursion in a lambda Nevermind, I don't anymore.

Explained (old)

λ[₌tg~=n$¨iṪḢxJ
λ               # a lambda that
 [              # if it's argument isn't empty
  ₌tg           #  pushes the last and smallest items of the argument
     ~=         #  and checks if they're equal, without popping
         ¨i     #  if they are
       n$  Ṫ    #    Push the argument without the last item
       n$   Ḣ   #  otherwise, push the argument without the first item 
             x  #  call this lambda on that list
              J #  and merge the original smallest with the result of the recursion

Vyxal, 15 13 10 bytes

t≥AǔḢ)↔Ṫvg

Try it Online!

It's not every day I get to use recursion in a lambda Nevermind, I don't anymore.

-3 thanks to AndrovT

Explained (old)

λ[₌tg~=n$¨iṪḢxJ
λ               # a lambda that
 [              # if it's argument isn't empty
  ₌tg           #  pushes the last and smallest items of the argument
     ~=         #  and checks if they're equal, without popping
         ¨i     #  if they are
       n$  Ṫ    #    Push the argument without the last item
       n$   Ḣ   #  otherwise, push the argument without the first item 
             x  #  call this lambda on that list
              J #  and merge the original smallest with the result of the recursion
added 40 characters in body
Source Link
lyxal
  • 35.6k
  • 2
  • 69
  • 148
Loading
added 593 characters in body
Source Link
lyxal
  • 35.6k
  • 2
  • 69
  • 148
Loading
Source Link
lyxal
  • 35.6k
  • 2
  • 69
  • 148
Loading