Right, it's a tricky problem because (in your example) "stage1" might not
be defined, so stage1 cannot appear in the definition of "check_marker".

Fortunately Neil Bawd's word ANEW does something similar:

http://www.wilbaden.com/neil_bawd/tool2002.txt

His original definitions are:

    : POSSIBLY  ( "name" -- )  BL WORD FIND  ?dup AND IF  EXECUTE  THEN ;

    : ANEW  ( "name" -- )( Run: -- )  >IN @ POSSIBLY  >IN ! MARKER ;

But in AmForth it is supplied already as common/lib/anew.frt:

    : possibly  ( "name" -- )

       parse-name find-xt if execute  then ;



    : anew  ( "name" -- )  >in @  possibly  >in !  marker ;



On Wed, Jun 29, 2016 at 3:37 PM, Tristan Williams <h...@tjnw.co.uk> wrote:

> Apologies, that should be (and is in my code)
>
> check_marker
>
>
> On 29Jun16 23:23, Tristan Williams wrote:
> > Hello,
> >
> > I would like to set a marker or execute a marker dependant upon
> > whether that marker exists or not. What I have in mind is something
> > like this
> >
> > : check_marker [defined] stage1 if stage1 else marker stage1 then ;
> >
> > followed by
> >
> > check_maker
> >
> > However, this does not work for me and I suspect this is because of
> > a (another) gap in my understanding.
> >
> > At the interpreter
> >
> > [defined] stage1
> >
> > gives 0 or -1 as I would hope but I am unable to make progress when I
> > try and put it in a word.
> >
> > Can anyone put me out of my misery?  Where am I going wrong?
> >
> > Kind regards and thanks,
> >
> > Tristan
> >
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
> > Francisco, CA to explore cutting-edge tech and listen to tech luminaries
> > present their vision of the future. This family event has something for
> > everyone, including kids. Get more information and register today.
> > http://sdm.link/attshape
> > _______________________________________________
> > Amforth-devel mailing list for http://amforth.sf.net/
> > Amforth-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/amforth-devel
> >
>
>
> ------------------------------------------------------------------------------
> Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
> Francisco, CA to explore cutting-edge tech and listen to tech luminaries
> present their vision of the future. This family event has something for
> everyone, including kids. Get more information and register today.
> http://sdm.link/attshape
> _______________________________________________
> Amforth-devel mailing list for http://amforth.sf.net/
> Amforth-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/amforth-devel
>



-- 
James Bowman
http://www.excamera.com/
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to