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


Groups > comp.lang.forth > #28444

Re: suggestions for word names?

From "Rod Pemberton" <dont_use_email@xnohavenotit.cnm>
Newsgroups comp.lang.forth
Subject Re: suggestions for word names?
Date 2014-02-14 20:44 -0500
Organization Aioe.org NNTP Server
Message-ID <op.xbau38lc5zc71u@localhost> (permalink)
References <ldlthk$bga$1@speranza.aioe.org>

Show all headers | View raw


On Fri, 14 Feb 2014 15:15:48 -0500, Marcos Cruz  
<null_email_so_use_my_contact_page@programandala.net> wrote:

>
> I'm using the following two pieces of code in several words of mine:
>
>   2>r dup dup 2r>  ( x1 x2 x3 -- x1 x1 x1 x2 x3 )
>
>   >r dup dup r>  ( x1 x2 -- x1 x1 x1 x2 )
>
> Each of them is used in two or three words (customized versions of 'of',
> e.g.  'within-of', 'greater-of', etc.), and the list is expected to
> grow, so they are good candidates for factoring.
>
> Does anybody know any words (common usage or provided by any Forth
> system or library), that do the same than those code pieces?
>

I don't know what they'd be called, but you might be able
to improve that code slightly.

For the fist sequence "2>r dup dup 2r>", the 2>r
and 2r> are likely to be very expensive operations
timewise.  That sequence is also equivalent to this:

   >r nup nup r>

Even though nup isn't likely to be very efficient either,
eliminating 2>r and 2r> is likely to speed things up.

The second sequence ">r dup dup r>" is:

   nup nup

It's not likely that "nup nup" outperforms
">r dup dup r>" for your Forth, but it might.
This depends on how efficiently nup is implemented
as compared to how efficiently >r and r> are and how
much call overhead per Forth word there is.

   nup ( x1 x2 -- x1 x1 x2 )


Rod Pemberton

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


Thread

suggestions for word names? Marcos Cruz <null_email_so_use_my_contact_page@programandala.net> - 2014-02-14 20:15 +0000
  Re: suggestions for word names? "Elizabeth D. Rather" <erather@forth.com> - 2014-02-14 10:30 -1000
    Re: suggestions for word names? Marcos Cruz <null_email_so_use_my_contact_page@programandala.net> - 2014-02-14 22:07 +0000
      Re: suggestions for word names? humptydumpty <ouatubi@gmail.com> - 2014-02-15 10:00 -0800
        Re: suggestions for word names? Stefan Mauerhofer <smauerhofer@androsoft.ch> - 2014-02-18 05:04 -0800
          Re: suggestions for word names? m.a.m.hendrix@tue.nl - 2014-02-18 05:45 -0800
          Re: suggestions for word names? "Rod Pemberton" <dont_use_email@xnohavenotit.cnm> - 2014-02-18 18:17 -0500
            Re: suggestions for word names? Stefan Mauerhofer <smauerhofer@androsoft.ch> - 2014-02-18 21:38 -0800
            Re: suggestions for word names? Mark Wills <markrobertwills@yahoo.co.uk> - 2014-02-19 02:00 -0800
              Re: suggestions for word names? Paul Rubin <no.email@nospam.invalid> - 2014-02-19 02:44 -0800
              Re: suggestions for word names? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-02-19 20:13 +0000
          Re: suggestions for word names? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-02-19 03:49 -0600
    Re: suggestions for word names? Hans Bezemer <the.beez.speaks@gmail.com> - 2014-02-15 14:55 +0100
  Re: suggestions for word names? "Rod Pemberton" <dont_use_email@xnohavenotit.cnm> - 2014-02-14 20:44 -0500
    Re: suggestions for word names? Hans Bezemer <the.beez.speaks@gmail.com> - 2014-02-15 14:52 +0100
      Re: suggestions for word names? Coos Haak <chforth@hccnet.nl> - 2014-02-15 15:43 +0100
      Re: suggestions for word names? "Rod Pemberton" <dont_use_email@xnohavenotit.cnm> - 2014-02-15 12:06 -0500
        Re: suggestions for word names? Coos Haak <chforth@hccnet.nl> - 2014-02-15 18:30 +0100
        Re: suggestions for word names? Hans Bezemer <the.beez.speaks@gmail.com> - 2014-02-18 16:45 +0100
          Re: suggestions for word names? "Rod Pemberton" <dont_use_email@xnohavenotit.cnm> - 2014-02-18 18:17 -0500
            Re: suggestions for word names? Hans Bezemer <the.beez.speaks@gmail.com> - 2014-02-19 09:44 +0100
            Re: suggestions for word names? Hans Bezemer <the.beez.speaks@gmail.com> - 2014-02-19 09:47 +0100
              Re: suggestions for word names? Paul Rubin <no.email@nospam.invalid> - 2014-02-19 01:38 -0800
                Re: suggestions for word names? Hans Bezemer <the.beez.speaks@gmail.com> - 2014-02-19 16:59 +0100
            Re: suggestions for word names? Hans Bezemer <the.beez.speaks@gmail.com> - 2014-02-19 10:11 +0100
              Re: suggestions for word names? "Rod Pemberton" <dont_use_email@xnohavenotit.cnm> - 2014-02-19 05:39 -0500
                Re: suggestions for word names? Stefan Mauerhofer <smauerhofer@androsoft.ch> - 2014-02-19 03:31 -0800
    Re: suggestions for word names? Marcos Cruz <null_email_so_use_my_contact_page@programandala.net> - 2014-02-15 15:41 +0000

csiph-web