Is there a way for a macro to check the previous value of #1, the last time 
that same macro was called?

Here is a minimum working example, pretending that `\previousvalue` is equal to 
#1 from the last time the same macro was called:

    \define[1]\mymacro{
        \if\previousvalue=#1
        same as last time
    \else
        it is different from last time
    \fi
    }

\starttext

    \mymacro{cat}
    \mymacro{cat}
    \mymacro{mouse}
    \mymacro{mouse}
    \mymacro{cat}

\stoptext

This would print:

    it is different from last time <--it was never called previously
    same as last time
    it is different from last time
    same as last time
    it is different from last time

--Joel
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to