Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #16855 > unrolled thread
| Started by | Mark Wills <forthfreak@gmail.com> |
|---|---|
| First post | 2012-10-31 04:58 -0700 |
| Last post | 2013-03-04 10:41 -1000 |
| Articles | 16 on this page of 176 — 28 participants |
Back to article view | Back to comp.lang.forth
Is there a better way? Mark Wills <forthfreak@gmail.com> - 2012-10-31 04:58 -0700
Re: Is there a better way? Paul Rubin <no.email@nospam.invalid> - 2012-10-31 05:22 -0700
Re: Is there a better way? Mark Wills <forthfreak@gmail.com> - 2012-10-31 05:44 -0700
Re: Is there a better way? "Rod Pemberton" <do_not_have@notemailnotz.cnm> - 2012-10-31 11:29 -0400
Re: Is there a better way? "Rod Pemberton" <do_not_have@notemailnotz.cnm> - 2012-10-31 11:40 -0400
Re: Is there a better way? Mark Wills <forthfreak@gmail.com> - 2012-10-31 08:45 -0700
Re: Is there a better way? "Rod Pemberton" <do_not_have@notemailnotz.cnm> - 2012-11-02 04:48 -0400
Re: Is there a better way? rickman <gnuarm@gmail.com> - 2012-10-31 21:42 -0400
Re: Is there a better way? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-11-01 19:19 -0700
Re: Is there a better way? rickman <gnuarm@gmail.com> - 2012-11-02 13:06 -0400
Re: Is there a better way? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-11-02 12:18 -0500
Re: Is there a better way? rickman <gnuarm@gmail.com> - 2012-11-02 14:34 -0400
Re: Is there a better way? Paul Rubin <no.email@nospam.invalid> - 2012-11-02 11:39 -0700
Re: Is there a better way? rickman <gnuarm@gmail.com> - 2012-11-02 14:43 -0400
Re: Is there a better way? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-11-04 02:36 -0600
Re: Is there a better way? rickman <gnuarm@gmail.com> - 2012-11-04 14:18 -0500
Re: Is there a better way? Mark Wills <forthfreak@gmail.com> - 2012-11-02 14:38 -0700
Re: Is there a better way? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-11-04 03:01 -0600
Re: Is there a better way? Mark Wills <forthfreak@gmail.com> - 2012-11-04 03:54 -0800
Re: Is there a better way? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-11-04 07:59 -0600
Re: Is there a better way? Elizabeth D Rather <erather@forth.com> - 2012-11-04 08:34 -1000
Re: Is there a better way? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-11-04 15:22 -0800
Re: Is there a better way? Mark Wills <forthfreak@gmail.com> - 2012-11-05 02:39 -0800
Words consuming arguments, was [Re: Is there a better way?] "Rod Pemberton" <do_not_have@notemailnotz.cnm> - 2012-11-05 14:01 -0500
Re: Words consuming arguments, was [Re: Is there a better way?] "Elizabeth D. Rather" <erather@forth.com> - 2012-11-05 10:39 -1000
Re: Words consuming arguments, was [Re: Is there a better way?] Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-11-05 21:07 -0800
Re: Words consuming arguments, was [Re: Is there a better way?] "Rod Pemberton" <do_not_have@notemailnotz.cnm> - 2012-11-06 20:57 -0500
Re: Words consuming arguments, was [Re: Is there a better way?] Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-11-06 21:43 -0800
Re: Words consuming arguments, was [Re: Is there a better way?] Mark Wills <forthfreak@gmail.com> - 2012-11-07 03:52 -0800
Re: Words consuming arguments, was [Re: Is there a better way?] "Rod Pemberton" <do_not_have@notemailnotz.cnm> - 2012-11-07 19:55 -0500
Re: Words consuming arguments, was [Re: Is there a better way?] "Elizabeth D. Rather" <erather@forth.com> - 2012-11-07 20:46 -1000
Re: Words consuming arguments, was [Re: Is there a better way?] stephenXXX@mpeforth.com (Stephen Pelc) - 2012-11-08 10:39 +0000
Re: Words consuming arguments, was [Re: Is there a better way?] Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-11-12 03:48 -0600
Re: Words consuming arguments, was [Re: Is there a better way?] "Elizabeth D. Rather" <erather@forth.com> - 2012-11-12 07:57 -1000
Re: Words consuming arguments, was [Re: Is there a better way?] "Rod Pemberton" <do_not_have@notemailnotz.cnm> - 2012-11-12 19:50 -0500
Re: Words consuming arguments, was [Re: Is there a better way?] "Rod Pemberton" <do_not_have@notemailnotz.cnm> - 2012-11-12 19:49 -0500
Re: Words consuming arguments, was [Re: Is there a better way?] "Elizabeth D. Rather" <erather@forth.com> - 2012-11-12 15:00 -1000
Re: Words consuming arguments, was [Re: Is there a better way?] Mark Wills <forthfreak@gmail.com> - 2012-11-13 00:50 -0800
Re: Words consuming arguments, was [Re: Is there a better way?] Mark Wills <forthfreak@gmail.com> - 2012-11-13 00:58 -0800
Re: Words consuming arguments, was [Re: Is there a better way?] "Elizabeth D. Rather" <erather@forth.com> - 2012-11-12 23:17 -1000
Re: Words consuming arguments, was [Re: Is there a better way?] albert@spenarnc.xs4all.nl (Albert van der Horst) - 2012-11-13 13:44 +0000
Re: Words consuming arguments, was [Re: Is there a better way?] anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-11-13 13:53 +0000
Re: Words consuming arguments, was [Re: Is there a better way?] Alex McDonald <blog@rivadpm.com> - 2012-11-13 06:39 -0800
Re: Words consuming arguments, was [Re: Is there a better way?] anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-11-13 18:02 +0000
Re: Words consuming arguments, was [Re: Is there a better way?] Alex McDonald <blog@rivadpm.com> - 2012-11-13 12:10 -0800
Re: Words consuming arguments, was [Re: Is there a better way?] anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-11-15 16:59 +0000
Re: Words consuming arguments, was [Re: Is there a better way?] Mark Wills <forthfreak@gmail.com> - 2012-11-13 07:55 -0800
Re: Words consuming arguments, was [Re: Is there a better way?] "Rod Pemberton" <do_not_have@notemailnotz.cnm> - 2012-11-14 06:34 -0500
Re: Words consuming arguments, was [Re: Is there a better way?] Mark Wills <forthfreak@gmail.com> - 2012-11-14 05:01 -0800
Re: Words consuming arguments, was [Re: Is there a better way?] albert@spenarnc.xs4all.nl (Albert van der Horst) - 2012-11-14 16:11 +0000
Re: Words consuming arguments, was [Re: Is there a better way?] "Elizabeth D. Rather" <erather@forth.com> - 2012-11-14 09:36 -1000
Re: Words consuming arguments, was [Re: Is there a better way?] humptydumpty <ouatubi@gmail.com> - 2012-11-14 12:19 -0800
Re: Words consuming arguments, was [Re: Is there a better way?] Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-11-13 10:20 -0600
Re: Words consuming arguments, was [Re: Is there a better way?] Brad Eckert <hwfwguy@gmail.com> - 2012-11-13 08:50 -0800
Re: Words consuming arguments, was [Re: Is there a better way?] "Rod Pemberton" <do_not_have@notemailnotz.cnm> - 2012-11-14 06:42 -0500
Re: Words consuming arguments, was [Re: Is there a better way?] stephenXXX@mpeforth.com (Stephen Pelc) - 2012-11-14 14:14 +0000
Re: Words consuming arguments, was [Re: Is there a better way?] anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-11-14 15:28 +0000
Re: Words consuming arguments, was [Re: Is there a better way?] Bernd Paysan <bernd.paysan@gmx.de> - 2012-11-14 17:54 +0100
Re: Words consuming arguments, was [Re: Is there a better way?] Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-11-14 15:01 -0800
Re: Words consuming arguments, was [Re: Is there a better way?] Mark Wills <forthfreak@gmail.com> - 2012-11-15 00:08 -0800
Strings (was: Words consuming arguments) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-11-15 15:18 +0000
Re: Strings (was: Words consuming arguments) albert@spenarnc.xs4all.nl (Albert van der Horst) - 2012-11-15 16:36 +0000
Re: Strings (was: Words consuming arguments) "Rod Pemberton" <do_not_have@notemailnotz.cnm> - 2012-11-15 18:35 -0500
Re: Strings (was: Words consuming arguments) stephenXXX@mpeforth.com (Stephen Pelc) - 2012-11-16 00:36 +0000
Re: Strings (was: Words consuming arguments) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-11-16 17:42 +0000
Re: Strings (was: Words consuming arguments) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-11-16 17:55 +0000
Re: Words consuming arguments, was [Re: Is there a better way?] Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-11-17 04:18 -0800
Re: Words consuming arguments, was [Re: Is there a better way?] Alex McDonald <blog@rivadpm.com> - 2012-11-17 04:56 -0800
Re: Words consuming arguments, was [Re: Is there a better way?] "Elizabeth D. Rather" <erather@forth.com> - 2012-11-17 07:24 -1000
Re: Words consuming arguments, was [Re: Is there a better way?] Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-11-19 15:58 -0800
Re: Words consuming arguments, was [Re: Is there a better way?] Brad Eckert <hwfwguy@gmail.com> - 2012-11-20 08:17 -0800
Re: Words consuming arguments, was [Re: Is there a better way?] "Rod Pemberton" <do_not_have@notemailnotz.cnm> - 2012-11-14 06:30 -0500
Re: Words consuming arguments, was [Re: Is there a better way?] "Elizabeth D. Rather" <erather@forth.com> - 2012-11-14 09:06 -1000
Re: Words consuming arguments, was [Re: Is there a better way?] "Rod Pemberton" <do_not_have@notemailnotz.cnm> - 2012-11-15 06:18 -0500
Re: Words consuming arguments, was [Re: Is there a better way?] Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-11-13 04:26 -0600
Re: Words consuming arguments, was [Re: Is there a better way?] "Rod Pemberton" <do_not_have@notemailnotz.cnm> - 2012-11-14 06:29 -0500
Re: Words consuming arguments, was [Re: Is there a better way?] Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-11-14 06:03 -0600
Re: Words consuming arguments, was [Re: Is there a better way?] "Rod Pemberton" <do_not_have@notemailnotz.cnm> - 2012-11-15 07:15 -0500
Re: Words consuming arguments, was [Re: Is there a better way?] Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-11-15 11:51 -0600
Re: Words consuming arguments, was [Re: Is there a better way?] "Rod Pemberton" <do_not_have@notemailnotz.cnm> - 2012-11-15 18:44 -0500
Re: Words consuming arguments, was [Re: Is there a better way?] Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-11-16 03:50 -0600
Re: Words consuming arguments, was [Re: Is there a better way?] "Elizabeth D. Rather" <erather@forth.com> - 2012-11-15 08:09 -1000
Re: Words consuming arguments, was [Re: Is there a better way?] "Elizabeth D. Rather" <erather@forth.com> - 2012-11-06 21:19 -1000
Re: Words consuming arguments, was [Re: Is there a better way?] "Rod Pemberton" <do_not_have@notemailnotz.cnm> - 2012-11-07 20:00 -0500
Re: Words consuming arguments, was [Re: Is there a better way?] stephenXXX@mpeforth.com (Stephen Pelc) - 2012-11-08 10:49 +0000
Re: Words consuming arguments, was [Re: Is there a better way?] albert@spenarnc.xs4all.nl (Albert van der Horst) - 2012-11-07 14:01 +0000
Re: Is there a better way? awegel@arcor.de (Alex Wegel) - 2012-11-04 11:07 +0100
Re: Is there a better way? awegel@arcor.de (Alex Wegel) - 2012-11-04 11:36 +0100
Re: Is there a better way? Mark Wills <forthfreak@gmail.com> - 2012-11-04 03:48 -0800
Re: Is there a better way? awegel@arcor.de (Alex Wegel) - 2012-11-04 13:31 +0100
Re: Is there a better way? Coos Haak <chforth@hccnet.nl> - 2012-11-04 13:29 +0100
Re: Is there a better way? Mark Wills <forthfreak@gmail.com> - 2012-11-04 04:42 -0800
Re: Is there a better way? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-11-04 02:38 -0600
Re: Is there a better way? Doug Hoffman <glidedog@gmail.com> - 2012-10-31 10:20 -0400
Re: Is there a better way? humptydumpty <ouatubi@gmail.com> - 2012-10-31 05:53 -0700
Re: Is there a better way? Doug Hoffman <glidedog@gmail.com> - 2012-10-31 09:23 -0400
Re: Is there a better way? Mark Wills <forthfreak@gmail.com> - 2012-10-31 06:41 -0700
Re: Is there a better way? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-10-31 11:46 -0500
Re: Is there a better way? Mark Wills <forthfreak@gmail.com> - 2012-10-31 14:27 -0700
Re: Is there a better way? Paul Rubin <no.email@nospam.invalid> - 2012-10-31 14:32 -0700
Re: Is there a better way? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-10-31 16:15 -0700
Re: Is there a better way? Coos Haak <chforth@hccnet.nl> - 2012-10-31 22:49 +0100
Re: Is there a better way? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-10-31 17:13 -0500
Re: Is there a better way? Mark Wills <forthfreak@gmail.com> - 2012-10-31 23:39 -0700
Re: Is there a better way? "Elizabeth D. Rather" <erather@forth.com> - 2012-10-31 20:58 -1000
Re: Is there a better way? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-11-01 02:04 -0700
Re: Is there a better way? "Rod Pemberton" <do_not_have@notemailnotz.cnm> - 2012-10-31 19:13 -0400
Re: Is there a better way? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-11-02 17:31 +0000
Re: Is there a better way? Paul Rubin <no.email@nospam.invalid> - 2012-11-02 10:37 -0700
Re: Is there a better way? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-11-02 18:12 +0000
Re: Is there a better way? "Elizabeth D. Rather" <erather@forth.com> - 2012-11-02 08:29 -1000
Re: Is there a better way? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-11-05 14:53 +0000
Re: Is there a better way? Paul Rubin <no.email@nospam.invalid> - 2012-11-02 11:30 -0700
Re: Is there a better way? Bernd Paysan <bernd.paysan@gmx.de> - 2012-11-03 00:15 +0100
Re: Is there a better way? rickman <gnuarm@gmail.com> - 2012-11-02 19:21 -0400
Re: Is there a better way? Bernd Paysan <bernd.paysan@gmx.de> - 2012-11-03 00:42 +0100
Re: Is there a better way? rickman <gnuarm@gmail.com> - 2012-11-02 20:21 -0400
Re: Is there a better way? Bernd Paysan <bernd.paysan@gmx.de> - 2012-11-03 01:44 +0100
Re: Is there a better way? rickman <gnuarm@gmail.com> - 2012-11-03 12:12 -0400
Re: Is there a better way? Bernd Paysan <bernd.paysan@gmx.de> - 2012-11-03 18:24 +0100
Re: Is there a better way? rickman <gnuarm@gmail.com> - 2012-11-03 14:00 -0400
Re: Is there a better way? Paul Rubin <no.email@nospam.invalid> - 2012-11-03 10:29 -0700
Re: Is there a better way? Paul Rubin <no.email@nospam.invalid> - 2012-11-02 18:42 -0700
Re: Is there a better way? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-11-05 11:45 +0000
Re: Is there a better way? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2012-11-01 21:00 +0000
Re: Is there a better way? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2012-10-31 15:26 +0000
Re: Is there a better way? Doug Hoffman <glidedog@gmail.com> - 2012-10-31 12:22 -0400
Re: Is there a better way? Mark Wills <forthfreak@gmail.com> - 2012-10-31 15:07 -0700
Re: Is there a better way? Doug Hoffman <glidedog@gmail.com> - 2012-10-31 19:16 -0400
Re: Is there a better way? Mark Wills <forthfreak@gmail.com> - 2012-11-01 06:31 -0700
Re: Is there a better way? Doug Hoffman <glidedog@gmail.com> - 2012-11-01 10:34 -0400
Re: Is there a better way? Doug Hoffman <glidedog@gmail.com> - 2012-11-01 10:48 -0400
Re: Is there a better way? Mark Wills <forthfreak@gmail.com> - 2012-11-01 08:55 -0700
Re: Is there a better way? Mark Wills <forthfreak@gmail.com> - 2012-11-01 08:49 -0700
Re: Is there a better way? Doug Hoffman <glidedog@gmail.com> - 2012-11-01 12:46 -0400
Re: Is there a better way? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-11-01 09:37 -0500
Re: Is there a better way? Paul Rubin <no.email@nospam.invalid> - 2012-11-01 07:41 -0700
Re: Is there a better way? Mark Wills <forthfreak@gmail.com> - 2012-11-01 08:52 -0700
Re: Is there a better way? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-11-01 12:18 -0500
Re: Is there a better way? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-11-01 19:38 -0700
Re: Is there a better way? Mark Wills <forthfreak@gmail.com> - 2012-11-02 02:29 -0700
Re: Is there a better way? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-11-04 21:48 -0800
Re: Is there a better way? Mark Wills <forthfreak@gmail.com> - 2012-11-05 02:44 -0800
Re: Is there a better way? Graham NEWS <gray@forthman.plus.com> - 2012-11-01 15:52 +0000
Re: Is there a better way? Josh Grams <josh@qualdan.com> - 2012-11-03 16:38 +0000
Re: Is there a better way? Mark Wills <forthfreak@gmail.com> - 2012-10-31 14:26 -0700
Re: Is there a better way? rickman <gnuarm@gmail.com> - 2012-11-01 13:42 -0400
Re: Is there a better way? Graham <""gray\"@forthman@plus.com"> - 2012-10-31 17:05 +0000
Re: Is there a better way? Peter Fälth <peter.falth@tin.it> - 2012-10-31 12:07 -0700
Re: Is there a better way? Paul Rubin <no.email@nospam.invalid> - 2012-10-31 12:12 -0700
Re: Is there a better way? Mark Wills <forthfreak@gmail.com> - 2012-10-31 14:17 -0700
Re: Is there a better way? Mark Wills <forthfreak@gmail.com> - 2012-10-31 14:21 -0700
Re: Is there a better way? Pablo Hugo Reda <pabloreda@gmail.com> - 2012-10-31 14:50 -0700
Re: Is there a better way? Pablo Hugo Reda <pabloreda@gmail.com> - 2012-10-31 14:51 -0700
Re: Is there a better way? Paul Rubin <no.email@nospam.invalid> - 2012-10-31 14:57 -0700
Re: Is there a better way? Coos Haak <chforth@hccnet.nl> - 2012-10-31 23:47 +0100
Re: Is there a better way? mhx@iae.nl (Marcel Hendrix) - 2012-11-01 21:28 +0200
Re: Is there a better way? Mark Wills <forthfreak@gmail.com> - 2012-10-31 15:11 -0700
Re: Is there a better way? Pablo Hugo Reda <pabloreda@gmail.com> - 2012-10-31 15:44 -0700
Re: Is there a better way? rickman <gnuarm@gmail.com> - 2012-11-01 13:55 -0400
Re: Is there a better way? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-10-31 16:10 -0700
Re: Is there a better way? Charles Mélice <charles.melice@gmail.com> - 2012-11-02 01:10 -0700
Re: Is there a better way? Charles Mélice <charles.melice@gmail.com> - 2012-11-02 01:18 -0700
Re: Is there a better way? Mark Wills <forthfreak@gmail.com> - 2012-11-02 01:58 -0700
Re: Is there a better way? Charles Mélice <charles.melice@gmail.com> - 2012-11-02 02:14 -0700
Re: Is there a better way? Charles Mélice <charles.melice@gmail.com> - 2012-11-02 02:16 -0700
Re: Is there a better way? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-11-02 06:16 -0500
Re: Is there a better way? Charles Mélice <charles.melice@gmail.com> - 2012-11-02 06:04 -0700
Re: Is there a better way? rickman <gnuarm@gmail.com> - 2012-11-02 13:13 -0400
Re: Is there a better way? "WJ" <w_a_x_man@yahoo.com> - 2013-03-04 10:04 +0000
Re: Is there a better way? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-03-04 13:17 +0000
Re: Is there a better way? Zbiggy <zbigniew2011REMOVE@gmail.REMOVE.com> - 2013-03-04 18:16 +0100
Re: Is there a better way? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-03-04 19:43 +0000
Re: Is there a better way? Zbiggy <zbigniew2011REMOVE@gmail.REMOVE.com> - 2013-03-04 21:28 +0100
Re: Is there a better way? Mark Wills <markrobertwills@yahoo.co.uk> - 2013-03-04 23:16 -0800
Re: Is there a better way? "Elizabeth D. Rather" <erather@forth.com> - 2013-03-04 10:41 -1000
Page 9 of 9 — ← Prev page 1 2 3 4 5 6 7 8 [9]
| From | Hugh Aguilar <hughaguilar96@yahoo.com> |
|---|---|
| Date | 2012-10-31 16:10 -0700 |
| Message-ID | <79173da9-a961-4709-aec2-52eef1424be0@uc4g2000pbc.googlegroups.com> |
| In reply to | #16855 |
On Oct 31, 4:58 am, Mark Wills <forthfr...@gmail.com> wrote:
> The following routine is checking to see if a string is "}}" i.e.
> consists of two consequtive right curly braces.
>
> : }}? ( addr len -- addr len flag)
> dup 2= if
> over dup c@ swap 1+ c@ 125 = swap 125 = and
> else
> false
> then ;
>
> As can be seen, the first check is the length; if the length is not
> exactly 2 then we just return false. If the length is 2 then we check
> to see if both characters are ASCII 125. That's the bit I am looking
> at and saying "Meh... seems a bit convoluted/lengthy.
>
> Is there a better way?
>
> I was thinking maybe:
>
> ... c@ 125 OR swap 1+ c@ 125 OR 125 XOR 0=
>
> Which is perhaps "cleverer" but not as clear as to the intention of
> the code and no shorter...
I think that nested conditionals should be avoided as much as
possible. I just EXIT out. Here is mine:
: }}? ( adr cnt -- flag )
2 <> if drop false exit then
dup c@ [char] } <> if drop false exit then
1+ c@ [char] } <> if false exit then
true ;
Here is a more readable one with locals (the { is in my novice
package):
: }}? { adr cnt -- flag }
cnt 2 <> if false exit then
adr c@ [char] } <> if false exit then
adr 1+ c@ [char] } <> if false exit then
true ;
Here is one with a macro to get rid of some of the redundancy:
macro: bounce
if false exit then ;
: }}? { adr cnt -- flag }
cnt 2 <> bounce
adr c@ [char] } <> bounce
adr 1+ c@ [char] } <> bounce
true ;
All of this is untested as I haven't yet installed a Forth system on
my new computer. This is pretty simple though, so it should work.
I don't like nested conditionals because they are ugly and confusing.
In this case you are only testing three things, which isn't too bad.
Imagine if you were testing more though --- you would have a stair-
step Pascal-like function and it would be very confusing as to what
was going on. This is Forth not Pascal --- use EXIT. The vast majority
of the time, several things have to all be true to get a TRUE, so if
anything is false, you can immediately EXIT with a FALSE and you are
done.
Also, don't be afraid to add some extra white-space as I did to make
everything line up. There is no law that says your source-code has to
be compressed up against the left margin. I make my source-code line
up like this all the time --- see the novice package for examples.
http://www.forth.org/novice.html
Note that I did not factor out the test of the } char. That would be
bad factoring. It is unlikely that you are going to test the same char
more than once. In this case you are, but that is unusual. It is more
readable if you explicitly test each char as I did above. This way the
reader can easily see which chars are being tested for.
P.S. Look at my alien-alphabet program
https://groups.google.com/group/comp.lang.forth/browse_thread/thread/dd8e30fcc7589749
for an example of generating pattern-matching code and compiling it,
at run-time. This is a very Forthy method, I think.
P.P.S. Look at SPLIT in my novice package (list.4th) for code that
splits strings up. This is primarily for comma-delimited data, such as
from a database dump. That is somewhat similar.
[toc] | [prev] | [next] | [standalone]
| From | Charles Mélice <charles.melice@gmail.com> |
|---|---|
| Date | 2012-11-02 01:10 -0700 |
| Message-ID | <94b910d2-a889-4925-b86a-a5b205d3e79f@googlegroups.com> |
| In reply to | #16855 |
What about: : }}? ( a n -- flag ) 2 = if h@ 0x7D7D = else drop false then ;
[toc] | [prev] | [next] | [standalone]
| From | Charles Mélice <charles.melice@gmail.com> |
|---|---|
| Date | 2012-11-02 01:18 -0700 |
| Message-ID | <118302b0-f3f3-4407-a8a1-053d52515c27@googlegroups.com> |
| In reply to | #16965 |
Le vendredi 2 novembre 2012 09:10:09 UTC+1, Charles Mélice a écrit : > What about: > > > > : }}? ( a n -- flag ) > > 2 = if h@ 0x7D7D = else drop false then ; Oups - Identical to the solution of Pablo...
[toc] | [prev] | [next] | [standalone]
| From | Mark Wills <forthfreak@gmail.com> |
|---|---|
| Date | 2012-11-02 01:58 -0700 |
| Message-ID | <da6b562e-d2cb-4601-9b8a-8795919e4917@l12g2000vbj.googlegroups.com> |
| In reply to | #16965 |
On Nov 2, 8:10 am, Charles Mélice <charles.mel...@gmail.com> wrote: > What about: > > : }}? ( a n -- flag ) > 2 = if h@ 0x7D7D = else drop false then ; Nice. With the definition of h@ presumably being (for big endian): : h@ ( addr -- n ) dup c@ 8 rshift swap c@ or ;
[toc] | [prev] | [next] | [standalone]
| From | Charles Mélice <charles.melice@gmail.com> |
|---|---|
| Date | 2012-11-02 02:14 -0700 |
| Message-ID | <9af10d31-53ea-49e1-99ac-3563d422105d@googlegroups.com> |
| In reply to | #16969 |
Le vendredi 2 novembre 2012 09:58:20 UTC+1, M.R.W Wills a écrit : > On Nov 2, 8:10 am, Charles Mélice <charles.mel...@gmail.com> wrote: > > > What about: > > > > > > : }}? ( a n -- flag ) > > > 2 = if h@ 0x7D7D = else drop false then ; > > > > Nice. With the definition of h@ presumably being (for big endian): > > > > : h@ ( addr -- n ) dup c@ 8 rshift swap c@ or ; Thank. A small correction for H@ ( or W@ ) : h@ ( addr -- n ) dup c@ 8 rshift swap 1+ c@ or ;
[toc] | [prev] | [next] | [standalone]
| From | Charles Mélice <charles.melice@gmail.com> |
|---|---|
| Date | 2012-11-02 02:16 -0700 |
| Message-ID | <209f3a63-fce4-4656-bffa-fd4c011c124c@googlegroups.com> |
| In reply to | #16970 |
Le vendredi 2 novembre 2012 10:14:26 UTC+1, Charles Mélice a écrit : > Le vendredi 2 novembre 2012 09:58:20 UTC+1, M.R.W Wills a écrit : > > > On Nov 2, 8:10 am, Charles Mélice <charles.mel...@gmail.com> wrote: > > > > > > > What about: > > > > > > > > > > > > > > : }}? ( a n -- flag ) > > > > > > > 2 = if h@ 0x7D7D = else drop false then ; > > > > > > > > > > > > Nice. With the definition of h@ presumably being (for big endian): > > > > > > > > > > > > : h@ ( addr -- n ) dup c@ 8 rshift swap c@ or ; > > > > Thank. A small correction for H@ ( or W@ ) > > > > : h@ ( addr -- n ) dup c@ 8 rshift swap 1+ c@ or ; Oops -> : h@ ( addr -- n ) dup 1+ c@ 8 rshift swap c@ or ;
[toc] | [prev] | [next] | [standalone]
| From | Andrew Haley <andrew29@littlepinkcloud.invalid> |
|---|---|
| Date | 2012-11-02 06:16 -0500 |
| Message-ID | <Q9GdneHpPLoUNg7NnZ2dnUVZ8tadnZ2d@supernews.com> |
| In reply to | #16971 |
Charles M?lice <charles.melice@gmail.com> wrote: > Le vendredi 2 novembre 2012 10:14:26 UTC+1, Charles M?lice a ?crit?: >> Le vendredi 2 novembre 2012 09:58:20 UTC+1, M.R.W Wills a ?crit?: >> >> > : h@ ( addr -- n ) dup c@ 8 rshift swap c@ or ; >> >> Thank. A small correction for H@ ( or W@ ) >> >> : h@ ( addr -- n ) dup c@ 8 rshift swap 1+ c@ or ; > > Oops -> : h@ ( addr -- n ) dup 1+ c@ 8 rshift swap c@ or ; rshift? Are you sure? You're rather assuming little-endian. If you're going to be nonportable you might as well go the whole hog and write in assembler. Andrew.
[toc] | [prev] | [next] | [standalone]
| From | Charles Mélice <charles.melice@gmail.com> |
|---|---|
| Date | 2012-11-02 06:04 -0700 |
| Message-ID | <5128bd12-b7aa-460b-8a29-e9099b38c5ba@googlegroups.com> |
| In reply to | #16973 |
Le vendredi 2 novembre 2012 12:16:25 UTC+1, Andrew Haley a écrit : > Charles M?lice <@gmail.com> wrote: > > > Le vendredi 2 novembre 2012 10:14:26 UTC+1, Charles M?lice a ?crit?: > > >> Le vendredi 2 novembre 2012 09:58:20 UTC+1, M.R.W Wills a ?crit?: > > >> > > >> > : h@ ( addr -- n ) dup c@ 8 rshift swap c@ or ; > > >> > > >> Thank. A small correction for H@ ( or W@ ) > > >> > > >> : h@ ( addr -- n ) dup c@ 8 rshift swap 1+ c@ or ; > > > > > > Oops -> : h@ ( addr -- n ) dup 1+ c@ 8 rshift swap c@ or ; > > > > rshift? Are you sure? > > > > You're rather assuming little-endian. If you're going to be > > nonportable you might as well go the whole hog and write in assembler. > > > > Andrew. You are right. It is LSHIFT.
[toc] | [prev] | [next] | [standalone]
| From | rickman <gnuarm@gmail.com> |
|---|---|
| Date | 2012-11-02 13:13 -0400 |
| Message-ID | <k70uvm$oo0$1@dont-email.me> |
| In reply to | #16965 |
On 11/2/2012 4:10 AM, Charles Mélice wrote: > What about: > > : }}? ( a n -- flag ) > 2 = if h@ 0x7D7D = else drop false then ; You are using the conditional to temporarily store the flag from the 2 =. I prefer to do it like this. : }}? ( a n -- a n flag ) over h@ 0x7D7D over 2 = AND ; I duped the inputs because that is what the OP specified for the routine. But you see the point of using stack logic rather than the PC to store the result of the 2 = and perform the AND. I won't say one is more clear than the other because I think that is just what you are used to. I'm used to simple logic to generate flags. If the logic was more complex then maybe conditional execution would be a better way to express it. Rick
[toc] | [prev] | [next] | [standalone]
| From | "WJ" <w_a_x_man@yahoo.com> |
|---|---|
| Date | 2013-03-04 10:04 +0000 |
| Message-ID | <kh1rjc02oau@enews2.newsguy.com> |
| In reply to | #16855 |
Mark Wills wrote: > The following routine is checking to see if a string is "}}" i.e. > consists of two consequtive right curly braces. > > : }}? ( addr len -- addr len flag) > dup 2= if > over dup c@ swap 1+ c@ 125 = swap 125 = and > else > false > then ; > > As can be seen, the first check is the length; if the length is not > exactly 2 then we just return false. If the length is 2 then we check > to see if both characters are ASCII 125. That's the bit I am looking > at and saying "Meh... seems a bit convoluted/lengthy. > > Is there a better way? > > I was thinking maybe: > > ... c@ 125 OR swap 1+ c@ 125 OR 125 XOR 0= > > Which is perhaps "cleverer" but not as clear as to the intention of > the code and no shorter... Factor: "}}" "}}" = . t "}}" "@@" = . f
[toc] | [prev] | [next] | [standalone]
| From | albert@spenarnc.xs4all.nl (Albert van der Horst) |
|---|---|
| Date | 2013-03-04 13:17 +0000 |
| Message-ID | <51349ee5$0$609$e4fe514c@dreader34.news.xs4all.nl> |
| In reply to | #20235 |
In article <kh1rjc02oau@enews2.newsguy.com>, WJ <w_a_x_man@yahoo.com> wrote: >Mark Wills wrote: > >> The following routine is checking to see if a string is "}}" i.e. >> consists of two consequtive right curly braces. >> >> : }}? ( addr len -- addr len flag) >> dup 2= if >> over dup c@ swap 1+ c@ 125 = swap 125 = and >> else >> false >> then ; >> >> As can be seen, the first check is the length; if the length is not >> exactly 2 then we just return false. If the length is 2 then we check >> to see if both characters are ASCII 125. That's the bit I am looking >> at and saying "Meh... seems a bit convoluted/lengthy. >> >> Is there a better way? >> >> I was thinking maybe: >> >> ... c@ 125 OR swap 1+ c@ 125 OR 125 XOR 0= >> >> Which is perhaps "cleverer" but not as clear as to the intention of >> the code and no shorter... > >Factor: > >"}}" "}}" = . >t > >"}}" "@@" = . >f ciforth WANT $= : }}? "}}" $= ; Groetjes Albert -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
[toc] | [prev] | [next] | [standalone]
| From | Zbiggy <zbigniew2011REMOVE@gmail.REMOVE.com> |
|---|---|
| Date | 2013-03-04 18:16 +0100 |
| Message-ID | <slrnkj9pcp.qnm.zbigniew2011REMOVE@Tichy.myhome.org> |
| In reply to | #20244 |
In comp.lang.forth, Albert van der Horst wrote: > ciforth > WANT $= > >: }}? "}}" $= ; > > Groetjes Albert I bet Mark was looking for definition of "$=" - rather than just for the "convenient name"... -- The consensus was, as usual in this community, that there is no consensus. (RA)
[toc] | [prev] | [next] | [standalone]
| From | albert@spenarnc.xs4all.nl (Albert van der Horst) |
|---|---|
| Date | 2013-03-04 19:43 +0000 |
| Message-ID | <5134f94b$0$6329$e4fe514c@dreader35.news.xs4all.nl> |
| In reply to | #20247 |
In article <slrnkj9pcp.qnm.zbigniew2011REMOVE@Tichy.myhome.org>, Zbiggy <zbigniew2011REMOVE@gmail.REMOVE.com> wrote: >In comp.lang.forth, Albert van der Horst wrote: > >> ciforth >> WANT $= >> >>: }}? "}}" $= ; >> >> Groetjes Albert > >I bet Mark was looking for definition of "$=" - rather than just for the >"convenient name"... The primitive CORA is one of the few things I deem deserving to be a primitive coded in assembler (it is actually the I86 string compare). " CORA STACKEFFECT: addr1 addr2 len --- n DESCRIPTION: Compare the memory areas at addr1 and addr2 over a length len . For the first bytes that differ, return -1 if the byte from addr1 is less (unsigned) than the one from addr2, and 1 if it is greater. If all len bytes are equal, return zero. This is an abbreviation of COMPARE-AREA. It would have been named COMPARE , if that were not taken by ISO. GLOSSARY INDEX SEE ALSO: MEMORY " With CORA the definition of $= is left as an exercise for the reader. Bottom line, for the current problem, if your Forth has no facilities to make that easier, it is no good. Looping over characters is not a thing you want to do on a regular basis. Groetjes Albert >-- >The consensus was, as usual in this community, that there is no consensus. (RA) -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
[toc] | [prev] | [next] | [standalone]
| From | Zbiggy <zbigniew2011REMOVE@gmail.REMOVE.com> |
|---|---|
| Date | 2013-03-04 21:28 +0100 |
| Message-ID | <slrnkja4jl.5qo.zbigniew2011REMOVE@Tichy.myhome.org> |
| In reply to | #20252 |
My assumption is, Mark needs it for his 16-bit forth for TI-99/4A. What about: : }}? ( addr len -- f ) 2 = if @ 32125 = else drop false then ; -- The consensus was, as usual in this community, that there is no consensus. (RA)
[toc] | [prev] | [next] | [standalone]
| From | Mark Wills <markrobertwills@yahoo.co.uk> |
|---|---|
| Date | 2013-03-04 23:16 -0800 |
| Message-ID | <226d5657-b456-40a6-8159-9e04e44283e5@hq4g2000vbb.googlegroups.com> |
| In reply to | #20254 |
On Mar 4, 8:28 pm, Zbiggy <zbigniew2011REM...@gmail.REMOVE.com> wrote: > My assumption is, Mark needs it for his 16-bit forth for TI-99/4A. > What about: > > : }}? ( addr len -- f ) 2 = if @ 32125 = else drop false then ; > -- > The consensus was, as usual in this community, that there is no consensus. (RA) Correct. :-) It's done now. See http://turboforth.net/locals.html In the end I used a single closing } to mark the end of my locals list. Much simpler :-) I opted not to automatically populate the locals from the stack in my implementation. It means that I can define more locals than there are stack parameters (if I wish) - to hold temporary values etc. Works a treat. Thanks for all the advice guys 'n gals. I thought I'd mention the hashing, as it was mentioned much earlier in the thread. The implementation "hashes" the names of the locals (it actually uses a CRC algorithm, so hash is probably the wrong name) and stores them in a table in memory. No other data at all is required in order to implement a locals dictionary. No name strings, no word length bytes, no link fields etc. FIND is vectored. It allows the original FIND to execute, but the returned result is intercepted and checked. If the original FIND indicates that it didn't find the word, then the name being searched for is hashed and the hash table is checked. If a match is found, the ordinal position of the hashed word in the table directly represents the offset into the locals stack at run-time. Very simple, and very fast. I must say, I do like locals in Forth. It makes the code much more readable, and can be an effective tool to reduce stack thrashing.
[toc] | [prev] | [next] | [standalone]
| From | "Elizabeth D. Rather" <erather@forth.com> |
|---|---|
| Date | 2013-03-04 10:41 -1000 |
| Message-ID | <HMCdnVw6Ddx6m6jMnZ2dnUVZ_rmdnZ2d@supernews.com> |
| In reply to | #20252 |
On 3/4/13 9:43 AM, Albert van der Horst wrote: > In article <slrnkj9pcp.qnm.zbigniew2011REMOVE@Tichy.myhome.org>, > Zbiggy <zbigniew2011REMOVE@gmail.REMOVE.com> wrote: >> In comp.lang.forth, Albert van der Horst wrote: >> >>> ciforth >>> WANT $= >>> >>> : }}? "}}" $= ; >>> >>> Groetjes Albert >> >> I bet Mark was looking for definition of "$=" - rather than just for the >> "convenient name"... > > The primitive CORA is one of the few things I deem deserving to be a > primitive coded in assembler (it is actually the I86 string compare). > > " > CORA > > STACKEFFECT: addr1 addr2 len --- n > > DESCRIPTION: > > Compare the memory areas at addr1 and addr2 over a length len . For > the first bytes that differ, return -1 if the byte from addr1 is less > (unsigned) than the one from addr2, and 1 if it is greater. If all len > bytes are equal, return zero. This is an abbreviation of COMPARE-AREA. > It would have been named COMPARE , if that were not taken by ISO. > > GLOSSARY INDEX > > SEE ALSO: MEMORY Â > " > > With CORA the definition of $= is left as an exercise for the reader. FORTH, Inc. systems have had this function since the early 70's, called -TEXT (pronounced "not-text" because it returns a true value (+1 or -1) if the strings are not equal). Cheers, Elizabeth -- ================================================== Elizabeth D. Rather (US & Canada) 800-55-FORTH FORTH Inc. +1 310.999.6784 5959 West Century Blvd. Suite 700 Los Angeles, CA 90045 http://www.forth.com "Forth-based products and Services for real-time applications since 1973." ==================================================
[toc] | [prev] | [standalone]
Page 9 of 9 — ← Prev page 1 2 3 4 5 6 7 8 [9]
Back to top | Article view | comp.lang.forth
csiph-web