A quine of sortsTips for golfing in PythonOutput the first position in your program for each input characterWrite the shortest self-identifying program (a quine variant)Double-slit QuineQWERTY Quine CreationCheating Cyclic QuineGolf Me A Bubble SortIt's Anagram Quine, not just Quine!Solve an AnagramMake a lookup indexNumbers Increase While Letters DecreaseA “Sorting” algorithm

How can I deal with extreme temperatures in a hotel room?

Why did the Apple //e make a hideous noise if you inserted the disk upside down?

The Football Squad

if a USA citizen marries a foreign citizen who has kid from previous marriage

Alien life interbreeding with Earth life

Fully submerged water bath for stove top baking?

If two black hole event horizons overlap (touch) can they ever separate again?

When was this photo of Mission Dolores *actually* taken?

What is the Japanese name for the conventional shoelace knot?

Do the 26 richest billionaires own as much wealth as the poorest 3.8 billion people?

Why is it important to have a receptacle next to load centers?

What is an acid trap

How do I ensure my employees don't abuse my flexible work hours policy?

How can I know if a PDF file was created via LaTeX or XeLaTeX?

Should 私の be omitted?

Copy group of files (Filename*) to backup (Filename*.bak)

How do ohm meters measure high resistances?

Losing the queen and then winning the game

Movie with Zoltar in a trailer park named Paradise and a boy playing a video game then being recruited by aliens to fight in space

Why wasn't ASCII designed with a contiguous alphanumeric character order?

Android Studio 3.6 canary 6 - Gradle throwing DefaultProjectSyncIssues exception

Checkmate in 1 on a Tangled Board

Is it okay to submit a paper from a master's thesis without informing the advisor?

If I have the War Caster feat, can I use the Thorn Whip cantrip to stop an enemy caster from escaping using the Dimension Door spell?



A quine of sorts


Tips for golfing in PythonOutput the first position in your program for each input characterWrite the shortest self-identifying program (a quine variant)Double-slit QuineQWERTY Quine CreationCheating Cyclic QuineGolf Me A Bubble SortIt's Anagram Quine, not just Quine!Solve an AnagramMake a lookup indexNumbers Increase While Letters DecreaseA “Sorting” algorithm






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








13












$begingroup$


Given a string x, output the characters in x sorted according to the order of appearance in your source code.



Examples



Source: ThisIs A Test
Input: Is it a Test?
Output: TissI etta?

Source: Harry - yer a wizard.
Input: I'm a what?
Output: aa wh'?Imt

Source: Mr. H. Potter, The Floor, Hut-on-the-Rock, The Sea
Input:
Output:


Rules



  • Standard loopholes & i/o rules apply

  • Input & output can be either a string, a list of characters, or a list of bytes.

  • If a character is used multiple times in the source, use the first occurrence.

  • If one or more characters does not appear in the source, they should be at the end; their order does not matter, nor does it have to be consistent.

  • Source must be non-empty

  • Newlines are treated the same as other characters.

  • The order in which the code is executed doesn't matter; just the raw string.

  • The input is in the same encoding as the code.

  • The input is sorted by characters, not by bytes.

  • This is code-golf, so shortest answer in bytes for each language wins!









share|improve this question







New contributor



tjjfvi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






$endgroup$











  • $begingroup$
    Do unprintable characters need to be accounted for? And if not, what about whitespace?
    $endgroup$
    – negative seven
    8 hours ago







  • 2




    $begingroup$
    @negativeseven Any characters from the source code encoding need to be accounted for, including whitespace.
    $endgroup$
    – tjjfvi
    7 hours ago










  • $begingroup$
    related
    $endgroup$
    – Rod
    5 hours ago










  • $begingroup$
    You should probably make explicit mention in the spec that matching is case sensitive.
    $endgroup$
    – Shaggy
    9 mins ago

















13












$begingroup$


Given a string x, output the characters in x sorted according to the order of appearance in your source code.



Examples



Source: ThisIs A Test
Input: Is it a Test?
Output: TissI etta?

Source: Harry - yer a wizard.
Input: I'm a what?
Output: aa wh'?Imt

Source: Mr. H. Potter, The Floor, Hut-on-the-Rock, The Sea
Input:
Output:


Rules



  • Standard loopholes & i/o rules apply

  • Input & output can be either a string, a list of characters, or a list of bytes.

  • If a character is used multiple times in the source, use the first occurrence.

  • If one or more characters does not appear in the source, they should be at the end; their order does not matter, nor does it have to be consistent.

  • Source must be non-empty

  • Newlines are treated the same as other characters.

  • The order in which the code is executed doesn't matter; just the raw string.

  • The input is in the same encoding as the code.

  • The input is sorted by characters, not by bytes.

  • This is code-golf, so shortest answer in bytes for each language wins!









share|improve this question







New contributor



tjjfvi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






$endgroup$











  • $begingroup$
    Do unprintable characters need to be accounted for? And if not, what about whitespace?
    $endgroup$
    – negative seven
    8 hours ago







  • 2




    $begingroup$
    @negativeseven Any characters from the source code encoding need to be accounted for, including whitespace.
    $endgroup$
    – tjjfvi
    7 hours ago










  • $begingroup$
    related
    $endgroup$
    – Rod
    5 hours ago










  • $begingroup$
    You should probably make explicit mention in the spec that matching is case sensitive.
    $endgroup$
    – Shaggy
    9 mins ago













13












13








13





$begingroup$


Given a string x, output the characters in x sorted according to the order of appearance in your source code.



Examples



Source: ThisIs A Test
Input: Is it a Test?
Output: TissI etta?

Source: Harry - yer a wizard.
Input: I'm a what?
Output: aa wh'?Imt

Source: Mr. H. Potter, The Floor, Hut-on-the-Rock, The Sea
Input:
Output:


Rules



  • Standard loopholes & i/o rules apply

  • Input & output can be either a string, a list of characters, or a list of bytes.

  • If a character is used multiple times in the source, use the first occurrence.

  • If one or more characters does not appear in the source, they should be at the end; their order does not matter, nor does it have to be consistent.

  • Source must be non-empty

  • Newlines are treated the same as other characters.

  • The order in which the code is executed doesn't matter; just the raw string.

  • The input is in the same encoding as the code.

  • The input is sorted by characters, not by bytes.

  • This is code-golf, so shortest answer in bytes for each language wins!









share|improve this question







New contributor



tjjfvi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






$endgroup$




Given a string x, output the characters in x sorted according to the order of appearance in your source code.



Examples



Source: ThisIs A Test
Input: Is it a Test?
Output: TissI etta?

Source: Harry - yer a wizard.
Input: I'm a what?
Output: aa wh'?Imt

Source: Mr. H. Potter, The Floor, Hut-on-the-Rock, The Sea
Input:
Output:


Rules



  • Standard loopholes & i/o rules apply

  • Input & output can be either a string, a list of characters, or a list of bytes.

  • If a character is used multiple times in the source, use the first occurrence.

  • If one or more characters does not appear in the source, they should be at the end; their order does not matter, nor does it have to be consistent.

  • Source must be non-empty

  • Newlines are treated the same as other characters.

  • The order in which the code is executed doesn't matter; just the raw string.

  • The input is in the same encoding as the code.

  • The input is sorted by characters, not by bytes.

  • This is code-golf, so shortest answer in bytes for each language wins!






code-golf quine sorting






share|improve this question







New contributor



tjjfvi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share|improve this question







New contributor



tjjfvi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share|improve this question




share|improve this question






New contributor



tjjfvi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








asked 8 hours ago









tjjfvitjjfvi

1367 bronze badges




1367 bronze badges




New contributor



tjjfvi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




New contributor




tjjfvi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • $begingroup$
    Do unprintable characters need to be accounted for? And if not, what about whitespace?
    $endgroup$
    – negative seven
    8 hours ago







  • 2




    $begingroup$
    @negativeseven Any characters from the source code encoding need to be accounted for, including whitespace.
    $endgroup$
    – tjjfvi
    7 hours ago










  • $begingroup$
    related
    $endgroup$
    – Rod
    5 hours ago










  • $begingroup$
    You should probably make explicit mention in the spec that matching is case sensitive.
    $endgroup$
    – Shaggy
    9 mins ago
















  • $begingroup$
    Do unprintable characters need to be accounted for? And if not, what about whitespace?
    $endgroup$
    – negative seven
    8 hours ago







  • 2




    $begingroup$
    @negativeseven Any characters from the source code encoding need to be accounted for, including whitespace.
    $endgroup$
    – tjjfvi
    7 hours ago










  • $begingroup$
    related
    $endgroup$
    – Rod
    5 hours ago










  • $begingroup$
    You should probably make explicit mention in the spec that matching is case sensitive.
    $endgroup$
    – Shaggy
    9 mins ago















$begingroup$
Do unprintable characters need to be accounted for? And if not, what about whitespace?
$endgroup$
– negative seven
8 hours ago





$begingroup$
Do unprintable characters need to be accounted for? And if not, what about whitespace?
$endgroup$
– negative seven
8 hours ago





2




2




$begingroup$
@negativeseven Any characters from the source code encoding need to be accounted for, including whitespace.
$endgroup$
– tjjfvi
7 hours ago




$begingroup$
@negativeseven Any characters from the source code encoding need to be accounted for, including whitespace.
$endgroup$
– tjjfvi
7 hours ago












$begingroup$
related
$endgroup$
– Rod
5 hours ago




$begingroup$
related
$endgroup$
– Rod
5 hours ago












$begingroup$
You should probably make explicit mention in the spec that matching is case sensitive.
$endgroup$
– Shaggy
9 mins ago




$begingroup$
You should probably make explicit mention in the spec that matching is case sensitive.
$endgroup$
– Shaggy
9 mins ago










9 Answers
9






active

oldest

votes


















4












$begingroup$


APL (Dyalog Unicode), 14 bytesSBCS





Anonymous tacit prefix function.



'''∘⍋⊃¨⊂'∘⍋⊃¨⊂


 enclose argument (to act on it as a whole)



⊃¨ from that, pick one character for each of the following indices:



∘⍋ the indices that would sort the argument in the the order given by the following string (all non-members go in order of appearance at the end):



'''∘⍋⊃¨⊂' the characters '∘⍋⊃¨⊂



Try it online!






share|improve this answer











$endgroup$




















    2












    $begingroup$


    J, 14 bytes



    Anonymous tacit prefix function.



    ]/:']/:''i'i:]


    Try it online!



    ] the argument



    i: last occurrence (non-members get the index beyond end of lookup string) of each character in:



    ']/:''i' the characters ]/:'i



    /: use that to sort:



    ] the argument






    share|improve this answer











    $endgroup$












    • $begingroup$
      Are the four leading spaces a result of the echo or the code?
      $endgroup$
      – tjjfvi
      7 hours ago






    • 1




      $begingroup$
      @tjjfvi It is how TIO is configured. Fixed now.
      $endgroup$
      – Adám
      7 hours ago


















    2












    $begingroup$


    05AB1E, 24 22 21 bytes



    Σ"Σ"'"«"'«Rrk}"«Rrk}R


    Try it online!



    Explanation:





    Σ } # Sort
    "Σ" # Σ string literal
    '" # " string literal
    « # Concatenate last two literals
    "'«Rrk}" # '«Rrk} another literal
    « # Concat again
    R # Reverse literal (so: }krR'«'"Σ)
    r # reverse stack
    k # find the current sorting index in our code string
    R # reverse our sorted string


    First time trying stuff in 05AB1E so probably lots to be saved






    share|improve this answer











    $endgroup$












    • $begingroup$
      Are you sure this is correct? The string it now sorts on is }krR«'«. NOTE: ' is a single character, so just '" is enough (unlike C# where it needs an additional trailing '). Currently your code first pushes the string Σ, then the string ", then the string «, then the string '«Rrk}, and then it does the append, reverse, reverse stack, index. Smart usage of the reverse of the string and at the end, though! I will see if I can find a fix for your answer, and will delete mine afterwards.
      $endgroup$
      – Kevin Cruijssen
      6 hours ago











    • $begingroup$
      @kevincruijssen So can't I just get rid of the second '
      $endgroup$
      – Expired Data
      6 hours ago






    • 1




      $begingroup$
      Yeah, you indeed can. :) Then it correctly sorts on }krR«'"Σ. PS: I tend to use = (print without popping) for debug purposes sometimes. You can also add --debug-stack as argument, but it's a bit weird in the new 05AB1E version imho.
      $endgroup$
      – Kevin Cruijssen
      6 hours ago


















    2












    $begingroup$


    Jelly, 14 bytes



    “;fɓḟṾⱮ”ṾɓfⱮ;ḟ


    A full program accepting a (Python formatted) string which prints the output.

    (as a monadic link it yields a list of lists of characters)



    Try it online!



    How?



    “;fɓḟṾⱮ”ṾɓfⱮ;ḟ - Main Link: list of characters, S
    “;fɓḟṾⱮ” - list of characters = [';', 'f', 'ɓ', 'ḟ', 'Ṿ', 'Ɱ']
    Ṿ - un-evaluate = ['“', ';', 'f', 'ɓ', 'ḟ', 'Ṿ', 'Ɱ', '”']
    ɓ - start a new dyadic chain, F(S, T=that):
    Ɱ - for each character, t, in T:
    f - (S) filter keep any of (the single character, t)
    ḟ - (S) filter discard any of (the characters in T)
    ; - concatenate





    share|improve this answer











    $endgroup$




















      2












      $begingroup$


      JavaScript (Node.js), 60 bytes





      f=_=>_.sort((a,b)=>(p=g=>-~`f=$f`.indexOf(g)||51)(a)-p(b))
      f= Function Name
      _=> Input _
      _.sort((a,b)=>( )(a)-p(b) Sort By
      p=g=>-~`f=$f`.indexOf(g)||70 Helper function which takes the index (in the function as string)
      of each char in the input, if it doesnt match any character
      then is assigned a value bigger than the max length of the function


      Try it online!






      share|improve this answer











      $endgroup$












      • $begingroup$
        Your code seems to only work when the source is f=.... If that is the case, please include that in your submission & byte count.
        $endgroup$
        – tjjfvi
        6 hours ago










      • $begingroup$
        search will fail if the input contains any RegEx characters (e.g., *), you'll need to use indexOf instead. Also, won't this fail overall if the length of the input is >50?
        $endgroup$
        – Shaggy
        6 hours ago










      • $begingroup$
        @Shaggy Thanks. I think now it gives the correct output in case of regex characters. Also the length of input doesnt matter in this sort since I just need to know the position of each character in my function, not the input
        $endgroup$
        – Luis felipe De jesus Munoz
        5 hours ago


















      2












      $begingroup$


      Jelly, 16 14 bytes



      “Ṿv`Ṿ;³³i@Þ”v`


      Try it online!



      A full program that takes a single argument, the string to be sorted.



      Thanks to @JonathanAllan for pointing out a bug!



      Explanation



      “Ṿv`Ṿ;³³i@Þ” | The string "Ṿv`Ṿ;³³i@Þ", referred to below as S
      v` | Evaluate this string as Jelly code using the string itself as the argument


      The string above evaluates as:



      Ṿ | Uneval the string S (effectively wraps it in “”)
      v` | Eval it (effectively removes the “”)
      Ṿ | Uneval it again, adding back in the “”
      ;³ | Concatenate the input to this
      ³i@Þ | Sort the input with respect to the first occurence of each character in the “”-wrapped string S concatenated to the input


      Ṿv` is a no-op effectively here, but exists to ensure all characters are represented.






      share|improve this answer











      $endgroup$




















        2












        $begingroup$


        Python 2, 102 100 96 85 79 76 68 bytes





        s="print sorted(input(),key=lambda x:('s=%r;c'%s+x).find(x))";exec s


        Try it online!



        -2 bytes by using this



        -4 bytes by realizing that <0 == ==-1 and removing the unnecessary +1



        -11 bytes thanks to Neil



        -6 bytes thanks to dzaima



        -3 bytes thanks to rod



        -8 bytes thanks to negative seven pointing out that the program can output a list of chars






        share|improve this answer











        $endgroup$












        • $begingroup$
          ('s=%r;exec(s)'%s+x).find(x)?
          $endgroup$
          – Neil
          6 hours ago










        • $begingroup$
          @Neil Is the current solution invalid, and substituting ('s=%r;exec(s)'%s).find(x) with your code would make it valid?
          $endgroup$
          – MilkyWay90
          6 hours ago










        • $begingroup$
          @Neil Oh, wait, I see your golf
          $endgroup$
          – MilkyWay90
          6 hours ago










        • $begingroup$
          79 bytes by shortening the inner string
          $endgroup$
          – dzaima
          6 hours ago










        • $begingroup$
          You can switch to input() and save 4 bytes
          $endgroup$
          – Rod
          5 hours ago


















        1












        $begingroup$


        Charcoal, 37 bytes



        ≔´≔´´´η´F´Φ´θ´⁼´ι´κ´¬´№ηFηΦθ⁼ικΦθ¬№ηι


        Try it online! Explanation:



        ≔´≔´´´η´F´Φ´θ´⁼´ι´κ´¬´№η


        There are two ways of quoting characters in Charcoal; ´ quotes any single character while ”y... quotes any character except and also counts as a separate string. It turns out that the overhead in having to deal with means that it doesn't end up any golfier.



        FηΦθ⁼ικ


        Loop over the characters in turn, outputting any matching characters from the input. This sorts the input.



        Φθ¬№ηι


        Output any unmatched characters in the input.






        share|improve this answer









        $endgroup$




















          1












          $begingroup$


          Ruby, 57 bytes





          ->ss.sort_by%->s.ort_byindex()9.index(o)


          Try it online!



          Fairly straightforward, assuming I haven't missed a golfing trick. Take in a list of characters and sort by their index in a string consisting of all the uniq characters in the code in order of their appearance. Often their first appearance is in that very string, but that doesn't change the order.






          share|improve this answer









          $endgroup$















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "200"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );






            tjjfvi is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f187415%2fa-quine-of-sorts%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            9 Answers
            9






            active

            oldest

            votes








            9 Answers
            9






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            4












            $begingroup$


            APL (Dyalog Unicode), 14 bytesSBCS





            Anonymous tacit prefix function.



            '''∘⍋⊃¨⊂'∘⍋⊃¨⊂


             enclose argument (to act on it as a whole)



            ⊃¨ from that, pick one character for each of the following indices:



            ∘⍋ the indices that would sort the argument in the the order given by the following string (all non-members go in order of appearance at the end):



            '''∘⍋⊃¨⊂' the characters '∘⍋⊃¨⊂



            Try it online!






            share|improve this answer











            $endgroup$

















              4












              $begingroup$


              APL (Dyalog Unicode), 14 bytesSBCS





              Anonymous tacit prefix function.



              '''∘⍋⊃¨⊂'∘⍋⊃¨⊂


               enclose argument (to act on it as a whole)



              ⊃¨ from that, pick one character for each of the following indices:



              ∘⍋ the indices that would sort the argument in the the order given by the following string (all non-members go in order of appearance at the end):



              '''∘⍋⊃¨⊂' the characters '∘⍋⊃¨⊂



              Try it online!






              share|improve this answer











              $endgroup$















                4












                4








                4





                $begingroup$


                APL (Dyalog Unicode), 14 bytesSBCS





                Anonymous tacit prefix function.



                '''∘⍋⊃¨⊂'∘⍋⊃¨⊂


                 enclose argument (to act on it as a whole)



                ⊃¨ from that, pick one character for each of the following indices:



                ∘⍋ the indices that would sort the argument in the the order given by the following string (all non-members go in order of appearance at the end):



                '''∘⍋⊃¨⊂' the characters '∘⍋⊃¨⊂



                Try it online!






                share|improve this answer











                $endgroup$




                APL (Dyalog Unicode), 14 bytesSBCS





                Anonymous tacit prefix function.



                '''∘⍋⊃¨⊂'∘⍋⊃¨⊂


                 enclose argument (to act on it as a whole)



                ⊃¨ from that, pick one character for each of the following indices:



                ∘⍋ the indices that would sort the argument in the the order given by the following string (all non-members go in order of appearance at the end):



                '''∘⍋⊃¨⊂' the characters '∘⍋⊃¨⊂



                Try it online!







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 6 hours ago

























                answered 8 hours ago









                AdámAdám

                28.1k2 gold badges79 silver badges210 bronze badges




                28.1k2 gold badges79 silver badges210 bronze badges























                    2












                    $begingroup$


                    J, 14 bytes



                    Anonymous tacit prefix function.



                    ]/:']/:''i'i:]


                    Try it online!



                    ] the argument



                    i: last occurrence (non-members get the index beyond end of lookup string) of each character in:



                    ']/:''i' the characters ]/:'i



                    /: use that to sort:



                    ] the argument






                    share|improve this answer











                    $endgroup$












                    • $begingroup$
                      Are the four leading spaces a result of the echo or the code?
                      $endgroup$
                      – tjjfvi
                      7 hours ago






                    • 1




                      $begingroup$
                      @tjjfvi It is how TIO is configured. Fixed now.
                      $endgroup$
                      – Adám
                      7 hours ago















                    2












                    $begingroup$


                    J, 14 bytes



                    Anonymous tacit prefix function.



                    ]/:']/:''i'i:]


                    Try it online!



                    ] the argument



                    i: last occurrence (non-members get the index beyond end of lookup string) of each character in:



                    ']/:''i' the characters ]/:'i



                    /: use that to sort:



                    ] the argument






                    share|improve this answer











                    $endgroup$












                    • $begingroup$
                      Are the four leading spaces a result of the echo or the code?
                      $endgroup$
                      – tjjfvi
                      7 hours ago






                    • 1




                      $begingroup$
                      @tjjfvi It is how TIO is configured. Fixed now.
                      $endgroup$
                      – Adám
                      7 hours ago













                    2












                    2








                    2





                    $begingroup$


                    J, 14 bytes



                    Anonymous tacit prefix function.



                    ]/:']/:''i'i:]


                    Try it online!



                    ] the argument



                    i: last occurrence (non-members get the index beyond end of lookup string) of each character in:



                    ']/:''i' the characters ]/:'i



                    /: use that to sort:



                    ] the argument






                    share|improve this answer











                    $endgroup$




                    J, 14 bytes



                    Anonymous tacit prefix function.



                    ]/:']/:''i'i:]


                    Try it online!



                    ] the argument



                    i: last occurrence (non-members get the index beyond end of lookup string) of each character in:



                    ']/:''i' the characters ]/:'i



                    /: use that to sort:



                    ] the argument







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited 7 hours ago

























                    answered 8 hours ago









                    AdámAdám

                    28.1k2 gold badges79 silver badges210 bronze badges




                    28.1k2 gold badges79 silver badges210 bronze badges











                    • $begingroup$
                      Are the four leading spaces a result of the echo or the code?
                      $endgroup$
                      – tjjfvi
                      7 hours ago






                    • 1




                      $begingroup$
                      @tjjfvi It is how TIO is configured. Fixed now.
                      $endgroup$
                      – Adám
                      7 hours ago
















                    • $begingroup$
                      Are the four leading spaces a result of the echo or the code?
                      $endgroup$
                      – tjjfvi
                      7 hours ago






                    • 1




                      $begingroup$
                      @tjjfvi It is how TIO is configured. Fixed now.
                      $endgroup$
                      – Adám
                      7 hours ago















                    $begingroup$
                    Are the four leading spaces a result of the echo or the code?
                    $endgroup$
                    – tjjfvi
                    7 hours ago




                    $begingroup$
                    Are the four leading spaces a result of the echo or the code?
                    $endgroup$
                    – tjjfvi
                    7 hours ago




                    1




                    1




                    $begingroup$
                    @tjjfvi It is how TIO is configured. Fixed now.
                    $endgroup$
                    – Adám
                    7 hours ago




                    $begingroup$
                    @tjjfvi It is how TIO is configured. Fixed now.
                    $endgroup$
                    – Adám
                    7 hours ago











                    2












                    $begingroup$


                    05AB1E, 24 22 21 bytes



                    Σ"Σ"'"«"'«Rrk}"«Rrk}R


                    Try it online!



                    Explanation:





                    Σ } # Sort
                    "Σ" # Σ string literal
                    '" # " string literal
                    « # Concatenate last two literals
                    "'«Rrk}" # '«Rrk} another literal
                    « # Concat again
                    R # Reverse literal (so: }krR'«'"Σ)
                    r # reverse stack
                    k # find the current sorting index in our code string
                    R # reverse our sorted string


                    First time trying stuff in 05AB1E so probably lots to be saved






                    share|improve this answer











                    $endgroup$












                    • $begingroup$
                      Are you sure this is correct? The string it now sorts on is }krR«'«. NOTE: ' is a single character, so just '" is enough (unlike C# where it needs an additional trailing '). Currently your code first pushes the string Σ, then the string ", then the string «, then the string '«Rrk}, and then it does the append, reverse, reverse stack, index. Smart usage of the reverse of the string and at the end, though! I will see if I can find a fix for your answer, and will delete mine afterwards.
                      $endgroup$
                      – Kevin Cruijssen
                      6 hours ago











                    • $begingroup$
                      @kevincruijssen So can't I just get rid of the second '
                      $endgroup$
                      – Expired Data
                      6 hours ago






                    • 1




                      $begingroup$
                      Yeah, you indeed can. :) Then it correctly sorts on }krR«'"Σ. PS: I tend to use = (print without popping) for debug purposes sometimes. You can also add --debug-stack as argument, but it's a bit weird in the new 05AB1E version imho.
                      $endgroup$
                      – Kevin Cruijssen
                      6 hours ago















                    2












                    $begingroup$


                    05AB1E, 24 22 21 bytes



                    Σ"Σ"'"«"'«Rrk}"«Rrk}R


                    Try it online!



                    Explanation:





                    Σ } # Sort
                    "Σ" # Σ string literal
                    '" # " string literal
                    « # Concatenate last two literals
                    "'«Rrk}" # '«Rrk} another literal
                    « # Concat again
                    R # Reverse literal (so: }krR'«'"Σ)
                    r # reverse stack
                    k # find the current sorting index in our code string
                    R # reverse our sorted string


                    First time trying stuff in 05AB1E so probably lots to be saved






                    share|improve this answer











                    $endgroup$












                    • $begingroup$
                      Are you sure this is correct? The string it now sorts on is }krR«'«. NOTE: ' is a single character, so just '" is enough (unlike C# where it needs an additional trailing '). Currently your code first pushes the string Σ, then the string ", then the string «, then the string '«Rrk}, and then it does the append, reverse, reverse stack, index. Smart usage of the reverse of the string and at the end, though! I will see if I can find a fix for your answer, and will delete mine afterwards.
                      $endgroup$
                      – Kevin Cruijssen
                      6 hours ago











                    • $begingroup$
                      @kevincruijssen So can't I just get rid of the second '
                      $endgroup$
                      – Expired Data
                      6 hours ago






                    • 1




                      $begingroup$
                      Yeah, you indeed can. :) Then it correctly sorts on }krR«'"Σ. PS: I tend to use = (print without popping) for debug purposes sometimes. You can also add --debug-stack as argument, but it's a bit weird in the new 05AB1E version imho.
                      $endgroup$
                      – Kevin Cruijssen
                      6 hours ago













                    2












                    2








                    2





                    $begingroup$


                    05AB1E, 24 22 21 bytes



                    Σ"Σ"'"«"'«Rrk}"«Rrk}R


                    Try it online!



                    Explanation:





                    Σ } # Sort
                    "Σ" # Σ string literal
                    '" # " string literal
                    « # Concatenate last two literals
                    "'«Rrk}" # '«Rrk} another literal
                    « # Concat again
                    R # Reverse literal (so: }krR'«'"Σ)
                    r # reverse stack
                    k # find the current sorting index in our code string
                    R # reverse our sorted string


                    First time trying stuff in 05AB1E so probably lots to be saved






                    share|improve this answer











                    $endgroup$




                    05AB1E, 24 22 21 bytes



                    Σ"Σ"'"«"'«Rrk}"«Rrk}R


                    Try it online!



                    Explanation:





                    Σ } # Sort
                    "Σ" # Σ string literal
                    '" # " string literal
                    « # Concatenate last two literals
                    "'«Rrk}" # '«Rrk} another literal
                    « # Concat again
                    R # Reverse literal (so: }krR'«'"Σ)
                    r # reverse stack
                    k # find the current sorting index in our code string
                    R # reverse our sorted string


                    First time trying stuff in 05AB1E so probably lots to be saved







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited 6 hours ago

























                    answered 7 hours ago









                    Expired DataExpired Data

                    1,3934 silver badges18 bronze badges




                    1,3934 silver badges18 bronze badges











                    • $begingroup$
                      Are you sure this is correct? The string it now sorts on is }krR«'«. NOTE: ' is a single character, so just '" is enough (unlike C# where it needs an additional trailing '). Currently your code first pushes the string Σ, then the string ", then the string «, then the string '«Rrk}, and then it does the append, reverse, reverse stack, index. Smart usage of the reverse of the string and at the end, though! I will see if I can find a fix for your answer, and will delete mine afterwards.
                      $endgroup$
                      – Kevin Cruijssen
                      6 hours ago











                    • $begingroup$
                      @kevincruijssen So can't I just get rid of the second '
                      $endgroup$
                      – Expired Data
                      6 hours ago






                    • 1




                      $begingroup$
                      Yeah, you indeed can. :) Then it correctly sorts on }krR«'"Σ. PS: I tend to use = (print without popping) for debug purposes sometimes. You can also add --debug-stack as argument, but it's a bit weird in the new 05AB1E version imho.
                      $endgroup$
                      – Kevin Cruijssen
                      6 hours ago
















                    • $begingroup$
                      Are you sure this is correct? The string it now sorts on is }krR«'«. NOTE: ' is a single character, so just '" is enough (unlike C# where it needs an additional trailing '). Currently your code first pushes the string Σ, then the string ", then the string «, then the string '«Rrk}, and then it does the append, reverse, reverse stack, index. Smart usage of the reverse of the string and at the end, though! I will see if I can find a fix for your answer, and will delete mine afterwards.
                      $endgroup$
                      – Kevin Cruijssen
                      6 hours ago











                    • $begingroup$
                      @kevincruijssen So can't I just get rid of the second '
                      $endgroup$
                      – Expired Data
                      6 hours ago






                    • 1




                      $begingroup$
                      Yeah, you indeed can. :) Then it correctly sorts on }krR«'"Σ. PS: I tend to use = (print without popping) for debug purposes sometimes. You can also add --debug-stack as argument, but it's a bit weird in the new 05AB1E version imho.
                      $endgroup$
                      – Kevin Cruijssen
                      6 hours ago















                    $begingroup$
                    Are you sure this is correct? The string it now sorts on is }krR«'«. NOTE: ' is a single character, so just '" is enough (unlike C# where it needs an additional trailing '). Currently your code first pushes the string Σ, then the string ", then the string «, then the string '«Rrk}, and then it does the append, reverse, reverse stack, index. Smart usage of the reverse of the string and at the end, though! I will see if I can find a fix for your answer, and will delete mine afterwards.
                    $endgroup$
                    – Kevin Cruijssen
                    6 hours ago





                    $begingroup$
                    Are you sure this is correct? The string it now sorts on is }krR«'«. NOTE: ' is a single character, so just '" is enough (unlike C# where it needs an additional trailing '). Currently your code first pushes the string Σ, then the string ", then the string «, then the string '«Rrk}, and then it does the append, reverse, reverse stack, index. Smart usage of the reverse of the string and at the end, though! I will see if I can find a fix for your answer, and will delete mine afterwards.
                    $endgroup$
                    – Kevin Cruijssen
                    6 hours ago













                    $begingroup$
                    @kevincruijssen So can't I just get rid of the second '
                    $endgroup$
                    – Expired Data
                    6 hours ago




                    $begingroup$
                    @kevincruijssen So can't I just get rid of the second '
                    $endgroup$
                    – Expired Data
                    6 hours ago




                    1




                    1




                    $begingroup$
                    Yeah, you indeed can. :) Then it correctly sorts on }krR«'"Σ. PS: I tend to use = (print without popping) for debug purposes sometimes. You can also add --debug-stack as argument, but it's a bit weird in the new 05AB1E version imho.
                    $endgroup$
                    – Kevin Cruijssen
                    6 hours ago




                    $begingroup$
                    Yeah, you indeed can. :) Then it correctly sorts on }krR«'"Σ. PS: I tend to use = (print without popping) for debug purposes sometimes. You can also add --debug-stack as argument, but it's a bit weird in the new 05AB1E version imho.
                    $endgroup$
                    – Kevin Cruijssen
                    6 hours ago











                    2












                    $begingroup$


                    Jelly, 14 bytes



                    “;fɓḟṾⱮ”ṾɓfⱮ;ḟ


                    A full program accepting a (Python formatted) string which prints the output.

                    (as a monadic link it yields a list of lists of characters)



                    Try it online!



                    How?



                    “;fɓḟṾⱮ”ṾɓfⱮ;ḟ - Main Link: list of characters, S
                    “;fɓḟṾⱮ” - list of characters = [';', 'f', 'ɓ', 'ḟ', 'Ṿ', 'Ɱ']
                    Ṿ - un-evaluate = ['“', ';', 'f', 'ɓ', 'ḟ', 'Ṿ', 'Ɱ', '”']
                    ɓ - start a new dyadic chain, F(S, T=that):
                    Ɱ - for each character, t, in T:
                    f - (S) filter keep any of (the single character, t)
                    ḟ - (S) filter discard any of (the characters in T)
                    ; - concatenate





                    share|improve this answer











                    $endgroup$

















                      2












                      $begingroup$


                      Jelly, 14 bytes



                      “;fɓḟṾⱮ”ṾɓfⱮ;ḟ


                      A full program accepting a (Python formatted) string which prints the output.

                      (as a monadic link it yields a list of lists of characters)



                      Try it online!



                      How?



                      “;fɓḟṾⱮ”ṾɓfⱮ;ḟ - Main Link: list of characters, S
                      “;fɓḟṾⱮ” - list of characters = [';', 'f', 'ɓ', 'ḟ', 'Ṿ', 'Ɱ']
                      Ṿ - un-evaluate = ['“', ';', 'f', 'ɓ', 'ḟ', 'Ṿ', 'Ɱ', '”']
                      ɓ - start a new dyadic chain, F(S, T=that):
                      Ɱ - for each character, t, in T:
                      f - (S) filter keep any of (the single character, t)
                      ḟ - (S) filter discard any of (the characters in T)
                      ; - concatenate





                      share|improve this answer











                      $endgroup$















                        2












                        2








                        2





                        $begingroup$


                        Jelly, 14 bytes



                        “;fɓḟṾⱮ”ṾɓfⱮ;ḟ


                        A full program accepting a (Python formatted) string which prints the output.

                        (as a monadic link it yields a list of lists of characters)



                        Try it online!



                        How?



                        “;fɓḟṾⱮ”ṾɓfⱮ;ḟ - Main Link: list of characters, S
                        “;fɓḟṾⱮ” - list of characters = [';', 'f', 'ɓ', 'ḟ', 'Ṿ', 'Ɱ']
                        Ṿ - un-evaluate = ['“', ';', 'f', 'ɓ', 'ḟ', 'Ṿ', 'Ɱ', '”']
                        ɓ - start a new dyadic chain, F(S, T=that):
                        Ɱ - for each character, t, in T:
                        f - (S) filter keep any of (the single character, t)
                        ḟ - (S) filter discard any of (the characters in T)
                        ; - concatenate





                        share|improve this answer











                        $endgroup$




                        Jelly, 14 bytes



                        “;fɓḟṾⱮ”ṾɓfⱮ;ḟ


                        A full program accepting a (Python formatted) string which prints the output.

                        (as a monadic link it yields a list of lists of characters)



                        Try it online!



                        How?



                        “;fɓḟṾⱮ”ṾɓfⱮ;ḟ - Main Link: list of characters, S
                        “;fɓḟṾⱮ” - list of characters = [';', 'f', 'ɓ', 'ḟ', 'Ṿ', 'Ɱ']
                        Ṿ - un-evaluate = ['“', ';', 'f', 'ɓ', 'ḟ', 'Ṿ', 'Ɱ', '”']
                        ɓ - start a new dyadic chain, F(S, T=that):
                        Ɱ - for each character, t, in T:
                        f - (S) filter keep any of (the single character, t)
                        ḟ - (S) filter discard any of (the characters in T)
                        ; - concatenate






                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited 5 hours ago

























                        answered 5 hours ago









                        Jonathan AllanJonathan Allan

                        56.5k5 gold badges41 silver badges178 bronze badges




                        56.5k5 gold badges41 silver badges178 bronze badges





















                            2












                            $begingroup$


                            JavaScript (Node.js), 60 bytes





                            f=_=>_.sort((a,b)=>(p=g=>-~`f=$f`.indexOf(g)||51)(a)-p(b))
                            f= Function Name
                            _=> Input _
                            _.sort((a,b)=>( )(a)-p(b) Sort By
                            p=g=>-~`f=$f`.indexOf(g)||70 Helper function which takes the index (in the function as string)
                            of each char in the input, if it doesnt match any character
                            then is assigned a value bigger than the max length of the function


                            Try it online!






                            share|improve this answer











                            $endgroup$












                            • $begingroup$
                              Your code seems to only work when the source is f=.... If that is the case, please include that in your submission & byte count.
                              $endgroup$
                              – tjjfvi
                              6 hours ago










                            • $begingroup$
                              search will fail if the input contains any RegEx characters (e.g., *), you'll need to use indexOf instead. Also, won't this fail overall if the length of the input is >50?
                              $endgroup$
                              – Shaggy
                              6 hours ago










                            • $begingroup$
                              @Shaggy Thanks. I think now it gives the correct output in case of regex characters. Also the length of input doesnt matter in this sort since I just need to know the position of each character in my function, not the input
                              $endgroup$
                              – Luis felipe De jesus Munoz
                              5 hours ago















                            2












                            $begingroup$


                            JavaScript (Node.js), 60 bytes





                            f=_=>_.sort((a,b)=>(p=g=>-~`f=$f`.indexOf(g)||51)(a)-p(b))
                            f= Function Name
                            _=> Input _
                            _.sort((a,b)=>( )(a)-p(b) Sort By
                            p=g=>-~`f=$f`.indexOf(g)||70 Helper function which takes the index (in the function as string)
                            of each char in the input, if it doesnt match any character
                            then is assigned a value bigger than the max length of the function


                            Try it online!






                            share|improve this answer











                            $endgroup$












                            • $begingroup$
                              Your code seems to only work when the source is f=.... If that is the case, please include that in your submission & byte count.
                              $endgroup$
                              – tjjfvi
                              6 hours ago










                            • $begingroup$
                              search will fail if the input contains any RegEx characters (e.g., *), you'll need to use indexOf instead. Also, won't this fail overall if the length of the input is >50?
                              $endgroup$
                              – Shaggy
                              6 hours ago










                            • $begingroup$
                              @Shaggy Thanks. I think now it gives the correct output in case of regex characters. Also the length of input doesnt matter in this sort since I just need to know the position of each character in my function, not the input
                              $endgroup$
                              – Luis felipe De jesus Munoz
                              5 hours ago













                            2












                            2








                            2





                            $begingroup$


                            JavaScript (Node.js), 60 bytes





                            f=_=>_.sort((a,b)=>(p=g=>-~`f=$f`.indexOf(g)||51)(a)-p(b))
                            f= Function Name
                            _=> Input _
                            _.sort((a,b)=>( )(a)-p(b) Sort By
                            p=g=>-~`f=$f`.indexOf(g)||70 Helper function which takes the index (in the function as string)
                            of each char in the input, if it doesnt match any character
                            then is assigned a value bigger than the max length of the function


                            Try it online!






                            share|improve this answer











                            $endgroup$




                            JavaScript (Node.js), 60 bytes





                            f=_=>_.sort((a,b)=>(p=g=>-~`f=$f`.indexOf(g)||51)(a)-p(b))
                            f= Function Name
                            _=> Input _
                            _.sort((a,b)=>( )(a)-p(b) Sort By
                            p=g=>-~`f=$f`.indexOf(g)||70 Helper function which takes the index (in the function as string)
                            of each char in the input, if it doesnt match any character
                            then is assigned a value bigger than the max length of the function


                            Try it online!







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited 4 hours ago

























                            answered 6 hours ago









                            Luis felipe De jesus MunozLuis felipe De jesus Munoz

                            6,3862 gold badges18 silver badges74 bronze badges




                            6,3862 gold badges18 silver badges74 bronze badges











                            • $begingroup$
                              Your code seems to only work when the source is f=.... If that is the case, please include that in your submission & byte count.
                              $endgroup$
                              – tjjfvi
                              6 hours ago










                            • $begingroup$
                              search will fail if the input contains any RegEx characters (e.g., *), you'll need to use indexOf instead. Also, won't this fail overall if the length of the input is >50?
                              $endgroup$
                              – Shaggy
                              6 hours ago










                            • $begingroup$
                              @Shaggy Thanks. I think now it gives the correct output in case of regex characters. Also the length of input doesnt matter in this sort since I just need to know the position of each character in my function, not the input
                              $endgroup$
                              – Luis felipe De jesus Munoz
                              5 hours ago
















                            • $begingroup$
                              Your code seems to only work when the source is f=.... If that is the case, please include that in your submission & byte count.
                              $endgroup$
                              – tjjfvi
                              6 hours ago










                            • $begingroup$
                              search will fail if the input contains any RegEx characters (e.g., *), you'll need to use indexOf instead. Also, won't this fail overall if the length of the input is >50?
                              $endgroup$
                              – Shaggy
                              6 hours ago










                            • $begingroup$
                              @Shaggy Thanks. I think now it gives the correct output in case of regex characters. Also the length of input doesnt matter in this sort since I just need to know the position of each character in my function, not the input
                              $endgroup$
                              – Luis felipe De jesus Munoz
                              5 hours ago















                            $begingroup$
                            Your code seems to only work when the source is f=.... If that is the case, please include that in your submission & byte count.
                            $endgroup$
                            – tjjfvi
                            6 hours ago




                            $begingroup$
                            Your code seems to only work when the source is f=.... If that is the case, please include that in your submission & byte count.
                            $endgroup$
                            – tjjfvi
                            6 hours ago












                            $begingroup$
                            search will fail if the input contains any RegEx characters (e.g., *), you'll need to use indexOf instead. Also, won't this fail overall if the length of the input is >50?
                            $endgroup$
                            – Shaggy
                            6 hours ago




                            $begingroup$
                            search will fail if the input contains any RegEx characters (e.g., *), you'll need to use indexOf instead. Also, won't this fail overall if the length of the input is >50?
                            $endgroup$
                            – Shaggy
                            6 hours ago












                            $begingroup$
                            @Shaggy Thanks. I think now it gives the correct output in case of regex characters. Also the length of input doesnt matter in this sort since I just need to know the position of each character in my function, not the input
                            $endgroup$
                            – Luis felipe De jesus Munoz
                            5 hours ago




                            $begingroup$
                            @Shaggy Thanks. I think now it gives the correct output in case of regex characters. Also the length of input doesnt matter in this sort since I just need to know the position of each character in my function, not the input
                            $endgroup$
                            – Luis felipe De jesus Munoz
                            5 hours ago











                            2












                            $begingroup$


                            Jelly, 16 14 bytes



                            “Ṿv`Ṿ;³³i@Þ”v`


                            Try it online!



                            A full program that takes a single argument, the string to be sorted.



                            Thanks to @JonathanAllan for pointing out a bug!



                            Explanation



                            “Ṿv`Ṿ;³³i@Þ” | The string "Ṿv`Ṿ;³³i@Þ", referred to below as S
                            v` | Evaluate this string as Jelly code using the string itself as the argument


                            The string above evaluates as:



                            Ṿ | Uneval the string S (effectively wraps it in “”)
                            v` | Eval it (effectively removes the “”)
                            Ṿ | Uneval it again, adding back in the “”
                            ;³ | Concatenate the input to this
                            ³i@Þ | Sort the input with respect to the first occurence of each character in the “”-wrapped string S concatenated to the input


                            Ṿv` is a no-op effectively here, but exists to ensure all characters are represented.






                            share|improve this answer











                            $endgroup$

















                              2












                              $begingroup$


                              Jelly, 16 14 bytes



                              “Ṿv`Ṿ;³³i@Þ”v`


                              Try it online!



                              A full program that takes a single argument, the string to be sorted.



                              Thanks to @JonathanAllan for pointing out a bug!



                              Explanation



                              “Ṿv`Ṿ;³³i@Þ” | The string "Ṿv`Ṿ;³³i@Þ", referred to below as S
                              v` | Evaluate this string as Jelly code using the string itself as the argument


                              The string above evaluates as:



                              Ṿ | Uneval the string S (effectively wraps it in “”)
                              v` | Eval it (effectively removes the “”)
                              Ṿ | Uneval it again, adding back in the “”
                              ;³ | Concatenate the input to this
                              ³i@Þ | Sort the input with respect to the first occurence of each character in the “”-wrapped string S concatenated to the input


                              Ṿv` is a no-op effectively here, but exists to ensure all characters are represented.






                              share|improve this answer











                              $endgroup$















                                2












                                2








                                2





                                $begingroup$


                                Jelly, 16 14 bytes



                                “Ṿv`Ṿ;³³i@Þ”v`


                                Try it online!



                                A full program that takes a single argument, the string to be sorted.



                                Thanks to @JonathanAllan for pointing out a bug!



                                Explanation



                                “Ṿv`Ṿ;³³i@Þ” | The string "Ṿv`Ṿ;³³i@Þ", referred to below as S
                                v` | Evaluate this string as Jelly code using the string itself as the argument


                                The string above evaluates as:



                                Ṿ | Uneval the string S (effectively wraps it in “”)
                                v` | Eval it (effectively removes the “”)
                                Ṿ | Uneval it again, adding back in the “”
                                ;³ | Concatenate the input to this
                                ³i@Þ | Sort the input with respect to the first occurence of each character in the “”-wrapped string S concatenated to the input


                                Ṿv` is a no-op effectively here, but exists to ensure all characters are represented.






                                share|improve this answer











                                $endgroup$




                                Jelly, 16 14 bytes



                                “Ṿv`Ṿ;³³i@Þ”v`


                                Try it online!



                                A full program that takes a single argument, the string to be sorted.



                                Thanks to @JonathanAllan for pointing out a bug!



                                Explanation



                                “Ṿv`Ṿ;³³i@Þ” | The string "Ṿv`Ṿ;³³i@Þ", referred to below as S
                                v` | Evaluate this string as Jelly code using the string itself as the argument


                                The string above evaluates as:



                                Ṿ | Uneval the string S (effectively wraps it in “”)
                                v` | Eval it (effectively removes the “”)
                                Ṿ | Uneval it again, adding back in the “”
                                ;³ | Concatenate the input to this
                                ³i@Þ | Sort the input with respect to the first occurence of each character in the “”-wrapped string S concatenated to the input


                                Ṿv` is a no-op effectively here, but exists to ensure all characters are represented.







                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited 4 hours ago

























                                answered 7 hours ago









                                Nick KennedyNick Kennedy

                                3,8747 silver badges12 bronze badges




                                3,8747 silver badges12 bronze badges





















                                    2












                                    $begingroup$


                                    Python 2, 102 100 96 85 79 76 68 bytes





                                    s="print sorted(input(),key=lambda x:('s=%r;c'%s+x).find(x))";exec s


                                    Try it online!



                                    -2 bytes by using this



                                    -4 bytes by realizing that <0 == ==-1 and removing the unnecessary +1



                                    -11 bytes thanks to Neil



                                    -6 bytes thanks to dzaima



                                    -3 bytes thanks to rod



                                    -8 bytes thanks to negative seven pointing out that the program can output a list of chars






                                    share|improve this answer











                                    $endgroup$












                                    • $begingroup$
                                      ('s=%r;exec(s)'%s+x).find(x)?
                                      $endgroup$
                                      – Neil
                                      6 hours ago










                                    • $begingroup$
                                      @Neil Is the current solution invalid, and substituting ('s=%r;exec(s)'%s).find(x) with your code would make it valid?
                                      $endgroup$
                                      – MilkyWay90
                                      6 hours ago










                                    • $begingroup$
                                      @Neil Oh, wait, I see your golf
                                      $endgroup$
                                      – MilkyWay90
                                      6 hours ago










                                    • $begingroup$
                                      79 bytes by shortening the inner string
                                      $endgroup$
                                      – dzaima
                                      6 hours ago










                                    • $begingroup$
                                      You can switch to input() and save 4 bytes
                                      $endgroup$
                                      – Rod
                                      5 hours ago















                                    2












                                    $begingroup$


                                    Python 2, 102 100 96 85 79 76 68 bytes





                                    s="print sorted(input(),key=lambda x:('s=%r;c'%s+x).find(x))";exec s


                                    Try it online!



                                    -2 bytes by using this



                                    -4 bytes by realizing that <0 == ==-1 and removing the unnecessary +1



                                    -11 bytes thanks to Neil



                                    -6 bytes thanks to dzaima



                                    -3 bytes thanks to rod



                                    -8 bytes thanks to negative seven pointing out that the program can output a list of chars






                                    share|improve this answer











                                    $endgroup$












                                    • $begingroup$
                                      ('s=%r;exec(s)'%s+x).find(x)?
                                      $endgroup$
                                      – Neil
                                      6 hours ago










                                    • $begingroup$
                                      @Neil Is the current solution invalid, and substituting ('s=%r;exec(s)'%s).find(x) with your code would make it valid?
                                      $endgroup$
                                      – MilkyWay90
                                      6 hours ago










                                    • $begingroup$
                                      @Neil Oh, wait, I see your golf
                                      $endgroup$
                                      – MilkyWay90
                                      6 hours ago










                                    • $begingroup$
                                      79 bytes by shortening the inner string
                                      $endgroup$
                                      – dzaima
                                      6 hours ago










                                    • $begingroup$
                                      You can switch to input() and save 4 bytes
                                      $endgroup$
                                      – Rod
                                      5 hours ago













                                    2












                                    2








                                    2





                                    $begingroup$


                                    Python 2, 102 100 96 85 79 76 68 bytes





                                    s="print sorted(input(),key=lambda x:('s=%r;c'%s+x).find(x))";exec s


                                    Try it online!



                                    -2 bytes by using this



                                    -4 bytes by realizing that <0 == ==-1 and removing the unnecessary +1



                                    -11 bytes thanks to Neil



                                    -6 bytes thanks to dzaima



                                    -3 bytes thanks to rod



                                    -8 bytes thanks to negative seven pointing out that the program can output a list of chars






                                    share|improve this answer











                                    $endgroup$




                                    Python 2, 102 100 96 85 79 76 68 bytes





                                    s="print sorted(input(),key=lambda x:('s=%r;c'%s+x).find(x))";exec s


                                    Try it online!



                                    -2 bytes by using this



                                    -4 bytes by realizing that <0 == ==-1 and removing the unnecessary +1



                                    -11 bytes thanks to Neil



                                    -6 bytes thanks to dzaima



                                    -3 bytes thanks to rod



                                    -8 bytes thanks to negative seven pointing out that the program can output a list of chars







                                    share|improve this answer














                                    share|improve this answer



                                    share|improve this answer








                                    edited 2 hours ago

























                                    answered 6 hours ago









                                    MilkyWay90MilkyWay90

                                    1,0533 silver badges23 bronze badges




                                    1,0533 silver badges23 bronze badges











                                    • $begingroup$
                                      ('s=%r;exec(s)'%s+x).find(x)?
                                      $endgroup$
                                      – Neil
                                      6 hours ago










                                    • $begingroup$
                                      @Neil Is the current solution invalid, and substituting ('s=%r;exec(s)'%s).find(x) with your code would make it valid?
                                      $endgroup$
                                      – MilkyWay90
                                      6 hours ago










                                    • $begingroup$
                                      @Neil Oh, wait, I see your golf
                                      $endgroup$
                                      – MilkyWay90
                                      6 hours ago










                                    • $begingroup$
                                      79 bytes by shortening the inner string
                                      $endgroup$
                                      – dzaima
                                      6 hours ago










                                    • $begingroup$
                                      You can switch to input() and save 4 bytes
                                      $endgroup$
                                      – Rod
                                      5 hours ago
















                                    • $begingroup$
                                      ('s=%r;exec(s)'%s+x).find(x)?
                                      $endgroup$
                                      – Neil
                                      6 hours ago










                                    • $begingroup$
                                      @Neil Is the current solution invalid, and substituting ('s=%r;exec(s)'%s).find(x) with your code would make it valid?
                                      $endgroup$
                                      – MilkyWay90
                                      6 hours ago










                                    • $begingroup$
                                      @Neil Oh, wait, I see your golf
                                      $endgroup$
                                      – MilkyWay90
                                      6 hours ago










                                    • $begingroup$
                                      79 bytes by shortening the inner string
                                      $endgroup$
                                      – dzaima
                                      6 hours ago










                                    • $begingroup$
                                      You can switch to input() and save 4 bytes
                                      $endgroup$
                                      – Rod
                                      5 hours ago















                                    $begingroup$
                                    ('s=%r;exec(s)'%s+x).find(x)?
                                    $endgroup$
                                    – Neil
                                    6 hours ago




                                    $begingroup$
                                    ('s=%r;exec(s)'%s+x).find(x)?
                                    $endgroup$
                                    – Neil
                                    6 hours ago












                                    $begingroup$
                                    @Neil Is the current solution invalid, and substituting ('s=%r;exec(s)'%s).find(x) with your code would make it valid?
                                    $endgroup$
                                    – MilkyWay90
                                    6 hours ago




                                    $begingroup$
                                    @Neil Is the current solution invalid, and substituting ('s=%r;exec(s)'%s).find(x) with your code would make it valid?
                                    $endgroup$
                                    – MilkyWay90
                                    6 hours ago












                                    $begingroup$
                                    @Neil Oh, wait, I see your golf
                                    $endgroup$
                                    – MilkyWay90
                                    6 hours ago




                                    $begingroup$
                                    @Neil Oh, wait, I see your golf
                                    $endgroup$
                                    – MilkyWay90
                                    6 hours ago












                                    $begingroup$
                                    79 bytes by shortening the inner string
                                    $endgroup$
                                    – dzaima
                                    6 hours ago




                                    $begingroup$
                                    79 bytes by shortening the inner string
                                    $endgroup$
                                    – dzaima
                                    6 hours ago












                                    $begingroup$
                                    You can switch to input() and save 4 bytes
                                    $endgroup$
                                    – Rod
                                    5 hours ago




                                    $begingroup$
                                    You can switch to input() and save 4 bytes
                                    $endgroup$
                                    – Rod
                                    5 hours ago











                                    1












                                    $begingroup$


                                    Charcoal, 37 bytes



                                    ≔´≔´´´η´F´Φ´θ´⁼´ι´κ´¬´№ηFηΦθ⁼ικΦθ¬№ηι


                                    Try it online! Explanation:



                                    ≔´≔´´´η´F´Φ´θ´⁼´ι´κ´¬´№η


                                    There are two ways of quoting characters in Charcoal; ´ quotes any single character while ”y... quotes any character except and also counts as a separate string. It turns out that the overhead in having to deal with means that it doesn't end up any golfier.



                                    FηΦθ⁼ικ


                                    Loop over the characters in turn, outputting any matching characters from the input. This sorts the input.



                                    Φθ¬№ηι


                                    Output any unmatched characters in the input.






                                    share|improve this answer









                                    $endgroup$

















                                      1












                                      $begingroup$


                                      Charcoal, 37 bytes



                                      ≔´≔´´´η´F´Φ´θ´⁼´ι´κ´¬´№ηFηΦθ⁼ικΦθ¬№ηι


                                      Try it online! Explanation:



                                      ≔´≔´´´η´F´Φ´θ´⁼´ι´κ´¬´№η


                                      There are two ways of quoting characters in Charcoal; ´ quotes any single character while ”y... quotes any character except and also counts as a separate string. It turns out that the overhead in having to deal with means that it doesn't end up any golfier.



                                      FηΦθ⁼ικ


                                      Loop over the characters in turn, outputting any matching characters from the input. This sorts the input.



                                      Φθ¬№ηι


                                      Output any unmatched characters in the input.






                                      share|improve this answer









                                      $endgroup$















                                        1












                                        1








                                        1





                                        $begingroup$


                                        Charcoal, 37 bytes



                                        ≔´≔´´´η´F´Φ´θ´⁼´ι´κ´¬´№ηFηΦθ⁼ικΦθ¬№ηι


                                        Try it online! Explanation:



                                        ≔´≔´´´η´F´Φ´θ´⁼´ι´κ´¬´№η


                                        There are two ways of quoting characters in Charcoal; ´ quotes any single character while ”y... quotes any character except and also counts as a separate string. It turns out that the overhead in having to deal with means that it doesn't end up any golfier.



                                        FηΦθ⁼ικ


                                        Loop over the characters in turn, outputting any matching characters from the input. This sorts the input.



                                        Φθ¬№ηι


                                        Output any unmatched characters in the input.






                                        share|improve this answer









                                        $endgroup$




                                        Charcoal, 37 bytes



                                        ≔´≔´´´η´F´Φ´θ´⁼´ι´κ´¬´№ηFηΦθ⁼ικΦθ¬№ηι


                                        Try it online! Explanation:



                                        ≔´≔´´´η´F´Φ´θ´⁼´ι´κ´¬´№η


                                        There are two ways of quoting characters in Charcoal; ´ quotes any single character while ”y... quotes any character except and also counts as a separate string. It turns out that the overhead in having to deal with means that it doesn't end up any golfier.



                                        FηΦθ⁼ικ


                                        Loop over the characters in turn, outputting any matching characters from the input. This sorts the input.



                                        Φθ¬№ηι


                                        Output any unmatched characters in the input.







                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered 8 hours ago









                                        NeilNeil

                                        85.6k8 gold badges46 silver badges183 bronze badges




                                        85.6k8 gold badges46 silver badges183 bronze badges





















                                            1












                                            $begingroup$


                                            Ruby, 57 bytes





                                            ->ss.sort_by%->s.ort_byindex()9.index(o)


                                            Try it online!



                                            Fairly straightforward, assuming I haven't missed a golfing trick. Take in a list of characters and sort by their index in a string consisting of all the uniq characters in the code in order of their appearance. Often their first appearance is in that very string, but that doesn't change the order.






                                            share|improve this answer









                                            $endgroup$

















                                              1












                                              $begingroup$


                                              Ruby, 57 bytes





                                              ->ss.sort_by%->s.ort_byindex()9.index(o)


                                              Try it online!



                                              Fairly straightforward, assuming I haven't missed a golfing trick. Take in a list of characters and sort by their index in a string consisting of all the uniq characters in the code in order of their appearance. Often their first appearance is in that very string, but that doesn't change the order.






                                              share|improve this answer









                                              $endgroup$















                                                1












                                                1








                                                1





                                                $begingroup$


                                                Ruby, 57 bytes





                                                ->ss.sort_by%->s.ort_byindex()9.index(o)


                                                Try it online!



                                                Fairly straightforward, assuming I haven't missed a golfing trick. Take in a list of characters and sort by their index in a string consisting of all the uniq characters in the code in order of their appearance. Often their first appearance is in that very string, but that doesn't change the order.






                                                share|improve this answer









                                                $endgroup$




                                                Ruby, 57 bytes





                                                ->ss.sort_by%->s.ort_byindex()9.index(o)


                                                Try it online!



                                                Fairly straightforward, assuming I haven't missed a golfing trick. Take in a list of characters and sort by their index in a string consisting of all the uniq characters in the code in order of their appearance. Often their first appearance is in that very string, but that doesn't change the order.







                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered 7 hours ago









                                                histocrathistocrat

                                                19.5k4 gold badges32 silver badges74 bronze badges




                                                19.5k4 gold badges32 silver badges74 bronze badges




















                                                    tjjfvi is a new contributor. Be nice, and check out our Code of Conduct.









                                                    draft saved

                                                    draft discarded


















                                                    tjjfvi is a new contributor. Be nice, and check out our Code of Conduct.












                                                    tjjfvi is a new contributor. Be nice, and check out our Code of Conduct.











                                                    tjjfvi is a new contributor. Be nice, and check out our Code of Conduct.














                                                    If this is an answer to a challenge…



                                                    • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


                                                    • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
                                                      Explanations of your answer make it more interesting to read and are very much encouraged.


                                                    • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.


                                                    More generally…



                                                    • …Please make sure to answer the question and provide sufficient detail.


                                                    • …Avoid asking for help, clarification or responding to other answers (use comments instead).




                                                    draft saved


                                                    draft discarded














                                                    StackExchange.ready(
                                                    function ()
                                                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f187415%2fa-quine-of-sorts%23new-answer', 'question_page');

                                                    );

                                                    Post as a guest















                                                    Required, but never shown





















































                                                    Required, but never shown














                                                    Required, but never shown












                                                    Required, but never shown







                                                    Required, but never shown

































                                                    Required, but never shown














                                                    Required, but never shown












                                                    Required, but never shown







                                                    Required, but never shown







                                                    Popular posts from this blog

                                                    Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

                                                    Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

                                                    199年 目錄 大件事 到箇年出世嗰人 到箇年死嗰人 節慶、風俗習慣 導覽選單