| Deutsch English Français Italiano |
|
<nnd$110c5c8a$5c81bf80@06e9f4f0276a1e49> View for Bookmarking (what is this?) Look up another Usenet article |
Newsgroups: comp.lang.forth References: <nnd$3d18fe02$76aace5d@9eae9618ab09b239> <nnd$43b12c93$7f618144@18dd570284c2b77b> <66badc17$1@news.ausics.net> <nnd$274f6c32$10db022f@ea48fe6bf4bc59ed> From: albert@spenarnc.xs4all.nl Subject: Re: portable or not? Volatile strings X-Newsreader: trn 4.0-test77 (Sep 1, 2010) Originator: albert@cherry.(none) (albert) Message-ID: <nnd$110c5c8a$5c81bf80@06e9f4f0276a1e49> Organization: KPN B.V. Date: Thu, 22 Aug 2024 12:59:15 +0200 Path: news.eternal-september.org!eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!panix!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feed.abavia.com!abe004.abavia.com!abp002.abavia.com!news.kpn.nl!not-for-mail Lines: 71 Injection-Date: Thu, 22 Aug 2024 12:59:15 +0200 Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com" In article <nnd$274f6c32$10db022f@ea48fe6bf4bc59ed>, Hans Bezemer <the.beez.speaks@gmail.com> wrote: >On 13-08-2024 06:07, dxf wrote: >> On 13/08/2024 5:34 am, albert@spenarnc.xs4all.nl wrote: >>> ... >>> In my book the code should be >>> >>> " " >>> "###### " >>> " ## " >>> " " >>> DEF-BRICK BRICK1 >>> >>> Instead of >>> >>> DEF-BRICK BRICK1 S" " >>> S" ###### " >>> S" ## " >>> S" " >>> >>> The code (untested) could be >>> : DEF-BRICK CREATE >>> 2>R 2>R 2>R 2>R >>> 2R> ,, 2R> ,, 2R> ,, 2R> ,, >>> DOES> ... ; >> >> OTOH it's no less difficult to write... >> >> : M" [CHAR] " PARSE HERE OVER ALLOT SWAP MOVE ; >> >> : DEF-BRICK CREATE DOES> ROT 4 * ROT + 2* CHARS + ; >> >> DEF-BRICK BRICK1 M" " >> M" ###### " >> M" ## " >> M" " >> > >In 4tH, the easiest solution would be: > >: BRICK@ ROT + @C SWAP 2* CHARS + ; > >CREATE BRICK1 > ," " > ," ###### " > ," ## " > ," " >DOES> BRICK@ ; I dislike the use of parsing here by ," . It happens to work because ," doesn't destroy the concatenation of HERE. So you couldn't check the solution without digging into the 4TH documentation. In these case parsing is more or less advantageous because it allows easier represent the bricks. The introduction of an auxiliary word M" that is easily understood and checked is far superior using ," . I changed my version to use the proposed M" now and it works fine. > >I could throw a bit of preprocessor magic in the mix, so it would >resemble your solution even closer, but I guess you can do without ;-) > >Hans Bezemer -- Temu exploits Christians: (Disclaimer, only 10 apostles) Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall Art For Home, Office And Garden Decor - Perfect For Windows, Bars, And Gifts For Friends Family And Colleagues.