How can I use a Module anonymously as the function for /@?How Can I use Solve/Reduce OutputHow Can I Use...

Are all power cords made equal?

How can guns be countered by melee combat without raw-ability or exceptional explanations?

What does an unprocessed RAW file look like?

How can I use a Module anonymously as the function for /@?

SFDX CLI - Locked with an active writer?

How do I avoid the "chosen hero" feeling?

Identical projects by students at two different colleges: still plagiarism?

How bad is a Computer Science course that doesn't teach Design Patterns?

Cryptic cross... with words

Are encryption algorithms with fixed-point free permutations inherently flawed?

How can I create unencrypted addresses?

Is it common to refer to someone as "Prof. Dr. [LastName]"?

Which part is the tail in 人参{にんじん}の尻尾{しっぽ}

What if you do not believe in the project benefits?

How do I know my password or backup information is not being shared when creating a new wallet?

Is there a way to pause a running process on Linux systems and resume later?

Why is the meaning of kanji 閑 "leisure"?

Sauna: Wood does not feel so hot

How can changes in personality/values of a person who turned into a vampire be explained?

Why Is Image Exporting At Larger Dimensions Than In Illustrator File?

Have the UK Conservatives lost the working majority and if so, what does this mean?

Which was the first story to feature space elevators?

Are there any spells or magic items that allow for making of ‘logic gates or wires’?

How to play songs that contain one guitar when we have two or more guitarists?



How can I use a Module anonymously as the function for /@?


How Can I use Solve/Reduce OutputHow Can I Use Conditional with Rational Domain RestrictionsHow can I find the range of my functionHow can I get the number of slots in Function?How to use the new function FindCookies?How do I use the built-in function Interpolation for a simply linear interpolation?how to write the Max of this function / How can i use Max[]Immediate Function Definition inside a ModuleHow to load function for use like built-in functionHow do I use Module to convert a calculation into a function?













3












$begingroup$


I've looked for a similar question but the one that came up first has no answer, so please bear with me as I am a complete newbie to Mathematica.



My ultimate goal is to generate custom ticks for a plot. The X axis is in minutes (not actual units, just an integer) and represents overnight times from, for example, 10pm to 3am the next day.



I've written a short function in the form of a module to convert a 'minute' value into a string "hh:mm". This works fine.



f[x_] :=
Module[{q, r},
{q, r} = QuotientRemainder[x, 60];
q = Mod[q, 24];
q = IntegerString[q, 10, 2];
r = IntegerString[r, 10, 2];
StringJoin[q, ":", r]
]

myTicks[min_, max_] := f /@ FindDivisions[{min, max, 60}, 5]

myTicks[22*60, (3 + 24)*60]
-> {"22:00", "23:00", "00:00", "01:00", "02:00", "03:00"}


What I can't seem to manage is how to combine the two into a single definition of myTicks that avoids the need for the intermediate function f.



Any suggestions, please?










share|improve this question









$endgroup$








  • 2




    $begingroup$
    Look up Function in the documentation.
    $endgroup$
    – Szabolcs
    6 hours ago










  • $begingroup$
    You'll have to be a little more specific, please. I've tried this but it doesn't work. MyTicks2[min_, max_] := Function[ Module[{q, r}, {q, r} = QuotientRemainder[#, 60]; q = Mod[q, 24]; q = IntegerString[q, 10, 2]; r = IntegerString[r, 10, 2]; StringJoin[q, ":", r] ] ] /@ FindDivisions[{min, max, 60}, 5]
    $endgroup$
    – BruceH
    5 hours ago












  • $begingroup$
    You're missing the &.
    $endgroup$
    – Szabolcs
    5 hours ago










  • $begingroup$
    In the Function documentation, basic examples In[2] doesn't have an &.
    $endgroup$
    – BruceH
    5 hours ago










  • $begingroup$
    Did you look at the answer I posted, which has a complete example? BTW the code you posted in the comment works fine. I misread it originally.
    $endgroup$
    – Szabolcs
    5 hours ago


















3












$begingroup$


I've looked for a similar question but the one that came up first has no answer, so please bear with me as I am a complete newbie to Mathematica.



My ultimate goal is to generate custom ticks for a plot. The X axis is in minutes (not actual units, just an integer) and represents overnight times from, for example, 10pm to 3am the next day.



I've written a short function in the form of a module to convert a 'minute' value into a string "hh:mm". This works fine.



f[x_] :=
Module[{q, r},
{q, r} = QuotientRemainder[x, 60];
q = Mod[q, 24];
q = IntegerString[q, 10, 2];
r = IntegerString[r, 10, 2];
StringJoin[q, ":", r]
]

myTicks[min_, max_] := f /@ FindDivisions[{min, max, 60}, 5]

myTicks[22*60, (3 + 24)*60]
-> {"22:00", "23:00", "00:00", "01:00", "02:00", "03:00"}


What I can't seem to manage is how to combine the two into a single definition of myTicks that avoids the need for the intermediate function f.



Any suggestions, please?










share|improve this question









$endgroup$








  • 2




    $begingroup$
    Look up Function in the documentation.
    $endgroup$
    – Szabolcs
    6 hours ago










  • $begingroup$
    You'll have to be a little more specific, please. I've tried this but it doesn't work. MyTicks2[min_, max_] := Function[ Module[{q, r}, {q, r} = QuotientRemainder[#, 60]; q = Mod[q, 24]; q = IntegerString[q, 10, 2]; r = IntegerString[r, 10, 2]; StringJoin[q, ":", r] ] ] /@ FindDivisions[{min, max, 60}, 5]
    $endgroup$
    – BruceH
    5 hours ago












  • $begingroup$
    You're missing the &.
    $endgroup$
    – Szabolcs
    5 hours ago










  • $begingroup$
    In the Function documentation, basic examples In[2] doesn't have an &.
    $endgroup$
    – BruceH
    5 hours ago










  • $begingroup$
    Did you look at the answer I posted, which has a complete example? BTW the code you posted in the comment works fine. I misread it originally.
    $endgroup$
    – Szabolcs
    5 hours ago
















3












3








3





$begingroup$


I've looked for a similar question but the one that came up first has no answer, so please bear with me as I am a complete newbie to Mathematica.



My ultimate goal is to generate custom ticks for a plot. The X axis is in minutes (not actual units, just an integer) and represents overnight times from, for example, 10pm to 3am the next day.



I've written a short function in the form of a module to convert a 'minute' value into a string "hh:mm". This works fine.



f[x_] :=
Module[{q, r},
{q, r} = QuotientRemainder[x, 60];
q = Mod[q, 24];
q = IntegerString[q, 10, 2];
r = IntegerString[r, 10, 2];
StringJoin[q, ":", r]
]

myTicks[min_, max_] := f /@ FindDivisions[{min, max, 60}, 5]

myTicks[22*60, (3 + 24)*60]
-> {"22:00", "23:00", "00:00", "01:00", "02:00", "03:00"}


What I can't seem to manage is how to combine the two into a single definition of myTicks that avoids the need for the intermediate function f.



Any suggestions, please?










share|improve this question









$endgroup$




I've looked for a similar question but the one that came up first has no answer, so please bear with me as I am a complete newbie to Mathematica.



My ultimate goal is to generate custom ticks for a plot. The X axis is in minutes (not actual units, just an integer) and represents overnight times from, for example, 10pm to 3am the next day.



I've written a short function in the form of a module to convert a 'minute' value into a string "hh:mm". This works fine.



f[x_] :=
Module[{q, r},
{q, r} = QuotientRemainder[x, 60];
q = Mod[q, 24];
q = IntegerString[q, 10, 2];
r = IntegerString[r, 10, 2];
StringJoin[q, ":", r]
]

myTicks[min_, max_] := f /@ FindDivisions[{min, max, 60}, 5]

myTicks[22*60, (3 + 24)*60]
-> {"22:00", "23:00", "00:00", "01:00", "02:00", "03:00"}


What I can't seem to manage is how to combine the two into a single definition of myTicks that avoids the need for the intermediate function f.



Any suggestions, please?







functions






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 6 hours ago









BruceHBruceH

1333




1333








  • 2




    $begingroup$
    Look up Function in the documentation.
    $endgroup$
    – Szabolcs
    6 hours ago










  • $begingroup$
    You'll have to be a little more specific, please. I've tried this but it doesn't work. MyTicks2[min_, max_] := Function[ Module[{q, r}, {q, r} = QuotientRemainder[#, 60]; q = Mod[q, 24]; q = IntegerString[q, 10, 2]; r = IntegerString[r, 10, 2]; StringJoin[q, ":", r] ] ] /@ FindDivisions[{min, max, 60}, 5]
    $endgroup$
    – BruceH
    5 hours ago












  • $begingroup$
    You're missing the &.
    $endgroup$
    – Szabolcs
    5 hours ago










  • $begingroup$
    In the Function documentation, basic examples In[2] doesn't have an &.
    $endgroup$
    – BruceH
    5 hours ago










  • $begingroup$
    Did you look at the answer I posted, which has a complete example? BTW the code you posted in the comment works fine. I misread it originally.
    $endgroup$
    – Szabolcs
    5 hours ago
















  • 2




    $begingroup$
    Look up Function in the documentation.
    $endgroup$
    – Szabolcs
    6 hours ago










  • $begingroup$
    You'll have to be a little more specific, please. I've tried this but it doesn't work. MyTicks2[min_, max_] := Function[ Module[{q, r}, {q, r} = QuotientRemainder[#, 60]; q = Mod[q, 24]; q = IntegerString[q, 10, 2]; r = IntegerString[r, 10, 2]; StringJoin[q, ":", r] ] ] /@ FindDivisions[{min, max, 60}, 5]
    $endgroup$
    – BruceH
    5 hours ago












  • $begingroup$
    You're missing the &.
    $endgroup$
    – Szabolcs
    5 hours ago










  • $begingroup$
    In the Function documentation, basic examples In[2] doesn't have an &.
    $endgroup$
    – BruceH
    5 hours ago










  • $begingroup$
    Did you look at the answer I posted, which has a complete example? BTW the code you posted in the comment works fine. I misread it originally.
    $endgroup$
    – Szabolcs
    5 hours ago










2




2




$begingroup$
Look up Function in the documentation.
$endgroup$
– Szabolcs
6 hours ago




$begingroup$
Look up Function in the documentation.
$endgroup$
– Szabolcs
6 hours ago












$begingroup$
You'll have to be a little more specific, please. I've tried this but it doesn't work. MyTicks2[min_, max_] := Function[ Module[{q, r}, {q, r} = QuotientRemainder[#, 60]; q = Mod[q, 24]; q = IntegerString[q, 10, 2]; r = IntegerString[r, 10, 2]; StringJoin[q, ":", r] ] ] /@ FindDivisions[{min, max, 60}, 5]
$endgroup$
– BruceH
5 hours ago






$begingroup$
You'll have to be a little more specific, please. I've tried this but it doesn't work. MyTicks2[min_, max_] := Function[ Module[{q, r}, {q, r} = QuotientRemainder[#, 60]; q = Mod[q, 24]; q = IntegerString[q, 10, 2]; r = IntegerString[r, 10, 2]; StringJoin[q, ":", r] ] ] /@ FindDivisions[{min, max, 60}, 5]
$endgroup$
– BruceH
5 hours ago














$begingroup$
You're missing the &.
$endgroup$
– Szabolcs
5 hours ago




$begingroup$
You're missing the &.
$endgroup$
– Szabolcs
5 hours ago












$begingroup$
In the Function documentation, basic examples In[2] doesn't have an &.
$endgroup$
– BruceH
5 hours ago




$begingroup$
In the Function documentation, basic examples In[2] doesn't have an &.
$endgroup$
– BruceH
5 hours ago












$begingroup$
Did you look at the answer I posted, which has a complete example? BTW the code you posted in the comment works fine. I misread it originally.
$endgroup$
– Szabolcs
5 hours ago






$begingroup$
Did you look at the answer I posted, which has a complete example? BTW the code you posted in the comment works fine. I misread it originally.
$endgroup$
– Szabolcs
5 hours ago












3 Answers
3






active

oldest

votes


















3












$begingroup$

One way:



myTicks[min_, max_] :=
Table[
Module[{q, r},
{q, r} = QuotientRemainder[x, 60];
q = Mod[q, 24];
q = IntegerString[q, 10, 2];
r = IntegerString[r, 10, 2];
StringJoin[q, ":", r]
],
{x, FindDivisions[{min, max, 60}, 5]}
]


Another way:



myTicks[min_, max_] :=
Module[{q, r},
{q, r} = QuotientRemainder[#, 60];
q = Mod[q, 24];
q = IntegerString[q, 10, 2];
r = IntegerString[r, 10, 2];
StringJoin[q, ":", r]
] & /@ FindDivisions[{min, max, 60}, 5]


Look up Function for more details.






share|improve this answer









$endgroup$





















    4












    $begingroup$

    For the ultimate goal, you can use the internal function System`DateListPlotDump`DateTicks to generate the date ticks:



    ClearAll[hourminuteTicks]
    hourminuteTicks = System`DateListPlotDump`DateTicks[{2019, 1, 1, 0, #} & /@ {#, #2}, #3,
    {"Hour", ":", "Minute"}] &;


    Example:



    hourminuteTicks[22*60, (3 + 24)*60, 5]



    {{3.7553688`*^9, "22:00"}, {3.7553724`*^9, "23:00"}, {3.755376`*^9, "00:00"},
    {3.7553796`*^9, "01:00"}, {3.7553832`*^9, "02:00"}, {3.7553868`*^9, "03:00"}}




    Take the last parts for the tick labels:



    hourminuteTicks[22*60, (3 + 24)*60, 5][[All, 2]]



    {"22:00", "23:00", "00:00", "01:00", "02:00", "03:00"}







    share|improve this answer











    $endgroup$





















      0












      $begingroup$

      Here's a compact, completely unreadable way to achieve your goal:



      myTicks[min_, max_] := (StringJoin @@ {IntegerString[Mod[#1, 24], 10, 2], 
      ":", IntegerString[#2, 10, 2]}) & @@
      QuotientRemainder[#, 60] & /@ FindDivisions[{min, max, 60}, 5];


      For readability, I think intermediate functions can be helpful, and if an intermediate function is only needed inside some larger function, you can define it locally:



      myTicks[min_, max_] := Module[{f},
      minToHHMM[x_] := Module[
      {h, m},
      {h, m} = {Mod[#1, 24], #2} & @@ QuotientRemainder[x, 60];
      {h, m} = IntegerString[#, 10, 2] & /@ {h, m};
      StringJoin[#1, ":", #2] & @@ {h, m}
      ];
      minToHHMM /@ FindDivisions[{min, max, 60}, 5]
      ]





      share|improve this answer









      $endgroup$













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


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f191930%2fhow-can-i-use-a-module-anonymously-as-the-function-for%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        3












        $begingroup$

        One way:



        myTicks[min_, max_] :=
        Table[
        Module[{q, r},
        {q, r} = QuotientRemainder[x, 60];
        q = Mod[q, 24];
        q = IntegerString[q, 10, 2];
        r = IntegerString[r, 10, 2];
        StringJoin[q, ":", r]
        ],
        {x, FindDivisions[{min, max, 60}, 5]}
        ]


        Another way:



        myTicks[min_, max_] :=
        Module[{q, r},
        {q, r} = QuotientRemainder[#, 60];
        q = Mod[q, 24];
        q = IntegerString[q, 10, 2];
        r = IntegerString[r, 10, 2];
        StringJoin[q, ":", r]
        ] & /@ FindDivisions[{min, max, 60}, 5]


        Look up Function for more details.






        share|improve this answer









        $endgroup$


















          3












          $begingroup$

          One way:



          myTicks[min_, max_] :=
          Table[
          Module[{q, r},
          {q, r} = QuotientRemainder[x, 60];
          q = Mod[q, 24];
          q = IntegerString[q, 10, 2];
          r = IntegerString[r, 10, 2];
          StringJoin[q, ":", r]
          ],
          {x, FindDivisions[{min, max, 60}, 5]}
          ]


          Another way:



          myTicks[min_, max_] :=
          Module[{q, r},
          {q, r} = QuotientRemainder[#, 60];
          q = Mod[q, 24];
          q = IntegerString[q, 10, 2];
          r = IntegerString[r, 10, 2];
          StringJoin[q, ":", r]
          ] & /@ FindDivisions[{min, max, 60}, 5]


          Look up Function for more details.






          share|improve this answer









          $endgroup$
















            3












            3








            3





            $begingroup$

            One way:



            myTicks[min_, max_] :=
            Table[
            Module[{q, r},
            {q, r} = QuotientRemainder[x, 60];
            q = Mod[q, 24];
            q = IntegerString[q, 10, 2];
            r = IntegerString[r, 10, 2];
            StringJoin[q, ":", r]
            ],
            {x, FindDivisions[{min, max, 60}, 5]}
            ]


            Another way:



            myTicks[min_, max_] :=
            Module[{q, r},
            {q, r} = QuotientRemainder[#, 60];
            q = Mod[q, 24];
            q = IntegerString[q, 10, 2];
            r = IntegerString[r, 10, 2];
            StringJoin[q, ":", r]
            ] & /@ FindDivisions[{min, max, 60}, 5]


            Look up Function for more details.






            share|improve this answer









            $endgroup$



            One way:



            myTicks[min_, max_] :=
            Table[
            Module[{q, r},
            {q, r} = QuotientRemainder[x, 60];
            q = Mod[q, 24];
            q = IntegerString[q, 10, 2];
            r = IntegerString[r, 10, 2];
            StringJoin[q, ":", r]
            ],
            {x, FindDivisions[{min, max, 60}, 5]}
            ]


            Another way:



            myTicks[min_, max_] :=
            Module[{q, r},
            {q, r} = QuotientRemainder[#, 60];
            q = Mod[q, 24];
            q = IntegerString[q, 10, 2];
            r = IntegerString[r, 10, 2];
            StringJoin[q, ":", r]
            ] & /@ FindDivisions[{min, max, 60}, 5]


            Look up Function for more details.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 5 hours ago









            SzabolcsSzabolcs

            160k14437934




            160k14437934























                4












                $begingroup$

                For the ultimate goal, you can use the internal function System`DateListPlotDump`DateTicks to generate the date ticks:



                ClearAll[hourminuteTicks]
                hourminuteTicks = System`DateListPlotDump`DateTicks[{2019, 1, 1, 0, #} & /@ {#, #2}, #3,
                {"Hour", ":", "Minute"}] &;


                Example:



                hourminuteTicks[22*60, (3 + 24)*60, 5]



                {{3.7553688`*^9, "22:00"}, {3.7553724`*^9, "23:00"}, {3.755376`*^9, "00:00"},
                {3.7553796`*^9, "01:00"}, {3.7553832`*^9, "02:00"}, {3.7553868`*^9, "03:00"}}




                Take the last parts for the tick labels:



                hourminuteTicks[22*60, (3 + 24)*60, 5][[All, 2]]



                {"22:00", "23:00", "00:00", "01:00", "02:00", "03:00"}







                share|improve this answer











                $endgroup$


















                  4












                  $begingroup$

                  For the ultimate goal, you can use the internal function System`DateListPlotDump`DateTicks to generate the date ticks:



                  ClearAll[hourminuteTicks]
                  hourminuteTicks = System`DateListPlotDump`DateTicks[{2019, 1, 1, 0, #} & /@ {#, #2}, #3,
                  {"Hour", ":", "Minute"}] &;


                  Example:



                  hourminuteTicks[22*60, (3 + 24)*60, 5]



                  {{3.7553688`*^9, "22:00"}, {3.7553724`*^9, "23:00"}, {3.755376`*^9, "00:00"},
                  {3.7553796`*^9, "01:00"}, {3.7553832`*^9, "02:00"}, {3.7553868`*^9, "03:00"}}




                  Take the last parts for the tick labels:



                  hourminuteTicks[22*60, (3 + 24)*60, 5][[All, 2]]



                  {"22:00", "23:00", "00:00", "01:00", "02:00", "03:00"}







                  share|improve this answer











                  $endgroup$
















                    4












                    4








                    4





                    $begingroup$

                    For the ultimate goal, you can use the internal function System`DateListPlotDump`DateTicks to generate the date ticks:



                    ClearAll[hourminuteTicks]
                    hourminuteTicks = System`DateListPlotDump`DateTicks[{2019, 1, 1, 0, #} & /@ {#, #2}, #3,
                    {"Hour", ":", "Minute"}] &;


                    Example:



                    hourminuteTicks[22*60, (3 + 24)*60, 5]



                    {{3.7553688`*^9, "22:00"}, {3.7553724`*^9, "23:00"}, {3.755376`*^9, "00:00"},
                    {3.7553796`*^9, "01:00"}, {3.7553832`*^9, "02:00"}, {3.7553868`*^9, "03:00"}}




                    Take the last parts for the tick labels:



                    hourminuteTicks[22*60, (3 + 24)*60, 5][[All, 2]]



                    {"22:00", "23:00", "00:00", "01:00", "02:00", "03:00"}







                    share|improve this answer











                    $endgroup$



                    For the ultimate goal, you can use the internal function System`DateListPlotDump`DateTicks to generate the date ticks:



                    ClearAll[hourminuteTicks]
                    hourminuteTicks = System`DateListPlotDump`DateTicks[{2019, 1, 1, 0, #} & /@ {#, #2}, #3,
                    {"Hour", ":", "Minute"}] &;


                    Example:



                    hourminuteTicks[22*60, (3 + 24)*60, 5]



                    {{3.7553688`*^9, "22:00"}, {3.7553724`*^9, "23:00"}, {3.755376`*^9, "00:00"},
                    {3.7553796`*^9, "01:00"}, {3.7553832`*^9, "02:00"}, {3.7553868`*^9, "03:00"}}




                    Take the last parts for the tick labels:



                    hourminuteTicks[22*60, (3 + 24)*60, 5][[All, 2]]



                    {"22:00", "23:00", "00:00", "01:00", "02:00", "03:00"}








                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited 3 mins ago

























                    answered 2 hours ago









                    kglrkglr

                    185k10202420




                    185k10202420























                        0












                        $begingroup$

                        Here's a compact, completely unreadable way to achieve your goal:



                        myTicks[min_, max_] := (StringJoin @@ {IntegerString[Mod[#1, 24], 10, 2], 
                        ":", IntegerString[#2, 10, 2]}) & @@
                        QuotientRemainder[#, 60] & /@ FindDivisions[{min, max, 60}, 5];


                        For readability, I think intermediate functions can be helpful, and if an intermediate function is only needed inside some larger function, you can define it locally:



                        myTicks[min_, max_] := Module[{f},
                        minToHHMM[x_] := Module[
                        {h, m},
                        {h, m} = {Mod[#1, 24], #2} & @@ QuotientRemainder[x, 60];
                        {h, m} = IntegerString[#, 10, 2] & /@ {h, m};
                        StringJoin[#1, ":", #2] & @@ {h, m}
                        ];
                        minToHHMM /@ FindDivisions[{min, max, 60}, 5]
                        ]





                        share|improve this answer









                        $endgroup$


















                          0












                          $begingroup$

                          Here's a compact, completely unreadable way to achieve your goal:



                          myTicks[min_, max_] := (StringJoin @@ {IntegerString[Mod[#1, 24], 10, 2], 
                          ":", IntegerString[#2, 10, 2]}) & @@
                          QuotientRemainder[#, 60] & /@ FindDivisions[{min, max, 60}, 5];


                          For readability, I think intermediate functions can be helpful, and if an intermediate function is only needed inside some larger function, you can define it locally:



                          myTicks[min_, max_] := Module[{f},
                          minToHHMM[x_] := Module[
                          {h, m},
                          {h, m} = {Mod[#1, 24], #2} & @@ QuotientRemainder[x, 60];
                          {h, m} = IntegerString[#, 10, 2] & /@ {h, m};
                          StringJoin[#1, ":", #2] & @@ {h, m}
                          ];
                          minToHHMM /@ FindDivisions[{min, max, 60}, 5]
                          ]





                          share|improve this answer









                          $endgroup$
















                            0












                            0








                            0





                            $begingroup$

                            Here's a compact, completely unreadable way to achieve your goal:



                            myTicks[min_, max_] := (StringJoin @@ {IntegerString[Mod[#1, 24], 10, 2], 
                            ":", IntegerString[#2, 10, 2]}) & @@
                            QuotientRemainder[#, 60] & /@ FindDivisions[{min, max, 60}, 5];


                            For readability, I think intermediate functions can be helpful, and if an intermediate function is only needed inside some larger function, you can define it locally:



                            myTicks[min_, max_] := Module[{f},
                            minToHHMM[x_] := Module[
                            {h, m},
                            {h, m} = {Mod[#1, 24], #2} & @@ QuotientRemainder[x, 60];
                            {h, m} = IntegerString[#, 10, 2] & /@ {h, m};
                            StringJoin[#1, ":", #2] & @@ {h, m}
                            ];
                            minToHHMM /@ FindDivisions[{min, max, 60}, 5]
                            ]





                            share|improve this answer









                            $endgroup$



                            Here's a compact, completely unreadable way to achieve your goal:



                            myTicks[min_, max_] := (StringJoin @@ {IntegerString[Mod[#1, 24], 10, 2], 
                            ":", IntegerString[#2, 10, 2]}) & @@
                            QuotientRemainder[#, 60] & /@ FindDivisions[{min, max, 60}, 5];


                            For readability, I think intermediate functions can be helpful, and if an intermediate function is only needed inside some larger function, you can define it locally:



                            myTicks[min_, max_] := Module[{f},
                            minToHHMM[x_] := Module[
                            {h, m},
                            {h, m} = {Mod[#1, 24], #2} & @@ QuotientRemainder[x, 60];
                            {h, m} = IntegerString[#, 10, 2] & /@ {h, m};
                            StringJoin[#1, ":", #2] & @@ {h, m}
                            ];
                            minToHHMM /@ FindDivisions[{min, max, 60}, 5]
                            ]






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered 4 hours ago









                            N.J.EvansN.J.Evans

                            3,7351319




                            3,7351319






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Mathematica Stack Exchange!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                Use MathJax to format equations. MathJax reference.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f191930%2fhow-can-i-use-a-module-anonymously-as-the-function-for%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

                                Щит и меч (фильм) Содержание Названия серий | Сюжет |...

                                Венесуэла на летних Олимпийских играх 2000 Содержание Состав...

                                Meter-Bus Содержание Параметры шины | Стандартизация |...