Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #56453

Re: Define a variable only not defined.

From anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups comp.lang.forth
Subject Re: Define a variable only not defined.
Date 2017-03-29 13:54 +0000
Organization Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID <2017Mar29.155436@mips.complang.tuwien.ac.at> (permalink)
References <252d2e3a-a277-4447-9bb0-7de4955d03d6@googlegroups.com> <60ffebaf-082e-440e-a294-d9ebb64a38cc@googlegroups.com> <0d6a701e-6d94-4880-8242-8b09ebd793ec@googlegroups.com> <ir9ahuw05px3.qz5gr8urz6n3.dlg@40tude.net>

Show all headers | View raw


Coos Haak <htrofhc@gmail.com> writes:
>: newvar	( "ccc" -- )
>        >in @ bl word find nip 0=
>        if      >in ! variable
>        else    drop
>        then
>    ;

Or, with the Forth-2012 [DEFINED]:

: newvar ( "name" -- )
  >in @ postpone [defined] 0= if
    dup >in ! variable then
  drop ;

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2016: http://www.euroforth.org/ef16/

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Define a variable only not defined. Faisal <faisalm83@gmail.com> - 2017-03-29 02:39 -0700
  Re: Define a variable only not defined. minforth@arcor.de - 2017-03-29 04:20 -0700
    Re: Define a variable only not defined. Faisal <faisalm83@gmail.com> - 2017-03-29 04:26 -0700
      Re: Define a variable only not defined. Coos Haak <htrofhc@gmail.com> - 2017-03-29 14:58 +0200
        Re: Define a variable only not defined. Alex <alex@rivadpm.com> - 2017-03-29 14:41 +0100
        Re: Define a variable only not defined. anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-03-29 13:54 +0000
          Re: Define a variable only not defined. Mikael Nordman <oh2aun@gmail.com> - 2017-03-29 12:06 -0700
            Re: Define a variable only not defined. Coos Haak <htrofhc@gmail.com> - 2017-03-29 21:30 +0200
              Re: Define a variable only not defined. Mikael Nordman <oh2aun@gmail.com> - 2017-03-29 12:53 -0700
  Re: Define a variable only not defined. "HAA" <someone@microsoft.com> - 2017-03-30 10:03 +1000
    Re: Define a variable only not defined. Julian Fondren <julian.fondren@gmail.com> - 2017-03-29 19:00 -0700
      Re: Define a variable only not defined. "Elizabeth D. Rather" <erather@forth.com> - 2017-03-29 16:35 -1000

csiph-web