How to get frame around every function without any evaluation?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite
3












Is there a good universal method that allows the making of a frame around every function. In the output, functions should remain unchanged (no evaluation, or any other changes) and each function should have frame.



For example, to make the frame around Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]] something like MakeNiceFrames[Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]]]. An output should look exactly same as in input Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]] with every function (including head and closing bracket) separately framed.



It will be nice to have that kind of framing for visual separations of functions while debugging. I have experimented with Framed. But each function needs the use of separate Framed function and functions are actually evaluated, what makes it makes inconvenient to use.










share|improve this question























  • Related: 15516.
    – Kuba♦
    3 hours ago






  • 1




    For formal clarity you should specify if you need framed function together with all its arguments or just the function's name framed (i suspect the former). A side note: triple-click any function name (Head) and it will be selected from Head start to the closing bracket. Perhaps somehow useful for this problem if you don't want to have too many frames, which could be confusing.
    – Vitaliy Kaurov
    3 hours ago










  • @VitaliyKaurov First assumption is right. I edited question and part of it looks as "An output should look exactly same as in input Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]] with every function (including head and closing bracket) separately framed." Do you think anything other should be added?
    – vasili111
    3 hours ago






  • 1




    TreeForm[Hold[ Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]] ]] meets the use case in a different (and possibly more useful) way.
    – Alan
    1 hour ago














up vote
2
down vote

favorite
3












Is there a good universal method that allows the making of a frame around every function. In the output, functions should remain unchanged (no evaluation, or any other changes) and each function should have frame.



For example, to make the frame around Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]] something like MakeNiceFrames[Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]]]. An output should look exactly same as in input Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]] with every function (including head and closing bracket) separately framed.



It will be nice to have that kind of framing for visual separations of functions while debugging. I have experimented with Framed. But each function needs the use of separate Framed function and functions are actually evaluated, what makes it makes inconvenient to use.










share|improve this question























  • Related: 15516.
    – Kuba♦
    3 hours ago






  • 1




    For formal clarity you should specify if you need framed function together with all its arguments or just the function's name framed (i suspect the former). A side note: triple-click any function name (Head) and it will be selected from Head start to the closing bracket. Perhaps somehow useful for this problem if you don't want to have too many frames, which could be confusing.
    – Vitaliy Kaurov
    3 hours ago










  • @VitaliyKaurov First assumption is right. I edited question and part of it looks as "An output should look exactly same as in input Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]] with every function (including head and closing bracket) separately framed." Do you think anything other should be added?
    – vasili111
    3 hours ago






  • 1




    TreeForm[Hold[ Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]] ]] meets the use case in a different (and possibly more useful) way.
    – Alan
    1 hour ago












up vote
2
down vote

favorite
3









up vote
2
down vote

favorite
3






3





Is there a good universal method that allows the making of a frame around every function. In the output, functions should remain unchanged (no evaluation, or any other changes) and each function should have frame.



For example, to make the frame around Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]] something like MakeNiceFrames[Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]]]. An output should look exactly same as in input Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]] with every function (including head and closing bracket) separately framed.



It will be nice to have that kind of framing for visual separations of functions while debugging. I have experimented with Framed. But each function needs the use of separate Framed function and functions are actually evaluated, what makes it makes inconvenient to use.










share|improve this question















Is there a good universal method that allows the making of a frame around every function. In the output, functions should remain unchanged (no evaluation, or any other changes) and each function should have frame.



For example, to make the frame around Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]] something like MakeNiceFrames[Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]]]. An output should look exactly same as in input Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]] with every function (including head and closing bracket) separately framed.



It will be nice to have that kind of framing for visual separations of functions while debugging. I have experimented with Framed. But each function needs the use of separate Framed function and functions are actually evaluated, what makes it makes inconvenient to use.







debugging frame






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 3 hours ago

























asked 4 hours ago









vasili111

25317




25317











  • Related: 15516.
    – Kuba♦
    3 hours ago






  • 1




    For formal clarity you should specify if you need framed function together with all its arguments or just the function's name framed (i suspect the former). A side note: triple-click any function name (Head) and it will be selected from Head start to the closing bracket. Perhaps somehow useful for this problem if you don't want to have too many frames, which could be confusing.
    – Vitaliy Kaurov
    3 hours ago










  • @VitaliyKaurov First assumption is right. I edited question and part of it looks as "An output should look exactly same as in input Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]] with every function (including head and closing bracket) separately framed." Do you think anything other should be added?
    – vasili111
    3 hours ago






  • 1




    TreeForm[Hold[ Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]] ]] meets the use case in a different (and possibly more useful) way.
    – Alan
    1 hour ago
















  • Related: 15516.
    – Kuba♦
    3 hours ago






  • 1




    For formal clarity you should specify if you need framed function together with all its arguments or just the function's name framed (i suspect the former). A side note: triple-click any function name (Head) and it will be selected from Head start to the closing bracket. Perhaps somehow useful for this problem if you don't want to have too many frames, which could be confusing.
    – Vitaliy Kaurov
    3 hours ago










  • @VitaliyKaurov First assumption is right. I edited question and part of it looks as "An output should look exactly same as in input Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]] with every function (including head and closing bracket) separately framed." Do you think anything other should be added?
    – vasili111
    3 hours ago






  • 1




    TreeForm[Hold[ Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]] ]] meets the use case in a different (and possibly more useful) way.
    – Alan
    1 hour ago















Related: 15516.
– Kuba♦
3 hours ago




Related: 15516.
– Kuba♦
3 hours ago




1




1




For formal clarity you should specify if you need framed function together with all its arguments or just the function's name framed (i suspect the former). A side note: triple-click any function name (Head) and it will be selected from Head start to the closing bracket. Perhaps somehow useful for this problem if you don't want to have too many frames, which could be confusing.
– Vitaliy Kaurov
3 hours ago




For formal clarity you should specify if you need framed function together with all its arguments or just the function's name framed (i suspect the former). A side note: triple-click any function name (Head) and it will be selected from Head start to the closing bracket. Perhaps somehow useful for this problem if you don't want to have too many frames, which could be confusing.
– Vitaliy Kaurov
3 hours ago












@VitaliyKaurov First assumption is right. I edited question and part of it looks as "An output should look exactly same as in input Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]] with every function (including head and closing bracket) separately framed." Do you think anything other should be added?
– vasili111
3 hours ago




@VitaliyKaurov First assumption is right. I edited question and part of it looks as "An output should look exactly same as in input Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]] with every function (including head and closing bracket) separately framed." Do you think anything other should be added?
– vasili111
3 hours ago




1




1




TreeForm[Hold[ Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]] ]] meets the use case in a different (and possibly more useful) way.
– Alan
1 hour ago




TreeForm[Hold[ Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]] ]] meets the use case in a different (and possibly more useful) way.
– Alan
1 hour ago










2 Answers
2






active

oldest

votes

















up vote
3
down vote













I don't know how useful this construct would be, but one idea is to use Inactivate:



ReplaceRepeated[
Inactivate[Plus[1,Plus[Plus[1,1],Plus[Plus[1,1],1]]]],
Inactive[h_][a___] :> Framed[HoldForm[h][a]]
]


enter image description here






share|improve this answer
















  • 1




    Could you please add how Inactivate, HoldForm and Hold differ. This seems to enable much shorter code than mine.
    – Johu
    58 mins ago

















up vote
2
down vote














But each function needs the use of separate Framed function




Will solve it by using RuleDelayed and Replace with levelspec.




and functions are actually evaluated, what makes it makes inconvenient to use.




Will keep it from evaluating using Hold.



f = Hold[Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]]];
Replace[f, z_ :> Framed[z], 2, -1]


enter image description here



And my attempt to keep the head from evaluating



f = Hold[Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]]];
Replace[f,
z : h_[args___] :> Row[h, Framed[Row[args, ","]]], 1, -1][[1]]

Replace[f,
h_[args___] :>
Row[h, "[", Row[args, ","], "]", Frame -> True], 1, -1][[1]]


enter image description hereenter image description here



To be honest, I was amazed when I learned z:h_ kind of syntax. You can understand how it works, if you read carefully the description part of Pattern.






share|improve this answer






















    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: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    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%2f182056%2fhow-to-get-frame-around-every-function-without-any-evaluation%23new-answer', 'question_page');

    );

    Post as a guest






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    3
    down vote













    I don't know how useful this construct would be, but one idea is to use Inactivate:



    ReplaceRepeated[
    Inactivate[Plus[1,Plus[Plus[1,1],Plus[Plus[1,1],1]]]],
    Inactive[h_][a___] :> Framed[HoldForm[h][a]]
    ]


    enter image description here






    share|improve this answer
















    • 1




      Could you please add how Inactivate, HoldForm and Hold differ. This seems to enable much shorter code than mine.
      – Johu
      58 mins ago














    up vote
    3
    down vote













    I don't know how useful this construct would be, but one idea is to use Inactivate:



    ReplaceRepeated[
    Inactivate[Plus[1,Plus[Plus[1,1],Plus[Plus[1,1],1]]]],
    Inactive[h_][a___] :> Framed[HoldForm[h][a]]
    ]


    enter image description here






    share|improve this answer
















    • 1




      Could you please add how Inactivate, HoldForm and Hold differ. This seems to enable much shorter code than mine.
      – Johu
      58 mins ago












    up vote
    3
    down vote










    up vote
    3
    down vote









    I don't know how useful this construct would be, but one idea is to use Inactivate:



    ReplaceRepeated[
    Inactivate[Plus[1,Plus[Plus[1,1],Plus[Plus[1,1],1]]]],
    Inactive[h_][a___] :> Framed[HoldForm[h][a]]
    ]


    enter image description here






    share|improve this answer












    I don't know how useful this construct would be, but one idea is to use Inactivate:



    ReplaceRepeated[
    Inactivate[Plus[1,Plus[Plus[1,1],Plus[Plus[1,1],1]]]],
    Inactive[h_][a___] :> Framed[HoldForm[h][a]]
    ]


    enter image description here







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered 1 hour ago









    Carl Woll

    57.2k273149




    57.2k273149







    • 1




      Could you please add how Inactivate, HoldForm and Hold differ. This seems to enable much shorter code than mine.
      – Johu
      58 mins ago












    • 1




      Could you please add how Inactivate, HoldForm and Hold differ. This seems to enable much shorter code than mine.
      – Johu
      58 mins ago







    1




    1




    Could you please add how Inactivate, HoldForm and Hold differ. This seems to enable much shorter code than mine.
    – Johu
    58 mins ago




    Could you please add how Inactivate, HoldForm and Hold differ. This seems to enable much shorter code than mine.
    – Johu
    58 mins ago










    up vote
    2
    down vote














    But each function needs the use of separate Framed function




    Will solve it by using RuleDelayed and Replace with levelspec.




    and functions are actually evaluated, what makes it makes inconvenient to use.




    Will keep it from evaluating using Hold.



    f = Hold[Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]]];
    Replace[f, z_ :> Framed[z], 2, -1]


    enter image description here



    And my attempt to keep the head from evaluating



    f = Hold[Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]]];
    Replace[f,
    z : h_[args___] :> Row[h, Framed[Row[args, ","]]], 1, -1][[1]]

    Replace[f,
    h_[args___] :>
    Row[h, "[", Row[args, ","], "]", Frame -> True], 1, -1][[1]]


    enter image description hereenter image description here



    To be honest, I was amazed when I learned z:h_ kind of syntax. You can understand how it works, if you read carefully the description part of Pattern.






    share|improve this answer


























      up vote
      2
      down vote














      But each function needs the use of separate Framed function




      Will solve it by using RuleDelayed and Replace with levelspec.




      and functions are actually evaluated, what makes it makes inconvenient to use.




      Will keep it from evaluating using Hold.



      f = Hold[Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]]];
      Replace[f, z_ :> Framed[z], 2, -1]


      enter image description here



      And my attempt to keep the head from evaluating



      f = Hold[Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]]];
      Replace[f,
      z : h_[args___] :> Row[h, Framed[Row[args, ","]]], 1, -1][[1]]

      Replace[f,
      h_[args___] :>
      Row[h, "[", Row[args, ","], "]", Frame -> True], 1, -1][[1]]


      enter image description hereenter image description here



      To be honest, I was amazed when I learned z:h_ kind of syntax. You can understand how it works, if you read carefully the description part of Pattern.






      share|improve this answer
























        up vote
        2
        down vote










        up vote
        2
        down vote










        But each function needs the use of separate Framed function




        Will solve it by using RuleDelayed and Replace with levelspec.




        and functions are actually evaluated, what makes it makes inconvenient to use.




        Will keep it from evaluating using Hold.



        f = Hold[Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]]];
        Replace[f, z_ :> Framed[z], 2, -1]


        enter image description here



        And my attempt to keep the head from evaluating



        f = Hold[Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]]];
        Replace[f,
        z : h_[args___] :> Row[h, Framed[Row[args, ","]]], 1, -1][[1]]

        Replace[f,
        h_[args___] :>
        Row[h, "[", Row[args, ","], "]", Frame -> True], 1, -1][[1]]


        enter image description hereenter image description here



        To be honest, I was amazed when I learned z:h_ kind of syntax. You can understand how it works, if you read carefully the description part of Pattern.






        share|improve this answer















        But each function needs the use of separate Framed function




        Will solve it by using RuleDelayed and Replace with levelspec.




        and functions are actually evaluated, what makes it makes inconvenient to use.




        Will keep it from evaluating using Hold.



        f = Hold[Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]]];
        Replace[f, z_ :> Framed[z], 2, -1]


        enter image description here



        And my attempt to keep the head from evaluating



        f = Hold[Plus[1, Plus[Plus[1, 1], Plus[Plus[1, 1], 1]]]];
        Replace[f,
        z : h_[args___] :> Row[h, Framed[Row[args, ","]]], 1, -1][[1]]

        Replace[f,
        h_[args___] :>
        Row[h, "[", Row[args, ","], "]", Frame -> True], 1, -1][[1]]


        enter image description hereenter image description here



        To be honest, I was amazed when I learned z:h_ kind of syntax. You can understand how it works, if you read carefully the description part of Pattern.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 2 hours ago

























        answered 3 hours ago









        Johu

        3,0661033




        3,0661033



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f182056%2fhow-to-get-frame-around-every-function-without-any-evaluation%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            Long meetings (6-7 hours a day): Being “babysat” by supervisor

            Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

            Confectionery