Drop 1st element of {#a, #b, #c} &











up vote
3
down vote

favorite












I pass the following to a function:



{#a, #b, #c} &


These are keys that are used in a list of associations.
There are instances where I want to pass only the last 2 elements, such as:



{#b, #c} &


Right now, I just rewrite it. But it seems like there should be a way to do this by getting rid of the first slot.



I looked at the full form and see that it's:



FullForm[{#a, #b, #c} &]



Function[List[Slot["a"], Slot["b"], Slot["c"]]]



I thought I could somehow get inside and drop Slot["a"], but can't seem to do it. I tried replacing Slot["a"] with a blank, but I'm left with a comma at the beginning of the list. I also tried Apply to change Function to List and doing it in the result. I couldn't.



Is there any way to get rid of the first element, #a, without rewriting the expression?










share|improve this question




























    up vote
    3
    down vote

    favorite












    I pass the following to a function:



    {#a, #b, #c} &


    These are keys that are used in a list of associations.
    There are instances where I want to pass only the last 2 elements, such as:



    {#b, #c} &


    Right now, I just rewrite it. But it seems like there should be a way to do this by getting rid of the first slot.



    I looked at the full form and see that it's:



    FullForm[{#a, #b, #c} &]



    Function[List[Slot["a"], Slot["b"], Slot["c"]]]



    I thought I could somehow get inside and drop Slot["a"], but can't seem to do it. I tried replacing Slot["a"] with a blank, but I'm left with a comma at the beginning of the list. I also tried Apply to change Function to List and doing it in the result. I couldn't.



    Is there any way to get rid of the first element, #a, without rewriting the expression?










    share|improve this question


























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      I pass the following to a function:



      {#a, #b, #c} &


      These are keys that are used in a list of associations.
      There are instances where I want to pass only the last 2 elements, such as:



      {#b, #c} &


      Right now, I just rewrite it. But it seems like there should be a way to do this by getting rid of the first slot.



      I looked at the full form and see that it's:



      FullForm[{#a, #b, #c} &]



      Function[List[Slot["a"], Slot["b"], Slot["c"]]]



      I thought I could somehow get inside and drop Slot["a"], but can't seem to do it. I tried replacing Slot["a"] with a blank, but I'm left with a comma at the beginning of the list. I also tried Apply to change Function to List and doing it in the result. I couldn't.



      Is there any way to get rid of the first element, #a, without rewriting the expression?










      share|improve this question















      I pass the following to a function:



      {#a, #b, #c} &


      These are keys that are used in a list of associations.
      There are instances where I want to pass only the last 2 elements, such as:



      {#b, #c} &


      Right now, I just rewrite it. But it seems like there should be a way to do this by getting rid of the first slot.



      I looked at the full form and see that it's:



      FullForm[{#a, #b, #c} &]



      Function[List[Slot["a"], Slot["b"], Slot["c"]]]



      I thought I could somehow get inside and drop Slot["a"], but can't seem to do it. I tried replacing Slot["a"] with a blank, but I'm left with a comma at the beginning of the list. I also tried Apply to change Function to List and doing it in the result. I couldn't.



      Is there any way to get rid of the first element, #a, without rewriting the expression?







      expression-manipulation slot






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 8 hours ago









      Kuba

      102k12199509




      102k12199509










      asked 9 hours ago









      Mitchell Kaplan

      1,6321026




      1,6321026






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          6
          down vote



          accepted










          You could pass it to Delete:



          Delete[#, {1, 1}] &[{#a, #b, #c} &]



          {#b, #c} &







          share|improve this answer




























            up vote
            4
            down vote













            foo = {#a, #b, #c} &;

            foo[[{1}, 2 ;;]]



            {#b, #c} &




            or, but only because we know there won't be any side effects:



            Evaluate /@ Rest /@ foo 



            {#b, #c} &




            or



            foo /. {_Slot, rest__Slot} :> {rest}


            At the end consider using an operator form of a KeyDrop



            bar = KeyTake[{"a", "b", "c"}];

            (Rest /@ bar)@<|"a" -> 1, "b" -> 1, "c" -> 1|>



            <|"b" -> 1, "c" -> 1|>







            share|improve this answer





















            • I accepted Coolwater's answer because it solved my problem simply. I appreciate the extra insight that your answer provided. Actually, I'll have to spend more time to really understand it though.
              – Mitchell Kaplan
              8 hours ago










            • @MitchellKaplan sure, btw, can you give a little insigth into how do you use it? Because it feels like a XY problem, maybe there is a better way anyway.
              – Kuba
              8 hours ago













            Your Answer





            StackExchange.ifUsing("editor", function () {
            return StackExchange.using("mathjaxEditing", function () {
            StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
            StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
            });
            });
            }, "mathjax-editing");

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

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

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


            }
            });














             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f186391%2fdrop-1st-element-of-a-b-c%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            6
            down vote



            accepted










            You could pass it to Delete:



            Delete[#, {1, 1}] &[{#a, #b, #c} &]



            {#b, #c} &







            share|improve this answer

























              up vote
              6
              down vote



              accepted










              You could pass it to Delete:



              Delete[#, {1, 1}] &[{#a, #b, #c} &]



              {#b, #c} &







              share|improve this answer























                up vote
                6
                down vote



                accepted







                up vote
                6
                down vote



                accepted






                You could pass it to Delete:



                Delete[#, {1, 1}] &[{#a, #b, #c} &]



                {#b, #c} &







                share|improve this answer












                You could pass it to Delete:



                Delete[#, {1, 1}] &[{#a, #b, #c} &]



                {#b, #c} &








                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 9 hours ago









                Coolwater

                14.2k32452




                14.2k32452






















                    up vote
                    4
                    down vote













                    foo = {#a, #b, #c} &;

                    foo[[{1}, 2 ;;]]



                    {#b, #c} &




                    or, but only because we know there won't be any side effects:



                    Evaluate /@ Rest /@ foo 



                    {#b, #c} &




                    or



                    foo /. {_Slot, rest__Slot} :> {rest}


                    At the end consider using an operator form of a KeyDrop



                    bar = KeyTake[{"a", "b", "c"}];

                    (Rest /@ bar)@<|"a" -> 1, "b" -> 1, "c" -> 1|>



                    <|"b" -> 1, "c" -> 1|>







                    share|improve this answer





















                    • I accepted Coolwater's answer because it solved my problem simply. I appreciate the extra insight that your answer provided. Actually, I'll have to spend more time to really understand it though.
                      – Mitchell Kaplan
                      8 hours ago










                    • @MitchellKaplan sure, btw, can you give a little insigth into how do you use it? Because it feels like a XY problem, maybe there is a better way anyway.
                      – Kuba
                      8 hours ago

















                    up vote
                    4
                    down vote













                    foo = {#a, #b, #c} &;

                    foo[[{1}, 2 ;;]]



                    {#b, #c} &




                    or, but only because we know there won't be any side effects:



                    Evaluate /@ Rest /@ foo 



                    {#b, #c} &




                    or



                    foo /. {_Slot, rest__Slot} :> {rest}


                    At the end consider using an operator form of a KeyDrop



                    bar = KeyTake[{"a", "b", "c"}];

                    (Rest /@ bar)@<|"a" -> 1, "b" -> 1, "c" -> 1|>



                    <|"b" -> 1, "c" -> 1|>







                    share|improve this answer





















                    • I accepted Coolwater's answer because it solved my problem simply. I appreciate the extra insight that your answer provided. Actually, I'll have to spend more time to really understand it though.
                      – Mitchell Kaplan
                      8 hours ago










                    • @MitchellKaplan sure, btw, can you give a little insigth into how do you use it? Because it feels like a XY problem, maybe there is a better way anyway.
                      – Kuba
                      8 hours ago















                    up vote
                    4
                    down vote










                    up vote
                    4
                    down vote









                    foo = {#a, #b, #c} &;

                    foo[[{1}, 2 ;;]]



                    {#b, #c} &




                    or, but only because we know there won't be any side effects:



                    Evaluate /@ Rest /@ foo 



                    {#b, #c} &




                    or



                    foo /. {_Slot, rest__Slot} :> {rest}


                    At the end consider using an operator form of a KeyDrop



                    bar = KeyTake[{"a", "b", "c"}];

                    (Rest /@ bar)@<|"a" -> 1, "b" -> 1, "c" -> 1|>



                    <|"b" -> 1, "c" -> 1|>







                    share|improve this answer












                    foo = {#a, #b, #c} &;

                    foo[[{1}, 2 ;;]]



                    {#b, #c} &




                    or, but only because we know there won't be any side effects:



                    Evaluate /@ Rest /@ foo 



                    {#b, #c} &




                    or



                    foo /. {_Slot, rest__Slot} :> {rest}


                    At the end consider using an operator form of a KeyDrop



                    bar = KeyTake[{"a", "b", "c"}];

                    (Rest /@ bar)@<|"a" -> 1, "b" -> 1, "c" -> 1|>



                    <|"b" -> 1, "c" -> 1|>








                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered 9 hours ago









                    Kuba

                    102k12199509




                    102k12199509












                    • I accepted Coolwater's answer because it solved my problem simply. I appreciate the extra insight that your answer provided. Actually, I'll have to spend more time to really understand it though.
                      – Mitchell Kaplan
                      8 hours ago










                    • @MitchellKaplan sure, btw, can you give a little insigth into how do you use it? Because it feels like a XY problem, maybe there is a better way anyway.
                      – Kuba
                      8 hours ago




















                    • I accepted Coolwater's answer because it solved my problem simply. I appreciate the extra insight that your answer provided. Actually, I'll have to spend more time to really understand it though.
                      – Mitchell Kaplan
                      8 hours ago










                    • @MitchellKaplan sure, btw, can you give a little insigth into how do you use it? Because it feels like a XY problem, maybe there is a better way anyway.
                      – Kuba
                      8 hours ago


















                    I accepted Coolwater's answer because it solved my problem simply. I appreciate the extra insight that your answer provided. Actually, I'll have to spend more time to really understand it though.
                    – Mitchell Kaplan
                    8 hours ago




                    I accepted Coolwater's answer because it solved my problem simply. I appreciate the extra insight that your answer provided. Actually, I'll have to spend more time to really understand it though.
                    – Mitchell Kaplan
                    8 hours ago












                    @MitchellKaplan sure, btw, can you give a little insigth into how do you use it? Because it feels like a XY problem, maybe there is a better way anyway.
                    – Kuba
                    8 hours ago






                    @MitchellKaplan sure, btw, can you give a little insigth into how do you use it? Because it feels like a XY problem, maybe there is a better way anyway.
                    – Kuba
                    8 hours ago




















                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f186391%2fdrop-1st-element-of-a-b-c%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

                    404 Error Contact Form 7 ajax form submitting

                    How to know if a Active Directory user can login interactively

                    TypeError: fit_transform() missing 1 required positional argument: 'X'