Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

"Don't drop acid, take it pass-fail!" -- Bryan Michael Wendt


devel / comp.lang.forth / Reverse Stack Oder, simple but... ( gForth)

SubjectAuthor
* Reverse Stack Oder, simple but... ( gForth)SpainHackForth
`* Re: Reverse Stack Oder, simple but... ( gForth)gobli...@gmail.com
 `* Re: Reverse Stack Oder, simple but... ( gForth)SpainHackForth
  `* Re: Reverse Stack Oder, simple but... ( gForth)Zbig
   `* Re: Reverse Stack Oder, simple but... ( gForth)Zbig
    `* Re: Reverse Stack Oder, simple but... ( gForth)SpainHackForth
     `* Re: Reverse Stack Oder, simple but... ( gForth)Zbig
      +* Re: Reverse Stack Oder, simple but... ( gForth)Hans Bezemer
      |`* Re: Reverse Stack Oder, simple but... ( gForth)Zbig
      | `* Re: Reverse Stack Oder, simple but... ( gForth)Hans Bezemer
      |  `- Re: Reverse Stack Oder, simple but... ( gForth)Zbig
      `* Re: Reverse Stack Oder, simple but... ( gForth)SpainHackForth
       +- Re: Reverse Stack Oder, simple but... ( gForth)Zbig
       +- Re: Reverse Stack Oder, simple but... ( gForth)Zbig
       `- Re: Reverse Stack Oder, simple but... ( gForth)dxforth

1
Reverse Stack Oder, simple but... ( gForth)

<b274bc39-85a2-4e69-8217-a2fee17d3476n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24399&group=comp.lang.forth#24399

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:4d8e:b0:76d:7fca:df07 with SMTP id uw14-20020a05620a4d8e00b0076d7fcadf07mr152462qkn.6.1692875746668;
Thu, 24 Aug 2023 04:15:46 -0700 (PDT)
X-Received: by 2002:a05:6a00:2da3:b0:68a:546d:596c with SMTP id
fb35-20020a056a002da300b0068a546d596cmr4809885pfb.5.1692875746188; Thu, 24
Aug 2023 04:15:46 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 24 Aug 2023 04:15:45 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=88.1.142.7; posting-account=oUnEFAoAAADoKEMDaPmswUef8xS_aFfv
NNTP-Posting-Host: 88.1.142.7
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b274bc39-85a2-4e69-8217-a2fee17d3476n@googlegroups.com>
Subject: Reverse Stack Oder, simple but... ( gForth)
From: jemo07@gmail.com (SpainHackForth)
Injection-Date: Thu, 24 Aug 2023 11:15:46 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3272
 by: SpainHackForth - Thu, 24 Aug 2023 11:15 UTC

Hi all, trying to reverse order, I'm working of the stack although I will be using a file and buffer for the end result, I created what seem like the logical word defines as:

: REVERSE ( i*x i -- i*y ) 0 DO I DUP ROLL . LOOP ;

Here is the interactive successions ( or is that frustration :D )
At fist I was missing a character, then it all was weird...

Thoughts... I leave the interactive session for the enjoyment of the gurus! :D
..S <0> ok
0 1 2 3 4 5 6 7 8 9 ok
..S <10> 1 2 3 4 5 6 7 8 9 ok
: REVERSE ( i*x i -- i*y ) 0 DO I DUP ROLL . LOOP ; redefined REVERSE ok
REVERSE 0 8 7 6 5 4 3 2 1 ok
..s <9> 0 1 2 3 4 5 6 7 8 ok
: REVERSE ( i*x i -- i*y ) 0 DO I DUP ROLL . DROP LOOP ; redefined REVERSE ok
abort
:148: Aborted
>>>abort<<<
Backtrace:
$7F8B79A03A78 throw
..S <0> ok
0 1 2 3 4 5 6 7 8 9 ok
..S <10> 1 2 3 4 5 6 7 8 9 ok
REVERSE 0 7 5 3 1
:152: Stack underflow
>>>REVERSE<<<
Backtrace:
$7F8B79A031D0 swap
$7F8B79A031C0 roll
$2
$7F8B79A031C0 roll
$4
$7F8B79A031C0 roll
$6
$7F8B79A031C0 roll
$5
$7F8B79A57178 roll
$5
$9
: REVERSE ( i*x i -- i*y ) 0 DO I ROLL . LOOP ; redefined REVERSE ok
..S <0> ok
0 1 2 3 4 5 6 7 8 9 ok
REVERSE 8 6 4 2 0
:156: Stack underflow
>>>REVERSE<<<
Backtrace:
$7F8B79A031A0 swap
$7F8B79A031C0 roll
$1
$7F8B79A031C0 roll
$3
$7F8B79A031C0 roll
$5
$7F8B79A031C0 roll
$7
$7F8B79A57208 roll
$5
$9
..S <0> ok
ok
ok
ok
0 1 2 3 4 5 6 7 8 9 ok
REVERSE 8 6 4 2 0
:162: Stack underflow
>>>REVERSE<<<
Backtrace:
$7F8B79A031A0 swap
$7F8B79A031C0 roll
$1
$7F8B79A031C0 roll
$3
$7F8B79A031C0 roll
$5
$7F8B79A031C0 roll
$7
$7F8B79A57208 roll
$5
$9
: REVERSE ( i*x i -- i*y ) 0 DO I DUP ROLL . DROP LOOP ; redefined REVERSE ok
ok
ok
0 1 2 3 4 5 6 7 8 9 ok
REVERSE 0 7 5 3 1
:167: Stack underflow
>>>REVERSE<<<
Backtrace:
$7F8B79A031D0 swap
$7F8B79A031C0 roll
$2
$7F8B79A031C0 roll
$4
$7F8B79A031C0 roll
$6
$7F8B79A031C0 roll
$5
$7F8B79A57298 roll
$5
$9
ok
ok
ok
ok
bye

Re: Reverse Stack Oder, simple but... ( gForth)

<48e9b418-c5db-40e4-bd50-b243fb4f3102n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24400&group=comp.lang.forth#24400

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:a0c:b0:63d:44c5:3f37 with SMTP id dw12-20020a0562140a0c00b0063d44c53f37mr201260qvb.12.1692877729116;
Thu, 24 Aug 2023 04:48:49 -0700 (PDT)
X-Received: by 2002:a05:6a00:23c7:b0:68b:ee34:972f with SMTP id
g7-20020a056a0023c700b0068bee34972fmr775464pfc.5.1692877728773; Thu, 24 Aug
2023 04:48:48 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 24 Aug 2023 04:48:48 -0700 (PDT)
In-Reply-To: <b274bc39-85a2-4e69-8217-a2fee17d3476n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a01:e0a:118:ea0:65ce:9973:67c2:3c99;
posting-account=3HjpJwoAAACwXD1UyRZwC1Lkp4Lq1jcg
NNTP-Posting-Host: 2a01:e0a:118:ea0:65ce:9973:67c2:3c99
References: <b274bc39-85a2-4e69-8217-a2fee17d3476n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <48e9b418-c5db-40e4-bd50-b243fb4f3102n@googlegroups.com>
Subject: Re: Reverse Stack Oder, simple but... ( gForth)
From: goblinrieur@gmail.com (gobli...@gmail.com)
Injection-Date: Thu, 24 Aug 2023 11:48:49 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4096
 by: gobli...@gmail.com - Thu, 24 Aug 2023 11:48 UTC

Le jeudi 24 août 2023 à 13:15:48 UTC+2, SpainHackForth a écrit :
> Hi all, trying to reverse order, I'm working of the stack although I will be using a file and buffer for the end result, I created what seem like the logical word defines as:
>
> : REVERSE ( i*x i -- i*y ) 0 DO I DUP ROLL . LOOP ;
>
> Here is the interactive successions ( or is that frustration :D )
> At fist I was missing a character, then it all was weird...
>
> Thoughts... I leave the interactive session for the enjoyment of the gurus! :D
> .S <0> ok
> 0 1 2 3 4 5 6 7 8 9 ok
> .S <10> 1 2 3 4 5 6 7 8 9 ok
> : REVERSE ( i*x i -- i*y ) 0 DO I DUP ROLL . LOOP ; redefined REVERSE ok
> REVERSE 0 8 7 6 5 4 3 2 1 ok
> .s <9> 0 1 2 3 4 5 6 7 8 ok
> : REVERSE ( i*x i -- i*y ) 0 DO I DUP ROLL . DROP LOOP ; redefined REVERSE ok
> abort
> :148: Aborted
> >>>abort<<<
> Backtrace:
> $7F8B79A03A78 throw
> .S <0> ok
> 0 1 2 3 4 5 6 7 8 9 ok
> .S <10> 1 2 3 4 5 6 7 8 9 ok
> REVERSE 0 7 5 3 1
> :152: Stack underflow
> >>>REVERSE<<<
> Backtrace:
> $7F8B79A031D0 swap
> $7F8B79A031C0 roll
> $2
> $7F8B79A031C0 roll
> $4
> $7F8B79A031C0 roll
> $6
> $7F8B79A031C0 roll
> $5
> $7F8B79A57178 roll
> $5
> $9
> : REVERSE ( i*x i -- i*y ) 0 DO I ROLL . LOOP ; redefined REVERSE ok
> .S <0> ok
> 0 1 2 3 4 5 6 7 8 9 ok
> REVERSE 8 6 4 2 0
> :156: Stack underflow
> >>>REVERSE<<<
> Backtrace:
> $7F8B79A031A0 swap
> $7F8B79A031C0 roll
> $1
> $7F8B79A031C0 roll
> $3
> $7F8B79A031C0 roll
> $5
> $7F8B79A031C0 roll
> $7
> $7F8B79A57208 roll
> $5
> $9
> .S <0> ok
> ok
> ok
> ok
> 0 1 2 3 4 5 6 7 8 9 ok
> REVERSE 8 6 4 2 0
> :162: Stack underflow
> >>>REVERSE<<<
> Backtrace:
> $7F8B79A031A0 swap
> $7F8B79A031C0 roll
> $1
> $7F8B79A031C0 roll
> $3
> $7F8B79A031C0 roll
> $5
> $7F8B79A031C0 roll
> $7
> $7F8B79A57208 roll
> $5
> $9
> : REVERSE ( i*x i -- i*y ) 0 DO I DUP ROLL . DROP LOOP ; redefined REVERSE ok
> ok
> ok
> 0 1 2 3 4 5 6 7 8 9 ok
> REVERSE 0 7 5 3 1
> :167: Stack underflow
> >>>REVERSE<<<
> Backtrace:
> $7F8B79A031D0 swap
> $7F8B79A031C0 roll
> $2
> $7F8B79A031C0 roll
> $4
> $7F8B79A031C0 roll
> $6
> $7F8B79A031C0 roll
> $5
> $7F8B79A57298 roll
> $5
> $9
> ok
> ok
> ok
> ok
> bye

I think you just forget to check the stack depth

clearstack ok
ok
ok
0 1 2 3 4 5 6 7 8 9 \ last is 9 ok 10
.. 9 ok 9
: rev depth 0 do I roll loop ; ok 9
rev ok 9
\ should go 0 1 2 .. ok 9
.. . . . 0 1 2 3 ok 5

Re: Reverse Stack Oder, simple but... ( gForth)

<977e08c7-4fbb-45c0-8d8e-e778807f5d8bn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24402&group=comp.lang.forth#24402

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ad4:5591:0:b0:635:49d7:544f with SMTP id f17-20020ad45591000000b0063549d7544fmr194191qvx.4.1692880356880;
Thu, 24 Aug 2023 05:32:36 -0700 (PDT)
X-Received: by 2002:a63:3c15:0:b0:56c:6b2:95bb with SMTP id
j21-20020a633c15000000b0056c06b295bbmr2487261pga.5.1692880356378; Thu, 24 Aug
2023 05:32:36 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 24 Aug 2023 05:32:35 -0700 (PDT)
In-Reply-To: <48e9b418-c5db-40e4-bd50-b243fb4f3102n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=88.1.142.7; posting-account=oUnEFAoAAADoKEMDaPmswUef8xS_aFfv
NNTP-Posting-Host: 88.1.142.7
References: <b274bc39-85a2-4e69-8217-a2fee17d3476n@googlegroups.com> <48e9b418-c5db-40e4-bd50-b243fb4f3102n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <977e08c7-4fbb-45c0-8d8e-e778807f5d8bn@googlegroups.com>
Subject: Re: Reverse Stack Oder, simple but... ( gForth)
From: jemo07@gmail.com (SpainHackForth)
Injection-Date: Thu, 24 Aug 2023 12:32:36 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2051
 by: SpainHackForth - Thu, 24 Aug 2023 12:32 UTC

On Thursday, August 24, 2023 at 1:48:50 PM UTC+2, gobli...@gmail.com wrote:

> clearstack ok
> ok
> ok
> 0 1 2 3 4 5 6 7 8 9 \ last is 9 ok 10
> . 9 ok 9
> : rev depth 0 do I roll loop ; ok 9
> rev ok 9
> \ should go 0 1 2 .. ok 9
> . . . . 0 1 2 3 ok 5
Well,

I was trying to do something simple on the stack, I would use a buffer like:
VARIABLE REVERSE-BUFFER

: REVERSE-STACK ( -- )
DEPTH REVERSE-BUFFER ALLOT \ Allocate memory for the buffer

DEPTH 0 DO
I -1 * REVERSE-BUFFER + !
LOOP ;

: USE-REVERSED-ORDER ( -- )
REVERSE-BUFFER DEPTH 0 DO
I REVERSE-BUFFER + @ .
LOOP ;

I've not tried that, just meta from what I'm considering... Just the different results even though the stack was clear is what is troubling me.

Re: Reverse Stack Oder, simple but... ( gForth)

<7c433f06-118e-4389-9eac-31a28050f315n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24405&group=comp.lang.forth#24405

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:15:b0:407:fb08:c448 with SMTP id x21-20020a05622a001500b00407fb08c448mr188726qtw.0.1692883967741;
Thu, 24 Aug 2023 06:32:47 -0700 (PDT)
X-Received: by 2002:a17:90a:ce15:b0:262:da02:8a27 with SMTP id
f21-20020a17090ace1500b00262da028a27mr3558135pju.6.1692883967459; Thu, 24 Aug
2023 06:32:47 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 24 Aug 2023 06:32:46 -0700 (PDT)
In-Reply-To: <977e08c7-4fbb-45c0-8d8e-e778807f5d8bn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=83.22.107.239; posting-account=cxuXKwoAAABQpPOMD55A9IPz7pPrw6ml
NNTP-Posting-Host: 83.22.107.239
References: <b274bc39-85a2-4e69-8217-a2fee17d3476n@googlegroups.com>
<48e9b418-c5db-40e4-bd50-b243fb4f3102n@googlegroups.com> <977e08c7-4fbb-45c0-8d8e-e778807f5d8bn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7c433f06-118e-4389-9eac-31a28050f315n@googlegroups.com>
Subject: Re: Reverse Stack Oder, simple but... ( gForth)
From: zbigniew2011@gmail.com (Zbig)
Injection-Date: Thu, 24 Aug 2023 13:32:47 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1377
 by: Zbig - Thu, 24 Aug 2023 13:32 UTC

: revs
depth >r
depth cells allot
depth 0 do here i cells - ! loop
r> 0 do here i cells - @ loop
depth cells negate allot
;

Re: Reverse Stack Oder, simple but... ( gForth)

<7c01d52e-b6a0-472b-97fe-1e4f6e57294bn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24407&group=comp.lang.forth#24407

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:6591:b0:76c:d844:b414 with SMTP id qd17-20020a05620a659100b0076cd844b414mr153713qkn.14.1692885942176;
Thu, 24 Aug 2023 07:05:42 -0700 (PDT)
X-Received: by 2002:ad4:5591:0:b0:635:49d7:544f with SMTP id
f17-20020ad45591000000b0063549d7544fmr199887qvx.4.1692885941979; Thu, 24 Aug
2023 07:05:41 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 24 Aug 2023 07:05:41 -0700 (PDT)
In-Reply-To: <7c433f06-118e-4389-9eac-31a28050f315n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=83.22.107.239; posting-account=cxuXKwoAAABQpPOMD55A9IPz7pPrw6ml
NNTP-Posting-Host: 83.22.107.239
References: <b274bc39-85a2-4e69-8217-a2fee17d3476n@googlegroups.com>
<48e9b418-c5db-40e4-bd50-b243fb4f3102n@googlegroups.com> <977e08c7-4fbb-45c0-8d8e-e778807f5d8bn@googlegroups.com>
<7c433f06-118e-4389-9eac-31a28050f315n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7c01d52e-b6a0-472b-97fe-1e4f6e57294bn@googlegroups.com>
Subject: Re: Reverse Stack Oder, simple but... ( gForth)
From: zbigniew2011@gmail.com (Zbig)
Injection-Date: Thu, 24 Aug 2023 14:05:42 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Zbig - Thu, 24 Aug 2023 14:05 UTC

> : revs
> depth >r
> depth cells allot
> depth 0 do here i cells - ! loop
> r> 0 do here i cells - @ loop
> depth cells negate allot
> ;

Oh, but actually why allocating anything for that brief moment?
It can be shorter:

: reverse-stack ( -- )
depth dup >r 0 do here i cells + ! loop
r> 0 do here i cells + @ loop ;

Re: Reverse Stack Oder, simple but... ( gForth)

<fb3fe6cc-6280-4c53-8e9e-edb99a2513e9n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24413&group=comp.lang.forth#24413

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ad4:4f41:0:b0:64c:1937:6bd5 with SMTP id eu1-20020ad44f41000000b0064c19376bd5mr192029qvb.12.1692890976869;
Thu, 24 Aug 2023 08:29:36 -0700 (PDT)
X-Received: by 2002:a05:6a00:180c:b0:668:7512:7c49 with SMTP id
y12-20020a056a00180c00b0066875127c49mr9063313pfa.5.1692890976501; Thu, 24 Aug
2023 08:29:36 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 24 Aug 2023 08:29:35 -0700 (PDT)
In-Reply-To: <7c01d52e-b6a0-472b-97fe-1e4f6e57294bn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=88.1.142.7; posting-account=oUnEFAoAAADoKEMDaPmswUef8xS_aFfv
NNTP-Posting-Host: 88.1.142.7
References: <b274bc39-85a2-4e69-8217-a2fee17d3476n@googlegroups.com>
<48e9b418-c5db-40e4-bd50-b243fb4f3102n@googlegroups.com> <977e08c7-4fbb-45c0-8d8e-e778807f5d8bn@googlegroups.com>
<7c433f06-118e-4389-9eac-31a28050f315n@googlegroups.com> <7c01d52e-b6a0-472b-97fe-1e4f6e57294bn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <fb3fe6cc-6280-4c53-8e9e-edb99a2513e9n@googlegroups.com>
Subject: Re: Reverse Stack Oder, simple but... ( gForth)
From: jemo07@gmail.com (SpainHackForth)
Injection-Date: Thu, 24 Aug 2023 15:29:36 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: SpainHackForth - Thu, 24 Aug 2023 15:29 UTC

On Thursday, August 24, 2023 at 4:05:43 PM UTC+2, Zbig wrote:
> > : revs
> > depth >r
> > depth cells allot
> > depth 0 do here i cells - ! loop
> > r> 0 do here i cells - @ loop
> > depth cells negate allot
> > ;
> Oh, but actually why allocating anything for that brief moment?
> It can be shorter:
>
> : reverse-stack ( -- )
> depth dup >r 0 do here i cells + ! loop
> r> 0 do here i cells + @ loop ;
I just tried it, it is the same as my initial issue, it misses the "9" on the stack....

: reverse-stack ( -- ) compiled
depth dup >r 0 do here i cells + ! loop compiled
r> 0 do here i cells + @ loop ; ok
0 1 2 3 4 5 6 7 8 9 ok
reverse-stack ok
..S <10> 8 7 6 5 4 3 2 1 0 ok

Re: Reverse Stack Oder, simple but... ( gForth)

<e9a638bc-2ecc-471f-8321-2d03b95503ccn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24415&group=comp.lang.forth#24415

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:5987:0:b0:40c:84bb:1b09 with SMTP id e7-20020ac85987000000b0040c84bb1b09mr267810qte.0.1692891903500;
Thu, 24 Aug 2023 08:45:03 -0700 (PDT)
X-Received: by 2002:a17:903:1248:b0:1b8:a552:c8c9 with SMTP id
u8-20020a170903124800b001b8a552c8c9mr6784609plh.13.1692891903011; Thu, 24 Aug
2023 08:45:03 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 24 Aug 2023 08:45:02 -0700 (PDT)
In-Reply-To: <fb3fe6cc-6280-4c53-8e9e-edb99a2513e9n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=83.22.107.239; posting-account=cxuXKwoAAABQpPOMD55A9IPz7pPrw6ml
NNTP-Posting-Host: 83.22.107.239
References: <b274bc39-85a2-4e69-8217-a2fee17d3476n@googlegroups.com>
<48e9b418-c5db-40e4-bd50-b243fb4f3102n@googlegroups.com> <977e08c7-4fbb-45c0-8d8e-e778807f5d8bn@googlegroups.com>
<7c433f06-118e-4389-9eac-31a28050f315n@googlegroups.com> <7c01d52e-b6a0-472b-97fe-1e4f6e57294bn@googlegroups.com>
<fb3fe6cc-6280-4c53-8e9e-edb99a2513e9n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e9a638bc-2ecc-471f-8321-2d03b95503ccn@googlegroups.com>
Subject: Re: Reverse Stack Oder, simple but... ( gForth)
From: zbigniew2011@gmail.com (Zbig)
Injection-Date: Thu, 24 Aug 2023 15:45:03 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Zbig - Thu, 24 Aug 2023 15:45 UTC

czwartek, 24 sierpnia 2023 o 17:29:38 UTC+2 SpainHackForth napisał(a):
> On Thursday, August 24, 2023 at 4:05:43 PM UTC+2, Zbig wrote:
> > > : revs
> > > depth >r
> > > depth cells allot
> > > depth 0 do here i cells - ! loop
> > > r> 0 do here i cells - @ loop
> > > depth cells negate allot
> > > ;
> > Oh, but actually why allocating anything for that brief moment?
> > It can be shorter:
> >
> > : reverse-stack ( -- )
> > depth dup >r 0 do here i cells + ! loop
> > r> 0 do here i cells + @ loop ;
> I just tried it, it is the same as my initial issue, it misses the "9" on the stack....
>
> : reverse-stack ( -- ) compiled
> depth dup >r 0 do here i cells + ! loop compiled
> r> 0 do here i cells + @ loop ; ok
> 0 1 2 3 4 5 6 7 8 9 ok
> reverse-stack ok
> .S <10> 8 7 6 5 4 3 2 1 0 ok

It doesn't missing anything; Gforth displays just the nine
„highest” values from the stack. You didn't notice „ten” in
triangles directly before value list? It displays the stack's depth.

Re: Reverse Stack Oder, simple but... ( gForth)

<662d3324-b636-4a7b-878b-f9183b1c07b0n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24416&group=comp.lang.forth#24416

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:2708:b0:76d:b65b:59df with SMTP id b8-20020a05620a270800b0076db65b59dfmr139452qkp.7.1692892973276;
Thu, 24 Aug 2023 09:02:53 -0700 (PDT)
X-Received: by 2002:a63:7f02:0:b0:563:dced:3f35 with SMTP id
a2-20020a637f02000000b00563dced3f35mr3140142pgd.4.1692892972964; Thu, 24 Aug
2023 09:02:52 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 24 Aug 2023 09:02:52 -0700 (PDT)
In-Reply-To: <e9a638bc-2ecc-471f-8321-2d03b95503ccn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.174.47.232; posting-account=Ebqe4AoAAABfjCRL4ZqOHWv4jv5ZU4Cs
NNTP-Posting-Host: 77.174.47.232
References: <b274bc39-85a2-4e69-8217-a2fee17d3476n@googlegroups.com>
<48e9b418-c5db-40e4-bd50-b243fb4f3102n@googlegroups.com> <977e08c7-4fbb-45c0-8d8e-e778807f5d8bn@googlegroups.com>
<7c433f06-118e-4389-9eac-31a28050f315n@googlegroups.com> <7c01d52e-b6a0-472b-97fe-1e4f6e57294bn@googlegroups.com>
<fb3fe6cc-6280-4c53-8e9e-edb99a2513e9n@googlegroups.com> <e9a638bc-2ecc-471f-8321-2d03b95503ccn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <662d3324-b636-4a7b-878b-f9183b1c07b0n@googlegroups.com>
Subject: Re: Reverse Stack Oder, simple but... ( gForth)
From: the.beez.speaks@gmail.com (Hans Bezemer)
Injection-Date: Thu, 24 Aug 2023 16:02:53 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1968
 by: Hans Bezemer - Thu, 24 Aug 2023 16:02 UTC

On Thursday, August 24, 2023 at 5:45:04 PM UTC+2, Zbig wrote:
If your compiler uses the return stack as an actual return stack, you can try this:

Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `help' for basic help
: reverse begin dup while 1- swap r> swap >r >r repeat drop ; ok
: test 1 2 3 4 5 6 6 reverse r> . r> . r> . r> . r> . r> . ; ok
ok
test 1 2 3 4 5 6 ok

Hans Bezemer

Re: Reverse Stack Oder, simple but... ( gForth)

<858bd212-d838-4636-a42e-d28ad2b4e508n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24417&group=comp.lang.forth#24417

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:1b8d:b0:3f6:b052:3431 with SMTP id bp13-20020a05622a1b8d00b003f6b0523431mr197286qtb.5.1692893215310;
Thu, 24 Aug 2023 09:06:55 -0700 (PDT)
X-Received: by 2002:a05:620a:4706:b0:768:3e5f:a3c3 with SMTP id
bs6-20020a05620a470600b007683e5fa3c3mr226523qkb.14.1692893215077; Thu, 24 Aug
2023 09:06:55 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 24 Aug 2023 09:06:52 -0700 (PDT)
In-Reply-To: <662d3324-b636-4a7b-878b-f9183b1c07b0n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=83.22.107.239; posting-account=cxuXKwoAAABQpPOMD55A9IPz7pPrw6ml
NNTP-Posting-Host: 83.22.107.239
References: <b274bc39-85a2-4e69-8217-a2fee17d3476n@googlegroups.com>
<48e9b418-c5db-40e4-bd50-b243fb4f3102n@googlegroups.com> <977e08c7-4fbb-45c0-8d8e-e778807f5d8bn@googlegroups.com>
<7c433f06-118e-4389-9eac-31a28050f315n@googlegroups.com> <7c01d52e-b6a0-472b-97fe-1e4f6e57294bn@googlegroups.com>
<fb3fe6cc-6280-4c53-8e9e-edb99a2513e9n@googlegroups.com> <e9a638bc-2ecc-471f-8321-2d03b95503ccn@googlegroups.com>
<662d3324-b636-4a7b-878b-f9183b1c07b0n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <858bd212-d838-4636-a42e-d28ad2b4e508n@googlegroups.com>
Subject: Re: Reverse Stack Oder, simple but... ( gForth)
From: zbigniew2011@gmail.com (Zbig)
Injection-Date: Thu, 24 Aug 2023 16:06:55 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2324
 by: Zbig - Thu, 24 Aug 2023 16:06 UTC

czwartek, 24 sierpnia 2023 o 18:02:54 UTC+2 Hans Bezemer napisał(a):
> On Thursday, August 24, 2023 at 5:45:04 PM UTC+2, Zbig wrote:
> If your compiler uses the return stack as an actual return stack, you can try this:
>
> Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
> Type `help' for basic help
> : reverse begin dup while 1- swap r> swap >r >r repeat drop ; ok
> : test 1 2 3 4 5 6 6 reverse r> . r> . r> . r> . r> . r> . ; ok
> ok
> test 1 2 3 4 5 6 ok

Type `bye' to exit
: reverse begin dup while 1- swap r> swap >r >r repeat drop ; ok
1 2 3 4 5 6 7 8 9 0 ok
reverse ok
..s <9> 1 2 3 4 5 6 7 8 9 ok

„Houston…”

Re: Reverse Stack Oder, simple but... ( gForth)

<1147929a-6764-4827-ad0b-90beccd63098n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24419&group=comp.lang.forth#24419

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:8b15:b0:76d:9217:43e7 with SMTP id qw21-20020a05620a8b1500b0076d921743e7mr181567qkn.7.1692893593496;
Thu, 24 Aug 2023 09:13:13 -0700 (PDT)
X-Received: by 2002:a05:6a00:15c6:b0:68b:dbad:7ae1 with SMTP id
o6-20020a056a0015c600b0068bdbad7ae1mr2089229pfu.5.1692893593016; Thu, 24 Aug
2023 09:13:13 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 24 Aug 2023 09:13:12 -0700 (PDT)
In-Reply-To: <858bd212-d838-4636-a42e-d28ad2b4e508n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.174.47.232; posting-account=Ebqe4AoAAABfjCRL4ZqOHWv4jv5ZU4Cs
NNTP-Posting-Host: 77.174.47.232
References: <b274bc39-85a2-4e69-8217-a2fee17d3476n@googlegroups.com>
<48e9b418-c5db-40e4-bd50-b243fb4f3102n@googlegroups.com> <977e08c7-4fbb-45c0-8d8e-e778807f5d8bn@googlegroups.com>
<7c433f06-118e-4389-9eac-31a28050f315n@googlegroups.com> <7c01d52e-b6a0-472b-97fe-1e4f6e57294bn@googlegroups.com>
<fb3fe6cc-6280-4c53-8e9e-edb99a2513e9n@googlegroups.com> <e9a638bc-2ecc-471f-8321-2d03b95503ccn@googlegroups.com>
<662d3324-b636-4a7b-878b-f9183b1c07b0n@googlegroups.com> <858bd212-d838-4636-a42e-d28ad2b4e508n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1147929a-6764-4827-ad0b-90beccd63098n@googlegroups.com>
Subject: Re: Reverse Stack Oder, simple but... ( gForth)
From: the.beez.speaks@gmail.com (Hans Bezemer)
Injection-Date: Thu, 24 Aug 2023 16:13:13 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1998
 by: Hans Bezemer - Thu, 24 Aug 2023 16:13 UTC

On Thursday, August 24, 2023 at 6:06:56 PM UTC+2, Zbig wrote:
> „Houston…”

Untrue - you're making an error: ( i*x i -- i*y )

The number of elements to be reverse has to be correct- which isn't the case:

1 2 3 4 5 6 7 8 9 0 ok
reverse ok

Since you specify ZERO elements.

Hans Bezemer

Re: Reverse Stack Oder, simple but... ( gForth)

<f6e8b753-3ad0-44fd-8ccc-abdd69c551den@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24420&group=comp.lang.forth#24420

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:8e:b0:410:9af1:f9d1 with SMTP id o14-20020a05622a008e00b004109af1f9d1mr187420qtw.9.1692894406842;
Thu, 24 Aug 2023 09:26:46 -0700 (PDT)
X-Received: by 2002:a05:6a00:2d01:b0:68a:290a:8a02 with SMTP id
fa1-20020a056a002d0100b0068a290a8a02mr7585677pfb.3.1692894405899; Thu, 24 Aug
2023 09:26:45 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 24 Aug 2023 09:26:45 -0700 (PDT)
In-Reply-To: <e9a638bc-2ecc-471f-8321-2d03b95503ccn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=88.1.142.7; posting-account=oUnEFAoAAADoKEMDaPmswUef8xS_aFfv
NNTP-Posting-Host: 88.1.142.7
References: <b274bc39-85a2-4e69-8217-a2fee17d3476n@googlegroups.com>
<48e9b418-c5db-40e4-bd50-b243fb4f3102n@googlegroups.com> <977e08c7-4fbb-45c0-8d8e-e778807f5d8bn@googlegroups.com>
<7c433f06-118e-4389-9eac-31a28050f315n@googlegroups.com> <7c01d52e-b6a0-472b-97fe-1e4f6e57294bn@googlegroups.com>
<fb3fe6cc-6280-4c53-8e9e-edb99a2513e9n@googlegroups.com> <e9a638bc-2ecc-471f-8321-2d03b95503ccn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f6e8b753-3ad0-44fd-8ccc-abdd69c551den@googlegroups.com>
Subject: Re: Reverse Stack Oder, simple but... ( gForth)
From: jemo07@gmail.com (SpainHackForth)
Injection-Date: Thu, 24 Aug 2023 16:26:46 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2853
 by: SpainHackForth - Thu, 24 Aug 2023 16:26 UTC

On Thursday, August 24, 2023 at 5:45:04 PM UTC+2, Zbig wrote:
> czwartek, 24 sierpnia 2023 o 17:29:38 UTC+2 SpainHackForth napisał(a):
> > On Thursday, August 24, 2023 at 4:05:43 PM UTC+2, Zbig wrote:
> > > > : revs
> > > > depth >r
> > > > depth cells allot
> > > > depth 0 do here i cells - ! loop
> > > > r> 0 do here i cells - @ loop
> > > > depth cells negate allot
> > > > ;
> > > Oh, but actually why allocating anything for that brief moment?
> > > It can be shorter:
> > >
> > > : reverse-stack ( -- )
> > > depth dup >r 0 do here i cells + ! loop
> > > r> 0 do here i cells + @ loop ;
> > I just tried it, it is the same as my initial issue, it misses the "9" on the stack....
> >
> > : reverse-stack ( -- ) compiled
> > depth dup >r 0 do here i cells + ! loop compiled
> > r> 0 do here i cells + @ loop ; ok
> > 0 1 2 3 4 5 6 7 8 9 ok
> > reverse-stack ok
> > .S <10> 8 7 6 5 4 3 2 1 0 ok
> It doesn't missing anything; Gforth displays just the nine
> „highest” values from the stack. You didn't notice „ten” in
> triangles directly before value list? It displays the stack's depth.
Really? Man, the rat holes I have been trough... I did not know that...

Re: Reverse Stack Oder, simple but... ( gForth)

<d9acc725-8145-4615-b459-003cb163515cn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24421&group=comp.lang.forth#24421

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a0c:fa41:0:b0:647:1ef1:cea4 with SMTP id k1-20020a0cfa41000000b006471ef1cea4mr280265qvo.6.1692894460610;
Thu, 24 Aug 2023 09:27:40 -0700 (PDT)
X-Received: by 2002:ad4:551c:0:b0:649:f255:e483 with SMTP id
pz28-20020ad4551c000000b00649f255e483mr180429qvb.5.1692894460390; Thu, 24 Aug
2023 09:27:40 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 24 Aug 2023 09:27:40 -0700 (PDT)
In-Reply-To: <1147929a-6764-4827-ad0b-90beccd63098n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=83.22.107.239; posting-account=cxuXKwoAAABQpPOMD55A9IPz7pPrw6ml
NNTP-Posting-Host: 83.22.107.239
References: <b274bc39-85a2-4e69-8217-a2fee17d3476n@googlegroups.com>
<48e9b418-c5db-40e4-bd50-b243fb4f3102n@googlegroups.com> <977e08c7-4fbb-45c0-8d8e-e778807f5d8bn@googlegroups.com>
<7c433f06-118e-4389-9eac-31a28050f315n@googlegroups.com> <7c01d52e-b6a0-472b-97fe-1e4f6e57294bn@googlegroups.com>
<fb3fe6cc-6280-4c53-8e9e-edb99a2513e9n@googlegroups.com> <e9a638bc-2ecc-471f-8321-2d03b95503ccn@googlegroups.com>
<662d3324-b636-4a7b-878b-f9183b1c07b0n@googlegroups.com> <858bd212-d838-4636-a42e-d28ad2b4e508n@googlegroups.com>
<1147929a-6764-4827-ad0b-90beccd63098n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d9acc725-8145-4615-b459-003cb163515cn@googlegroups.com>
Subject: Re: Reverse Stack Oder, simple but... ( gForth)
From: zbigniew2011@gmail.com (Zbig)
Injection-Date: Thu, 24 Aug 2023 16:27:40 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2254
 by: Zbig - Thu, 24 Aug 2023 16:27 UTC

Oh, sorry — indeed I should've create appropriate 'test' word,
but — you know — I dare to to judge my solution being not as
brilliant, but somewhat more practical.
By adding at the beginning one more line as „security fuse” it
accepts any stack depth and it doesn't require any „special”
words to get the job done:

: reverse-stack ( -- )
depth 0= if ." Nothing to reverse; the stack is empty" exit then
depth dup >r 0 do here i cells + ! loop
r> 0 do here i cells + @ loop ;

Re: Reverse Stack Oder, simple but... ( gForth)

<af317a41-9046-42a4-8725-7bbd0eb7a40an@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24422&group=comp.lang.forth#24422

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:4706:b0:76d:86b1:ece6 with SMTP id bs6-20020a05620a470600b0076d86b1ece6mr222300qkb.7.1692894542138;
Thu, 24 Aug 2023 09:29:02 -0700 (PDT)
X-Received: by 2002:a17:902:fb03:b0:1bb:8c42:79f4 with SMTP id
le3-20020a170902fb0300b001bb8c4279f4mr5708803plb.2.1692894541867; Thu, 24 Aug
2023 09:29:01 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 24 Aug 2023 09:29:01 -0700 (PDT)
In-Reply-To: <f6e8b753-3ad0-44fd-8ccc-abdd69c551den@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=83.22.107.239; posting-account=cxuXKwoAAABQpPOMD55A9IPz7pPrw6ml
NNTP-Posting-Host: 83.22.107.239
References: <b274bc39-85a2-4e69-8217-a2fee17d3476n@googlegroups.com>
<48e9b418-c5db-40e4-bd50-b243fb4f3102n@googlegroups.com> <977e08c7-4fbb-45c0-8d8e-e778807f5d8bn@googlegroups.com>
<7c433f06-118e-4389-9eac-31a28050f315n@googlegroups.com> <7c01d52e-b6a0-472b-97fe-1e4f6e57294bn@googlegroups.com>
<fb3fe6cc-6280-4c53-8e9e-edb99a2513e9n@googlegroups.com> <e9a638bc-2ecc-471f-8321-2d03b95503ccn@googlegroups.com>
<f6e8b753-3ad0-44fd-8ccc-abdd69c551den@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <af317a41-9046-42a4-8725-7bbd0eb7a40an@googlegroups.com>
Subject: Re: Reverse Stack Oder, simple but... ( gForth)
From: zbigniew2011@gmail.com (Zbig)
Injection-Date: Thu, 24 Aug 2023 16:29:02 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Zbig - Thu, 24 Aug 2023 16:29 UTC

> > nine „highest” values from the stack. You didn't notice „ten” in
> > triangles directly before value list? It displays the stack's depth.
> Really? Man, the rat holes I have been trough... I did not know that...

Just enter twelve values and then type the usual „.S”… :D

Re: Reverse Stack Oder, simple but... ( gForth)

<657ee4a5-c61d-4e95-be40-b8d3e61d7b30n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24423&group=comp.lang.forth#24423

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ad4:598e:0:b0:63f:a7c8:a711 with SMTP id ek14-20020ad4598e000000b0063fa7c8a711mr196476qvb.8.1692897589367;
Thu, 24 Aug 2023 10:19:49 -0700 (PDT)
X-Received: by 2002:a17:90b:1204:b0:26d:1e9:c1e with SMTP id
gl4-20020a17090b120400b0026d01e90c1emr3740779pjb.9.1692897588846; Thu, 24 Aug
2023 10:19:48 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 24 Aug 2023 10:19:48 -0700 (PDT)
In-Reply-To: <f6e8b753-3ad0-44fd-8ccc-abdd69c551den@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=83.22.107.239; posting-account=cxuXKwoAAABQpPOMD55A9IPz7pPrw6ml
NNTP-Posting-Host: 83.22.107.239
References: <b274bc39-85a2-4e69-8217-a2fee17d3476n@googlegroups.com>
<48e9b418-c5db-40e4-bd50-b243fb4f3102n@googlegroups.com> <977e08c7-4fbb-45c0-8d8e-e778807f5d8bn@googlegroups.com>
<7c433f06-118e-4389-9eac-31a28050f315n@googlegroups.com> <7c01d52e-b6a0-472b-97fe-1e4f6e57294bn@googlegroups.com>
<fb3fe6cc-6280-4c53-8e9e-edb99a2513e9n@googlegroups.com> <e9a638bc-2ecc-471f-8321-2d03b95503ccn@googlegroups.com>
<f6e8b753-3ad0-44fd-8ccc-abdd69c551den@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <657ee4a5-c61d-4e95-be40-b8d3e61d7b30n@googlegroups.com>
Subject: Re: Reverse Stack Oder, simple but... ( gForth)
From: zbigniew2011@gmail.com (Zbig)
Injection-Date: Thu, 24 Aug 2023 17:19:49 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2199
 by: Zbig - Thu, 24 Aug 2023 17:19 UTC

> Really? Man, the rat holes I have been trough... I did not know that...

It's worth to take a peek into „F… ine Manual” sometimes. Consider
one more example:

Gforth:
1 2 3 4 5 6 7 8 9 10 11 12 ok
..s <12> 4 5 6 7 8 9 10 11 12 ok
pForth:
1 2 3 4 5 6 7 8 9 10 11 12 ok
Stack<10> 1 2 3 4 5 6 7 8 9 10 11 12

So twelve values, but pForth says „ten” in triangles. A bug?
Something wrong on the stack? No!
Just pForth reports in triangles the current BASE (in decimal),
not the stack's depth. Have a look:
hex ok
Stack<16> 1 2 3 4 5 6 7 8 9 A B C

Re: Reverse Stack Oder, simple but... ( gForth)

<uc9csd$3sfpl$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24430&group=comp.lang.forth#24430

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxforth@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: Reverse Stack Oder, simple but... ( gForth)
Date: Fri, 25 Aug 2023 15:06:20 +1000
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <uc9csd$3sfpl$1@dont-email.me>
References: <b274bc39-85a2-4e69-8217-a2fee17d3476n@googlegroups.com>
<48e9b418-c5db-40e4-bd50-b243fb4f3102n@googlegroups.com>
<977e08c7-4fbb-45c0-8d8e-e778807f5d8bn@googlegroups.com>
<7c433f06-118e-4389-9eac-31a28050f315n@googlegroups.com>
<7c01d52e-b6a0-472b-97fe-1e4f6e57294bn@googlegroups.com>
<fb3fe6cc-6280-4c53-8e9e-edb99a2513e9n@googlegroups.com>
<e9a638bc-2ecc-471f-8321-2d03b95503ccn@googlegroups.com>
<f6e8b753-3ad0-44fd-8ccc-abdd69c551den@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 25 Aug 2023 05:06:21 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f5636ee2c637a6cc7ce65f3caa2ab442";
logging-data="4079413"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/B58zxV4q+pFPa6oE+9rQk"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:GPY+bu3mTwqBuxHkSldOgFve3ak=
In-Reply-To: <f6e8b753-3ad0-44fd-8ccc-abdd69c551den@googlegroups.com>
Content-Language: en-GB
 by: dxforth - Fri, 25 Aug 2023 05:06 UTC

On 25/08/2023 2:26 am, SpainHackForth wrote:
> On Thursday, August 24, 2023 at 5:45:04 PM UTC+2, Zbig wrote:
>> czwartek, 24 sierpnia 2023 o 17:29:38 UTC+2 SpainHackForth napisał(a):
>>> On Thursday, August 24, 2023 at 4:05:43 PM UTC+2, Zbig wrote:
>>>>> : revs
>>>>> depth >r
>>>>> depth cells allot
>>>>> depth 0 do here i cells - ! loop
>>>>> r> 0 do here i cells - @ loop
>>>>> depth cells negate allot
>>>>> ;
>>>> Oh, but actually why allocating anything for that brief moment?
>>>> It can be shorter:
>>>>
>>>> : reverse-stack ( -- )
>>>> depth dup >r 0 do here i cells + ! loop
>>>> r> 0 do here i cells + @ loop ;
>>> I just tried it, it is the same as my initial issue, it misses the "9" on the stack....
>>>
>>> : reverse-stack ( -- ) compiled
>>> depth dup >r 0 do here i cells + ! loop compiled
>>> r> 0 do here i cells + @ loop ; ok
>>> 0 1 2 3 4 5 6 7 8 9 ok
>>> reverse-stack ok
>>> .S <10> 8 7 6 5 4 3 2 1 0 ok
>> It doesn't missing anything; Gforth displays just the nine
>> „highest” values from the stack. You didn't notice „ten” in
>> triangles directly before value list? It displays the stack's depth.
> Really? Man, the rat holes I have been trough... I did not know that...

The computer knows what's good for you - don't question it.
Apparently today's calculators are like this. I'll find out soon
enough having just ordered one :)

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor