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


Groups > comp.lang.forth > #21041

Re: Is there a way to define this portably in ANS Forth?

From Bernd Paysan <bernd.paysan@gmx.de>
Newsgroups comp.lang.forth
Subject Re: Is there a way to define this portably in ANS Forth?
Date 2013-03-22 15:59 +0100
Organization 1&1 Internet AG
Message-ID <kihrl7$n25$1@online.de> (permalink)
References <0770e496-c689-4cc2-8604-51b9587c187b@googlegroups.com> <c610c803-733b-49d7-b4b3-b98f8f789b1b@l13g2000yqe.googlegroups.com>

Show all headers | View raw


Mark Wills wrote:

> On Mar 22, 12:34 pm, The Beez <the.beez.spe...@gmail.com> wrote:
>> A word which creates a named execution token that throws itself on the
>> stack when executed, as if it were defined like this:
>>
>> :noname + ; constant plus
>>
>> <word> plus + ;
>>
>> Just wondering. I'm not getting the right ideas right now :-(
>>
>> Hans Bezemer
> 
> I don't know much about ANS unfortunately, but I came up with this
> (FWIW):
> 
> : nop ;
> : define create ['] nop , does> @ ;
> : as ' latest @ >cfa >body ! ;
> 
> define plus as +
> : test 5 4 plus execute . ; \ should display 9
> 
> I tried it in GForth but GForth barfed on >CFA

It's NAME>, and you can use LATESTXT instead of LATEST @, and avoid that 
conversion entirely.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://bernd-paysan.de/

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


Thread

Is there a way to define this portably in ANS Forth? The Beez <the.beez.speaks@gmail.com> - 2013-03-22 05:34 -0700
  Re: Is there a way to define this portably in ANS Forth? Mark Wills <markrobertwills@yahoo.co.uk> - 2013-03-22 06:12 -0700
    Re: Is there a way to define this portably in ANS Forth? Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-22 15:59 +0100
      Re: Is there a way to define this portably in ANS Forth? Hugh Aguilar <hughaguilar96@yahoo.com> - 2013-03-22 21:53 -0700
        Re: Is there a way to define this portably in ANS Forth? "Rod Pemberton" <do_not_have@notemailnotq.cpm> - 2013-03-23 02:35 -0400
          Re: Is there a way to define this portably in ANS Forth? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-23 05:37 -0500
        Re: Is there a way to define this portably in ANS Forth? The Beez <the.beez.speaks@gmail.com> - 2013-03-23 04:08 -0700
  Re: Is there a way to define this portably in ANS Forth? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-22 09:16 -0500
    Re: Is there a way to define this portably in ANS Forth? Hugh Aguilar <hughaguilar96@yahoo.com> - 2013-03-27 18:50 -0700
      Re: Is there a way to define this portably in ANS Forth? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-28 04:13 -0500
        Re: Is there a way to define this portably in ANS Forth? Alex McDonald <blog@rivadpm.com> - 2013-03-28 06:54 -0700
        Re: Is there a way to define this portably in ANS Forth? Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2013-03-28 15:36 +0000
          Re: Is there a way to define this portably in ANS Forth? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-28 16:19 -0500
        Re: Is there a way to define this portably in ANS Forth? Hugh Aguilar <hughaguilar96@yahoo.com> - 2013-03-28 20:49 -0700
          Re: Is there a way to define this portably in ANS Forth? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-29 04:25 -0500
  Re: Is there a way to define this portably in ANS Forth? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-03-22 14:41 +0000

csiph-web