I reverse the source code, you negate the input!I double the source, you double the output!I reverse the source code, you negate the output!Character counts in source codeSource Code MetamorphosisQuine / Reverse QuineDouble-duty quine: quine!dlroW ,olleHInput ∩ Source CodeSource code GO!I double the source, you double the output!Third time the charmQuine outputs itself in binaryI reverse the source code, you negate the output!

Algorithm for competing cells of 0s and 1s

Is this quote, "just ten trading days represent 63 per cent of the returns of the past 50 years" true?

What are sources for Magic Items that are not adventure-specific?

Floating Point XOR

EU compensation - fire alarm at the Flight Crew's hotel

Manager manipulates my leaves, what's in it for him?

Does battery condition have anything to do with macbook pro performance?

Can I separate garlic into cloves for storage?

How does a married couple pay bills when one gets paid twice a month and the other will be getting paid every week?

Applications of mathematics in clinical setting

How do rulers get rich from war?

Lead Amalgam as a Material for a Sword

Is it possible to get a pointer to one subobject via a pointer to a different, unreleated subobject?

Microservices and Stored Procedures

How to ask a man to not take up more than one seat on public transport while avoiding conflict?

Specifying BOM substitutions / alternatives with Contract Manufacturer (CM)

Do household ovens ventilate heat to the outdoors?

Is Zack Morris's 'time stop' ability in "Saved By the Bell" a supernatural ability?

I was cheated into a job and want to leave ASAP, what do I tell my interviewers?

Is it possible that the shadow of The Moon is a single dot during solar eclipse?

Why are there two bearded faces wearing red hats on my stealth bomber icon?

Make Interviewee Comfortable in Potentially Intimate Environment

Is the name of an interval between two notes unique and absolute?

All numbers in a 5x5 Minesweeper grid



I reverse the source code, you negate the input!


I double the source, you double the output!I reverse the source code, you negate the output!Character counts in source codeSource Code MetamorphosisQuine / Reverse QuineDouble-duty quine: quine!dlroW ,olleHInput ∩ Source CodeSource code GO!I double the source, you double the output!Third time the charmQuine outputs itself in binaryI reverse the source code, you negate the output!






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








8












$begingroup$


Blatant rip-off of a rip-off. Go upvote those!



Your task, if you wish to accept it, is to write a program/function that outputs/returns its integer input/argument. The tricky part is that if I reverse your source code, the output must be the original integer negated.



Examples



Let's say your source code is ABC and its input is 4. If I write CBA instead and run it, the output must be -4.



Let's say your source code is ABC and its input is -2. If I write CBA instead and run it, the output must be 2.



An input of 0 may give 0 or -0, however, if you do support signed zero, -0 should give 0.










share|improve this question









$endgroup$




















    8












    $begingroup$


    Blatant rip-off of a rip-off. Go upvote those!



    Your task, if you wish to accept it, is to write a program/function that outputs/returns its integer input/argument. The tricky part is that if I reverse your source code, the output must be the original integer negated.



    Examples



    Let's say your source code is ABC and its input is 4. If I write CBA instead and run it, the output must be -4.



    Let's say your source code is ABC and its input is -2. If I write CBA instead and run it, the output must be 2.



    An input of 0 may give 0 or -0, however, if you do support signed zero, -0 should give 0.










    share|improve this question









    $endgroup$
















      8












      8








      8


      0



      $begingroup$


      Blatant rip-off of a rip-off. Go upvote those!



      Your task, if you wish to accept it, is to write a program/function that outputs/returns its integer input/argument. The tricky part is that if I reverse your source code, the output must be the original integer negated.



      Examples



      Let's say your source code is ABC and its input is 4. If I write CBA instead and run it, the output must be -4.



      Let's say your source code is ABC and its input is -2. If I write CBA instead and run it, the output must be 2.



      An input of 0 may give 0 or -0, however, if you do support signed zero, -0 should give 0.










      share|improve this question









      $endgroup$




      Blatant rip-off of a rip-off. Go upvote those!



      Your task, if you wish to accept it, is to write a program/function that outputs/returns its integer input/argument. The tricky part is that if I reverse your source code, the output must be the original integer negated.



      Examples



      Let's say your source code is ABC and its input is 4. If I write CBA instead and run it, the output must be -4.



      Let's say your source code is ABC and its input is -2. If I write CBA instead and run it, the output must be 2.



      An input of 0 may give 0 or -0, however, if you do support signed zero, -0 should give 0.







      code-golf math number source-layout






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 8 hours ago









      AdámAdám

      29.8k2 gold badges82 silver badges214 bronze badges




      29.8k2 gold badges82 silver badges214 bronze badges























          20 Answers
          20






          active

          oldest

          votes


















          2














          $begingroup$


          Brain-Flak, 7 bytes



          #)]} 














          0














          $begingroup$

          JavaScript, 11 bytes



          n=>n//n->=n


          Try it Online! improve this answer










          $endgroup$

















            2














            2










            2







            $begingroup$


            Brain-Flak, 7 bytes



            #)][(


            Try it online!



            Reversed:



            ([])#


            Try it online!






            share{[(


            Try it online!



            Reversed:



            ([])#


            Try it online!







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 5 hours ago









            RileyRiley

            11.2k1 gold badge16 silver badges48 bronze badges




            11.2k1 gold badge16 silver badges48 bronze badges


























                1














                $begingroup$


                Gaia, 2 bytes



                _@


                Try it online!



                _	| implicit push input and negate
                @ | push input
                | implicit print TOS


                Reversed:



                @	| push input
                _ | negate
                | implicit print TOS





                share|improve this answer









                $endgroup$



















                  1














                  $begingroup$


                  Gaia, 2 bytes



                  _@


                  Try it online!



                  _	| implicit push input and negate
                  @ | push input
                  | implicit print TOS


                  Reversed:



                  @	| push input
                  _ | negate
                  | implicit print TOS





                  share|improve this answer









                  $endgroup$

















                    1














                    1










                    1







                    $begingroup$


                    Gaia, 2 bytes



                    _@


                    Try it online!



                    _	| implicit push input and negate
                    @ | push input
                    | implicit print TOS


                    Reversed:



                    @	| push input
                    _ | negate
                    | implicit print TOS





                    share|improve this answer









                    $endgroup$




                    Gaia, 2 bytes



                    _@


                    Try it online!



                    _	| implicit push input and negate
                    @ | push input
                    | implicit print TOS


                    Reversed:



                    @	| push input
                    _ | negate
                    | implicit print TOS






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered 8 hours ago









                    GiuseppeGiuseppe

                    19.3k3 gold badges16 silver badges71 bronze badges




                    19.3k3 gold badges16 silver badges71 bronze badges
























                        1














                        $begingroup$


                        PowerShell, 18 14 bytes





                        $args#"sgra$"-


                        Try it online! !enilno ti yrT



                        First of the trivial comment-abuse answers






                        share|improve this answer











                        $endgroup$










                        • 1




                          $begingroup$
                          Oh, God. Not this again.
                          $endgroup$
                          – JL2210
                          7 hours ago















                        1














                        $begingroup$


                        PowerShell, 18 14 bytes





                        $args#"sgra$"-


                        Try it online! !enilno ti yrT



                        First of the trivial comment-abuse answers






                        share|improve this answer











                        $endgroup$










                        • 1




                          $begingroup$
                          Oh, God. Not this again.
                          $endgroup$
                          – JL2210
                          7 hours ago













                        1














                        1










                        1







                        $begingroup$


                        PowerShell, 18 14 bytes





                        $args#"sgra$"-


                        Try it online! !enilno ti yrT



                        First of the trivial comment-abuse answers






                        share|improve this answer











                        $endgroup$




                        PowerShell, 18 14 bytes





                        $args#"sgra$"-


                        Try it online! !enilno ti yrT



                        First of the trivial comment-abuse answers







                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited 7 hours ago

























                        answered 7 hours ago









                        VeskahVeskah

                        2,2575 silver badges24 bronze badges




                        2,2575 silver badges24 bronze badges










                        • 1




                          $begingroup$
                          Oh, God. Not this again.
                          $endgroup$
                          – JL2210
                          7 hours ago












                        • 1




                          $begingroup$
                          Oh, God. Not this again.
                          $endgroup$
                          – JL2210
                          7 hours ago







                        1




                        1




                        $begingroup$
                        Oh, God. Not this again.
                        $endgroup$
                        – JL2210
                        7 hours ago




                        $begingroup$
                        Oh, God. Not this again.
                        $endgroup$
                        – JL2210
                        7 hours ago











                        1














                        $begingroup$


                        05AB1E, 2 bytes



                        (I


                        Try it online!



                        Reversed



                        ( negates nothing
                        I pushes input

                        I pushes input
                        ( negates input





                        share|improve this answer










                        New contributor



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





                        $endgroup$














                        • $begingroup$
                          It is supposed to only negate the input in one direction, leaving it as-is in the other. Clearly, 1-character solution cannot be valid.
                          $endgroup$
                          – Adám
                          7 hours ago










                        • $begingroup$
                          My bad, I misunderstood
                          $endgroup$
                          – jasanborn
                          7 hours ago















                        1














                        $begingroup$


                        05AB1E, 2 bytes



                        (I


                        Try it online!



                        Reversed



                        ( negates nothing
                        I pushes input

                        I pushes input
                        ( negates input





                        share|improve this answer










                        New contributor



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





                        $endgroup$














                        • $begingroup$
                          It is supposed to only negate the input in one direction, leaving it as-is in the other. Clearly, 1-character solution cannot be valid.
                          $endgroup$
                          – Adám
                          7 hours ago










                        • $begingroup$
                          My bad, I misunderstood
                          $endgroup$
                          – jasanborn
                          7 hours ago













                        1














                        1










                        1







                        $begingroup$


                        05AB1E, 2 bytes



                        (I


                        Try it online!



                        Reversed



                        ( negates nothing
                        I pushes input

                        I pushes input
                        ( negates input





                        share|improve this answer










                        New contributor



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





                        $endgroup$




                        05AB1E, 2 bytes



                        (I


                        Try it online!



                        Reversed



                        ( negates nothing
                        I pushes input

                        I pushes input
                        ( negates input






                        share|improve this answer










                        New contributor



                        jasanborn 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 answer



                        share|improve this answer








                        edited 7 hours ago





















                        New contributor



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








                        answered 7 hours ago









                        jasanbornjasanborn

                        114 bronze badges




                        114 bronze badges




                        New contributor



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




                        New contributor




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
















                        • $begingroup$
                          It is supposed to only negate the input in one direction, leaving it as-is in the other. Clearly, 1-character solution cannot be valid.
                          $endgroup$
                          – Adám
                          7 hours ago










                        • $begingroup$
                          My bad, I misunderstood
                          $endgroup$
                          – jasanborn
                          7 hours ago
















                        • $begingroup$
                          It is supposed to only negate the input in one direction, leaving it as-is in the other. Clearly, 1-character solution cannot be valid.
                          $endgroup$
                          – Adám
                          7 hours ago










                        • $begingroup$
                          My bad, I misunderstood
                          $endgroup$
                          – jasanborn
                          7 hours ago















                        $begingroup$
                        It is supposed to only negate the input in one direction, leaving it as-is in the other. Clearly, 1-character solution cannot be valid.
                        $endgroup$
                        – Adám
                        7 hours ago




                        $begingroup$
                        It is supposed to only negate the input in one direction, leaving it as-is in the other. Clearly, 1-character solution cannot be valid.
                        $endgroup$
                        – Adám
                        7 hours ago












                        $begingroup$
                        My bad, I misunderstood
                        $endgroup$
                        – jasanborn
                        7 hours ago




                        $begingroup$
                        My bad, I misunderstood
                        $endgroup$
                        – jasanborn
                        7 hours ago











                        1














                        $begingroup$


                        Jelly, 2 bytes



                        oN


                        Try it online! and its reverse.



                        oN - (input) OR ((input) negated)

                        No - ((input) negated) OR (input)





                        share|improve this answer









                        $endgroup$














                        • $begingroup$
                          Heh, you can also do ḷN, no need for the OR logic. :D
                          $endgroup$
                          – Erik the Outgolfer
                          5 hours ago







                        • 1




                          $begingroup$
                          Na, words give aN aesthetic effect :)
                          $endgroup$
                          – Jonathan Allan
                          5 hours ago















                        1














                        $begingroup$


                        Jelly, 2 bytes



                        oN


                        Try it online! and its reverse.



                        oN - (input) OR ((input) negated)

                        No - ((input) negated) OR (input)





                        share|improve this answer









                        $endgroup$














                        • $begingroup$
                          Heh, you can also do ḷN, no need for the OR logic. :D
                          $endgroup$
                          – Erik the Outgolfer
                          5 hours ago







                        • 1




                          $begingroup$
                          Na, words give aN aesthetic effect :)
                          $endgroup$
                          – Jonathan Allan
                          5 hours ago













                        1














                        1










                        1







                        $begingroup$


                        Jelly, 2 bytes



                        oN


                        Try it online! and its reverse.



                        oN - (input) OR ((input) negated)

                        No - ((input) negated) OR (input)





                        share|improve this answer









                        $endgroup$




                        Jelly, 2 bytes



                        oN


                        Try it online! and its reverse.



                        oN - (input) OR ((input) negated)

                        No - ((input) negated) OR (input)






                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered 7 hours ago









                        Jonathan AllanJonathan Allan

                        60.3k5 gold badges44 silver badges187 bronze badges




                        60.3k5 gold badges44 silver badges187 bronze badges














                        • $begingroup$
                          Heh, you can also do ḷN, no need for the OR logic. :D
                          $endgroup$
                          – Erik the Outgolfer
                          5 hours ago







                        • 1




                          $begingroup$
                          Na, words give aN aesthetic effect :)
                          $endgroup$
                          – Jonathan Allan
                          5 hours ago
















                        • $begingroup$
                          Heh, you can also do ḷN, no need for the OR logic. :D
                          $endgroup$
                          – Erik the Outgolfer
                          5 hours ago







                        • 1




                          $begingroup$
                          Na, words give aN aesthetic effect :)
                          $endgroup$
                          – Jonathan Allan
                          5 hours ago















                        $begingroup$
                        Heh, you can also do ḷN, no need for the OR logic. :D
                        $endgroup$
                        – Erik the Outgolfer
                        5 hours ago





                        $begingroup$
                        Heh, you can also do ḷN, no need for the OR logic. :D
                        $endgroup$
                        – Erik the Outgolfer
                        5 hours ago





                        1




                        1




                        $begingroup$
                        Na, words give aN aesthetic effect :)
                        $endgroup$
                        – Jonathan Allan
                        5 hours ago




                        $begingroup$
                        Na, words give aN aesthetic effect :)
                        $endgroup$
                        – Jonathan Allan
                        5 hours ago











                        1














                        $begingroup$


                        Labyrinth / Hexagony, 6 bytes



                        Labyrinth:



                        ?!@!`?


                        Try it online! and its reverse.



                        Hexagony:



                        ?!@!~?


                        Try it online! and its reverse.



                        How?



                        ? - take a signed integer
                        (` / ~) - negate
                        ! - output top-of-stack / current-memory-edge
                        @ - exit





                        share|improve this answer











                        $endgroup$



















                          1














                          $begingroup$


                          Labyrinth / Hexagony, 6 bytes



                          Labyrinth:



                          ?!@!`?


                          Try it online! and its reverse.



                          Hexagony:



                          ?!@!~?


                          Try it online! and its reverse.



                          How?



                          ? - take a signed integer
                          (` / ~) - negate
                          ! - output top-of-stack / current-memory-edge
                          @ - exit





                          share|improve this answer











                          $endgroup$

















                            1














                            1










                            1







                            $begingroup$


                            Labyrinth / Hexagony, 6 bytes



                            Labyrinth:



                            ?!@!`?


                            Try it online! and its reverse.



                            Hexagony:



                            ?!@!~?


                            Try it online! and its reverse.



                            How?



                            ? - take a signed integer
                            (` / ~) - negate
                            ! - output top-of-stack / current-memory-edge
                            @ - exit





                            share|improve this answer











                            $endgroup$




                            Labyrinth / Hexagony, 6 bytes



                            Labyrinth:



                            ?!@!`?


                            Try it online! and its reverse.



                            Hexagony:



                            ?!@!~?


                            Try it online! and its reverse.



                            How?



                            ? - take a signed integer
                            (` / ~) - negate
                            ! - output top-of-stack / current-memory-edge
                            @ - exit






                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited 6 hours ago

























                            answered 6 hours ago









                            Jonathan AllanJonathan Allan

                            60.3k5 gold badges44 silver badges187 bronze badges




                            60.3k5 gold badges44 silver badges187 bronze badges
























                                1














                                $begingroup$


                                Perl 6 / Raku, 3 bytes





                                *-0


                                Try it online!



                                Creates a Whatever code block. Read in normally its standard block equivalent is -> x x - 0, but in reverse it becomes -> x 0 - x.






                                share|improve this answer









                                $endgroup$



















                                  1














                                  $begingroup$


                                  Perl 6 / Raku, 3 bytes





                                  *-0


                                  Try it online!



                                  Creates a Whatever code block. Read in normally its standard block equivalent is -> x x - 0, but in reverse it becomes -> x 0 - x.






                                  share|improve this answer









                                  $endgroup$

















                                    1














                                    1










                                    1







                                    $begingroup$


                                    Perl 6 / Raku, 3 bytes





                                    *-0


                                    Try it online!



                                    Creates a Whatever code block. Read in normally its standard block equivalent is -> x x - 0, but in reverse it becomes -> x 0 - x.






                                    share|improve this answer









                                    $endgroup$




                                    Perl 6 / Raku, 3 bytes





                                    *-0


                                    Try it online!



                                    Creates a Whatever code block. Read in normally its standard block equivalent is -> x x - 0, but in reverse it becomes -> x 0 - x.







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered 4 hours ago









                                    guifaguifa

                                    7033 silver badges10 bronze badges




                                    7033 silver badges10 bronze badges
























                                        1














                                        $begingroup$


                                        Klein, 2 bytes



                                        Works in all 12 topologies!



                                        @-


                                        Try it online!



                                        Reverse



                                        -@


                                        Try it online!



                                        - negates the input and @ ends the program






                                        share|improve this answer











                                        $endgroup$



















                                          1














                                          $begingroup$


                                          Klein, 2 bytes



                                          Works in all 12 topologies!



                                          @-


                                          Try it online!



                                          Reverse



                                          -@


                                          Try it online!



                                          - negates the input and @ ends the program






                                          share|improve this answer











                                          $endgroup$

















                                            1














                                            1










                                            1







                                            $begingroup$


                                            Klein, 2 bytes



                                            Works in all 12 topologies!



                                            @-


                                            Try it online!



                                            Reverse



                                            -@


                                            Try it online!



                                            - negates the input and @ ends the program






                                            share|improve this answer











                                            $endgroup$




                                            Klein, 2 bytes



                                            Works in all 12 topologies!



                                            @-


                                            Try it online!



                                            Reverse



                                            -@


                                            Try it online!



                                            - negates the input and @ ends the program







                                            share|improve this answer














                                            share|improve this answer



                                            share|improve this answer








                                            edited 2 hours ago

























                                            answered 6 hours ago









                                            Sriotchilism O'ZaicSriotchilism O'Zaic

                                            37.9k10 gold badges169 silver badges383 bronze badges




                                            37.9k10 gold badges169 silver badges383 bronze badges
























                                                1














                                                $begingroup$


                                                J, 3 bytes



                                                -&0


                                                Try it online!



                                                -&0 is "argument minus 0"



                                                0&- is "0 minus argument"






                                                share|improve this answer









                                                $endgroup$










                                                • 1




                                                  $begingroup$
                                                  this is really quite nice :)
                                                  $endgroup$
                                                  – Conor O'Brien
                                                  41 mins ago















                                                1














                                                $begingroup$


                                                J, 3 bytes



                                                -&0


                                                Try it online!



                                                -&0 is "argument minus 0"



                                                0&- is "0 minus argument"






                                                share|improve this answer









                                                $endgroup$










                                                • 1




                                                  $begingroup$
                                                  this is really quite nice :)
                                                  $endgroup$
                                                  – Conor O'Brien
                                                  41 mins ago













                                                1














                                                1










                                                1







                                                $begingroup$


                                                J, 3 bytes



                                                -&0


                                                Try it online!



                                                -&0 is "argument minus 0"



                                                0&- is "0 minus argument"






                                                share|improve this answer









                                                $endgroup$




                                                J, 3 bytes



                                                -&0


                                                Try it online!



                                                -&0 is "argument minus 0"



                                                0&- is "0 minus argument"







                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered 1 hour ago









                                                JonahJonah

                                                4,8022 gold badges12 silver badges22 bronze badges




                                                4,8022 gold badges12 silver badges22 bronze badges










                                                • 1




                                                  $begingroup$
                                                  this is really quite nice :)
                                                  $endgroup$
                                                  – Conor O'Brien
                                                  41 mins ago












                                                • 1




                                                  $begingroup$
                                                  this is really quite nice :)
                                                  $endgroup$
                                                  – Conor O'Brien
                                                  41 mins ago







                                                1




                                                1




                                                $begingroup$
                                                this is really quite nice :)
                                                $endgroup$
                                                – Conor O'Brien
                                                41 mins ago




                                                $begingroup$
                                                this is really quite nice :)
                                                $endgroup$
                                                – Conor O'Brien
                                                41 mins ago











                                                0














                                                $begingroup$


                                                Triangular, 8 bytes



                                                $.%..|.$


                                                Try it online!



                                                Ungolfed:



                                                 $ Read an integer
                                                . % Output it
                                                . . | Negate (doesn't matter here)
                                                . $


                                                Reversed:



                                                $.|..%.$


                                                Try it online!






                                                share|improve this answer









                                                $endgroup$



















                                                  0














                                                  $begingroup$


                                                  Triangular, 8 bytes



                                                  $.%..|.$


                                                  Try it online!



                                                  Ungolfed:



                                                   $ Read an integer
                                                  . % Output it
                                                  . . | Negate (doesn't matter here)
                                                  . $


                                                  Reversed:



                                                  $.|..%.$


                                                  Try it online!






                                                  share|improve this answer









                                                  $endgroup$

















                                                    0














                                                    0










                                                    0







                                                    $begingroup$


                                                    Triangular, 8 bytes



                                                    $.%..|.$


                                                    Try it online!



                                                    Ungolfed:



                                                     $ Read an integer
                                                    . % Output it
                                                    . . | Negate (doesn't matter here)
                                                    . $


                                                    Reversed:



                                                    $.|..%.$


                                                    Try it online!






                                                    share|improve this answer









                                                    $endgroup$




                                                    Triangular, 8 bytes



                                                    $.%..|.$


                                                    Try it online!



                                                    Ungolfed:



                                                     $ Read an integer
                                                    . % Output it
                                                    . . | Negate (doesn't matter here)
                                                    . $


                                                    Reversed:



                                                    $.|..%.$


                                                    Try it online!







                                                    share|improve this answer












                                                    share|improve this answer



                                                    share|improve this answer










                                                    answered 8 hours ago









                                                    squidsquid

                                                    1,0711 silver badge10 bronze badges




                                                    1,0711 silver badge10 bronze badges
























                                                        0














                                                        $begingroup$


                                                        Japt, 3 bytes



                                                        TnU


                                                        Try it | Reversed



                                                        Same method as my earlier solution, with T being 0 and U being the input.






                                                        share|improve this answer









                                                        $endgroup$



















                                                          0














                                                          $begingroup$


                                                          Japt, 3 bytes



                                                          TnU


                                                          Try it | Reversed



                                                          Same method as my earlier solution, with T being 0 and U being the input.






                                                          share|improve this answer









                                                          $endgroup$

















                                                            0














                                                            0










                                                            0







                                                            $begingroup$


                                                            Japt, 3 bytes



                                                            TnU


                                                            Try it | Reversed



                                                            Same method as my earlier solution, with T being 0 and U being the input.






                                                            share|improve this answer









                                                            $endgroup$




                                                            Japt, 3 bytes



                                                            TnU


                                                            Try it | Reversed



                                                            Same method as my earlier solution, with T being 0 and U being the input.







                                                            share|improve this answer












                                                            share|improve this answer



                                                            share|improve this answer










                                                            answered 7 hours ago









                                                            ShaggyShaggy

                                                            21.6k3 gold badges21 silver badges72 bronze badges




                                                            21.6k3 gold badges21 silver badges72 bronze badges
























                                                                0














                                                                $begingroup$


                                                                V (vim), 5 bytes



                                                                É-ó--


                                                                Try it online!



                                                                Hexdump:



                                                                00000000: c92d f32d 2d .-.--





                                                                share|improve this answer









                                                                $endgroup$



















                                                                  0














                                                                  $begingroup$


                                                                  V (vim), 5 bytes



                                                                  É-ó--


                                                                  Try it online!



                                                                  Hexdump:



                                                                  00000000: c92d f32d 2d .-.--





                                                                  share|improve this answer









                                                                  $endgroup$

















                                                                    0














                                                                    0










                                                                    0







                                                                    $begingroup$


                                                                    V (vim), 5 bytes



                                                                    É-ó--


                                                                    Try it online!



                                                                    Hexdump:



                                                                    00000000: c92d f32d 2d .-.--





                                                                    share|improve this answer









                                                                    $endgroup$




                                                                    V (vim), 5 bytes



                                                                    É-ó--


                                                                    Try it online!



                                                                    Hexdump:



                                                                    00000000: c92d f32d 2d .-.--






                                                                    share|improve this answer












                                                                    share|improve this answer



                                                                    share|improve this answer










                                                                    answered 7 hours ago









                                                                    DJMcMayhemDJMcMayhem

                                                                    42.3k12 gold badges160 silver badges330 bronze badges




                                                                    42.3k12 gold badges160 silver badges330 bronze badges
























                                                                        0














                                                                        $begingroup$


                                                                        APL (Dyalog Unicode), 13 bytes





                                                                        (⊢-∘0)⍝)⊢-∘0(


                                                                        Try it online!



                                                                        Trivial answer. Returns arg-0 or 0-arg.






                                                                        share|improve this answer









                                                                        $endgroup$














                                                                        • $begingroup$
                                                                          Whoa, this can be done trivially in three bytes!
                                                                          $endgroup$
                                                                          – Adám
                                                                          7 hours ago















                                                                        0














                                                                        $begingroup$


                                                                        APL (Dyalog Unicode), 13 bytes





                                                                        (⊢-∘0)⍝)⊢-∘0(


                                                                        Try it online!



                                                                        Trivial answer. Returns arg-0 or 0-arg.






                                                                        share|improve this answer









                                                                        $endgroup$














                                                                        • $begingroup$
                                                                          Whoa, this can be done trivially in three bytes!
                                                                          $endgroup$
                                                                          – Adám
                                                                          7 hours ago













                                                                        0














                                                                        0










                                                                        0







                                                                        $begingroup$


                                                                        APL (Dyalog Unicode), 13 bytes





                                                                        (⊢-∘0)⍝)⊢-∘0(


                                                                        Try it online!



                                                                        Trivial answer. Returns arg-0 or 0-arg.






                                                                        share|improve this answer









                                                                        $endgroup$




                                                                        APL (Dyalog Unicode), 13 bytes





                                                                        (⊢-∘0)⍝)⊢-∘0(


                                                                        Try it online!



                                                                        Trivial answer. Returns arg-0 or 0-arg.







                                                                        share|improve this answer












                                                                        share|improve this answer



                                                                        share|improve this answer










                                                                        answered 7 hours ago









                                                                        J. SalléJ. Sallé

                                                                        2,5984 silver badges24 bronze badges




                                                                        2,5984 silver badges24 bronze badges














                                                                        • $begingroup$
                                                                          Whoa, this can be done trivially in three bytes!
                                                                          $endgroup$
                                                                          – Adám
                                                                          7 hours ago
















                                                                        • $begingroup$
                                                                          Whoa, this can be done trivially in three bytes!
                                                                          $endgroup$
                                                                          – Adám
                                                                          7 hours ago















                                                                        $begingroup$
                                                                        Whoa, this can be done trivially in three bytes!
                                                                        $endgroup$
                                                                        – Adám
                                                                        7 hours ago




                                                                        $begingroup$
                                                                        Whoa, this can be done trivially in three bytes!
                                                                        $endgroup$
                                                                        – Adám
                                                                        7 hours ago











                                                                        0














                                                                        $begingroup$

                                                                        JavaScript, 11 bytes



                                                                        n=>n//n->=n


                                                                        Try it Online! | Reversed






                                                                        share|improve this answer









                                                                        $endgroup$



















                                                                          0














                                                                          $begingroup$

                                                                          JavaScript, 11 bytes



                                                                          n=>n//n->=n


                                                                          Try it Online! | Reversed






                                                                          share|improve this answer









                                                                          $endgroup$

















                                                                            0














                                                                            0










                                                                            0







                                                                            $begingroup$

                                                                            JavaScript, 11 bytes



                                                                            n=>n//n->=n


                                                                            Try it Online! | Reversed






                                                                            share|improve this answer









                                                                            $endgroup$



                                                                            JavaScript, 11 bytes



                                                                            n=>n//n->=n


                                                                            Try it Online! | Reversed







                                                                            share|improve this answer












                                                                            share|improve this answer



                                                                            share|improve this answer










                                                                            answered 6 hours ago









                                                                            ShaggyShaggy

                                                                            21.6k3 gold badges21 silver badges72 bronze badges




                                                                            21.6k3 gold badges21 silver badges72 bronze badges
























                                                                                0














                                                                                $begingroup$


                                                                                C++ (gcc), 29 bytes



                                                                                Function-like macro:



                                                                                #define f(x)-x//x)x(g enifed#


                                                                                Try it online!






                                                                                share|improve this answer









                                                                                $endgroup$



















                                                                                  0














                                                                                  $begingroup$


                                                                                  C++ (gcc), 29 bytes



                                                                                  Function-like macro:



                                                                                  #define f(x)-x//x)x(g enifed#


                                                                                  Try it online!






                                                                                  share|improve this answer









                                                                                  $endgroup$

















                                                                                    0














                                                                                    0










                                                                                    0







                                                                                    $begingroup$


                                                                                    C++ (gcc), 29 bytes



                                                                                    Function-like macro:



                                                                                    #define f(x)-x//x)x(g enifed#


                                                                                    Try it online!






                                                                                    share|improve this answer









                                                                                    $endgroup$




                                                                                    C++ (gcc), 29 bytes



                                                                                    Function-like macro:



                                                                                    #define f(x)-x//x)x(g enifed#


                                                                                    Try it online!







                                                                                    share|improve this answer












                                                                                    share|improve this answer



                                                                                    share|improve this answer










                                                                                    answered 6 hours ago









                                                                                    NishiokaNishioka

                                                                                    1614 bronze badges




                                                                                    1614 bronze badges
























                                                                                        0














                                                                                        $begingroup$


                                                                                        Befunge-98 (FBBI), 6 bytes



                                                                                        &.@.-&


                                                                                        Try it online! Try it reversed!






                                                                                        share|improve this answer









                                                                                        $endgroup$



















                                                                                          0














                                                                                          $begingroup$


                                                                                          Befunge-98 (FBBI), 6 bytes



                                                                                          &.@.-&


                                                                                          Try it online! Try it reversed!






                                                                                          share|improve this answer









                                                                                          $endgroup$

















                                                                                            0














                                                                                            0










                                                                                            0







                                                                                            $begingroup$


                                                                                            Befunge-98 (FBBI), 6 bytes



                                                                                            &.@.-&


                                                                                            Try it online! Try it reversed!






                                                                                            share|improve this answer









                                                                                            $endgroup$




                                                                                            Befunge-98 (FBBI), 6 bytes



                                                                                            &.@.-&


                                                                                            Try it online! Try it reversed!







                                                                                            share|improve this answer












                                                                                            share|improve this answer



                                                                                            share|improve this answer










                                                                                            answered 6 hours ago









                                                                                            ovsovs

                                                                                            20.2k2 gold badges13 silver badges62 bronze badges




                                                                                            20.2k2 gold badges13 silver badges62 bronze badges
























                                                                                                0














                                                                                                $begingroup$


                                                                                                Stax, 2 bytes



                                                                                                pN


                                                                                                Run and debug it






                                                                                                share|improve this answer









                                                                                                $endgroup$



















                                                                                                  0














                                                                                                  $begingroup$


                                                                                                  Stax, 2 bytes



                                                                                                  pN


                                                                                                  Run and debug it






                                                                                                  share|improve this answer









                                                                                                  $endgroup$

















                                                                                                    0














                                                                                                    0










                                                                                                    0







                                                                                                    $begingroup$


                                                                                                    Stax, 2 bytes



                                                                                                    pN


                                                                                                    Run and debug it






                                                                                                    share|improve this answer









                                                                                                    $endgroup$




                                                                                                    Stax, 2 bytes



                                                                                                    pN


                                                                                                    Run and debug it







                                                                                                    share|improve this answer












                                                                                                    share|improve this answer



                                                                                                    share|improve this answer










                                                                                                    answered 6 hours ago









                                                                                                    OliverOliver

                                                                                                    6,6702 gold badges9 silver badges36 bronze badges




                                                                                                    6,6702 gold badges9 silver badges36 bronze badges
























                                                                                                        0














                                                                                                        $begingroup$


                                                                                                        Retina 0.8.2, 13 bytes



                                                                                                        -*$1#$
                                                                                                        )^(|-^


                                                                                                        Try it online! It's impossible for the first line to match anything, so nothing happens. In reverse:



                                                                                                        ^-|(^)
                                                                                                        $#1$*-


                                                                                                        Try it online! Explanation: Either a leading - or a leading empty string is matched. This is replaced with - repeated according to the number of empty strings that were matched.






                                                                                                        share|improve this answer









                                                                                                        $endgroup$



















                                                                                                          0














                                                                                                          $begingroup$


                                                                                                          Retina 0.8.2, 13 bytes



                                                                                                          -*$1#$
                                                                                                          )^(|-^


                                                                                                          Try it online! It's impossible for the first line to match anything, so nothing happens. In reverse:



                                                                                                          ^-|(^)
                                                                                                          $#1$*-


                                                                                                          Try it online! Explanation: Either a leading - or a leading empty string is matched. This is replaced with - repeated according to the number of empty strings that were matched.






                                                                                                          share|improve this answer









                                                                                                          $endgroup$

















                                                                                                            0














                                                                                                            0










                                                                                                            0







                                                                                                            $begingroup$


                                                                                                            Retina 0.8.2, 13 bytes



                                                                                                            -*$1#$
                                                                                                            )^(|-^


                                                                                                            Try it online! It's impossible for the first line to match anything, so nothing happens. In reverse:



                                                                                                            ^-|(^)
                                                                                                            $#1$*-


                                                                                                            Try it online! Explanation: Either a leading - or a leading empty string is matched. This is replaced with - repeated according to the number of empty strings that were matched.






                                                                                                            share|improve this answer









                                                                                                            $endgroup$




                                                                                                            Retina 0.8.2, 13 bytes



                                                                                                            -*$1#$
                                                                                                            )^(|-^


                                                                                                            Try it online! It's impossible for the first line to match anything, so nothing happens. In reverse:



                                                                                                            ^-|(^)
                                                                                                            $#1$*-


                                                                                                            Try it online! Explanation: Either a leading - or a leading empty string is matched. This is replaced with - repeated according to the number of empty strings that were matched.







                                                                                                            share|improve this answer












                                                                                                            share|improve this answer



                                                                                                            share|improve this answer










                                                                                                            answered 3 hours ago









                                                                                                            NeilNeil

                                                                                                            88.9k8 gold badges46 silver badges188 bronze badges




                                                                                                            88.9k8 gold badges46 silver badges188 bronze badges
























                                                                                                                0














                                                                                                                $begingroup$


                                                                                                                Haskell, 8 bytes



                                                                                                                Anonymous identity function, turning into subtraction from 0 when reversed.





                                                                                                                id--)-0(


                                                                                                                Try it online!



                                                                                                                Reversed:



                                                                                                                (0-)--di


                                                                                                                Try it online!






                                                                                                                share|improve this answer









                                                                                                                $endgroup$



















                                                                                                                  0














                                                                                                                  $begingroup$


                                                                                                                  Haskell, 8 bytes



                                                                                                                  Anonymous identity function, turning into subtraction from 0 when reversed.





                                                                                                                  id--)-0(


                                                                                                                  Try it online!



                                                                                                                  Reversed:



                                                                                                                  (0-)--di


                                                                                                                  Try it online!






                                                                                                                  share|improve this answer









                                                                                                                  $endgroup$

















                                                                                                                    0














                                                                                                                    0










                                                                                                                    0







                                                                                                                    $begingroup$


                                                                                                                    Haskell, 8 bytes



                                                                                                                    Anonymous identity function, turning into subtraction from 0 when reversed.





                                                                                                                    id--)-0(


                                                                                                                    Try it online!



                                                                                                                    Reversed:



                                                                                                                    (0-)--di


                                                                                                                    Try it online!






                                                                                                                    share|improve this answer









                                                                                                                    $endgroup$




                                                                                                                    Haskell, 8 bytes



                                                                                                                    Anonymous identity function, turning into subtraction from 0 when reversed.





                                                                                                                    id--)-0(


                                                                                                                    Try it online!



                                                                                                                    Reversed:



                                                                                                                    (0-)--di


                                                                                                                    Try it online!







                                                                                                                    share|improve this answer












                                                                                                                    share|improve this answer



                                                                                                                    share|improve this answer










                                                                                                                    answered 3 hours ago









                                                                                                                    Ørjan JohansenØrjan Johansen

                                                                                                                    6,7041 gold badge15 silver badges34 bronze badges




                                                                                                                    6,7041 gold badge15 silver badges34 bronze badges
























                                                                                                                        0














                                                                                                                        $begingroup$


                                                                                                                        Wolfram Language (Mathematica), 9 bytes



                                                                                                                        1&0+#-0&1


                                                                                                                        Try it online!



                                                                                                                        Forward: read ((1)&*0+#-0)&*1=#&



                                                                                                                        Backward: read ((1)&*0-#+0)&*1=-#&






                                                                                                                        share|improve this answer











                                                                                                                        $endgroup$



















                                                                                                                          0














                                                                                                                          $begingroup$


                                                                                                                          Wolfram Language (Mathematica), 9 bytes



                                                                                                                          1&0+#-0&1


                                                                                                                          Try it online!



                                                                                                                          Forward: read ((1)&*0+#-0)&*1=#&



                                                                                                                          Backward: read ((1)&*0-#+0)&*1=-#&






                                                                                                                          share|improve this answer











                                                                                                                          $endgroup$

















                                                                                                                            0














                                                                                                                            0










                                                                                                                            0







                                                                                                                            $begingroup$


                                                                                                                            Wolfram Language (Mathematica), 9 bytes



                                                                                                                            1&0+#-0&1


                                                                                                                            Try it online!



                                                                                                                            Forward: read ((1)&*0+#-0)&*1=#&



                                                                                                                            Backward: read ((1)&*0-#+0)&*1=-#&






                                                                                                                            share|improve this answer











                                                                                                                            $endgroup$




                                                                                                                            Wolfram Language (Mathematica), 9 bytes



                                                                                                                            1&0+#-0&1


                                                                                                                            Try it online!



                                                                                                                            Forward: read ((1)&*0+#-0)&*1=#&



                                                                                                                            Backward: read ((1)&*0-#+0)&*1=-#&







                                                                                                                            share|improve this answer














                                                                                                                            share|improve this answer



                                                                                                                            share|improve this answer








                                                                                                                            edited 3 hours ago

























                                                                                                                            answered 3 hours ago









                                                                                                                            attinatattinat

                                                                                                                            2,7463 silver badges11 bronze badges




                                                                                                                            2,7463 silver badges11 bronze badges































                                                                                                                                draft saved

                                                                                                                                draft discarded















































                                                                                                                                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%2f193021%2fi-reverse-the-source-code-you-negate-the-input%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

                                                                                                                                ParseJSON using SSJSUsing AMPscript with SSJS ActivitiesHow to resubscribe a user in Marketing cloud using SSJS?Pulling Subscriber Status from Lists using SSJSRetrieving Emails using SSJSProblem in updating DE using SSJSUsing SSJS to send single email in Marketing CloudError adding EmailSendDefinition using SSJS

                                                                                                                                Кампала Садржај Географија Географија Историја Становништво Привреда Партнерски градови Референце Спољашње везе Мени за навигацију0°11′ СГШ; 32°20′ ИГД / 0.18° СГШ; 32.34° ИГД / 0.18; 32.340°11′ СГШ; 32°20′ ИГД / 0.18° СГШ; 32.34° ИГД / 0.18; 32.34МедијиПодациЗванични веб-сајту

                                                                                                                                19. јануар Садржај Догађаји Рођења Смрти Празници и дани сећања Види још Референце Мени за навигацијуу