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


Groups > comp.lang.forth > #31084 > unrolled thread

DON'T

Started byJason Damisch <jasondamisch@yahoo.com>
First post2014-05-31 10:49 -0700
Last post2014-06-18 14:27 -0700
Articles 20 on this page of 22 — 13 participants

Back to article view | Back to comp.lang.forth


Contents

  DON'T Jason Damisch <jasondamisch@yahoo.com> - 2014-05-31 10:49 -0700
    Re: DON'T visualforth@rocketmail.com - 2014-05-31 10:56 -0700
      Re: DON'T bruce.mcfarling@gmail.com - 2014-06-16 08:00 -0700
        Re: DON'T "Alex McDonald" <blog@rivadpm.com> - 2014-06-16 16:16 +0100
          Re: DON'T Mark Wills <markwills1970@gmail.com> - 2014-06-16 10:56 -0700
            Re: DON'T "Alex McDonald" <blog@rivadpm.com> - 2014-06-17 08:05 +0100
              Re: DON'T bruce.mcfarling@gmail.com - 2014-06-17 08:10 -0700
                Re: DON'T Mark Wills <markwills1970@gmail.com> - 2014-06-18 01:54 -0700
                  Re: DON'T bruce.mcfarling@gmail.com - 2014-06-18 02:34 -0700
          Re: DON'T BruceMcF <agila61@netscape.net> - 2014-06-16 15:39 -0700
    Re: DON'T "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-05-31 17:58 -0400
      Re: DON'T Jason Damisch <jasondamisch@yahoo.com> - 2014-05-31 15:15 -0700
        Re: DON'T Mark Wills <markwills1970@gmail.com> - 2014-05-31 15:21 -0700
      Re: DON'T "Elizabeth D. Rather" <erather@forth.com> - 2014-05-31 17:35 -1000
        Re: DON'T "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-06-01 00:14 -0400
      Re: DON'T hughaguilar96@yahoo.com - 2014-06-01 19:14 -0700
    Re: DON'T Paul Rubin <no.email@nospam.invalid> - 2014-05-31 15:26 -0700
    Re: DON'T chitselb <chitselb@gmail.com> - 2014-06-02 06:02 -0700
      Re: DON'T Coos Haak <chforth@hccnet.nl> - 2014-06-03 01:13 +0200
        Re: DON'T Bernd Paysan <bernd.paysan@gmx.de> - 2014-06-03 01:23 +0200
          Re: DON'T chitselb <chitselb@gmail.com> - 2014-06-05 14:42 -0700
            Re: DON'T BruceMcF <agila61@netscape.net> - 2014-06-18 14:27 -0700

Page 1 of 2  [1] 2  Next page →


#31084 — DON'T

FromJason Damisch <jasondamisch@yahoo.com>
Date2014-05-31 10:49 -0700
SubjectDON'T
Message-ID<81a8b0d8-66e0-45db-93f3-016b98bb997f@googlegroups.com>
There is a Forth word called DO, but there is not a Forth word called DON'T.  I was playing with the idea of how could there be a Forth word called DON'T.  Then I had a funny idea.

Suppose that you had an array of behaviors for a robot or something else.  Each item in the array is a vector to a behavior.  The word DON'T would set some of these vectors to NOOP.  Then when the code which needs to step through the array to execute some of the vectors, finds a NOOP, it will execute the NOOP instead and as a result, nothing will happen then.

For what it's worth.

Jason

[toc] | [next] | [standalone]


#31086

Fromvisualforth@rocketmail.com
Date2014-05-31 10:56 -0700
Message-ID<c7c7b777-7a52-4071-ae97-4aa510e6ebf2@googlegroups.com>
In reply to#31084
On Saturday, May 31, 2014 1:49:25 PM UTC-4, Jason Damisch wrote:
> There is a Forth word called DO, but there is not a Forth word called DON'T.  I was playing with the idea of how could there be a Forth word called DON'T.  Then I had a funny idea.
> 
> 
> 
> Suppose that you had an array of behaviors for a robot or something else.  Each item in the array is a vector to a behavior.  The word DON'T would set some of these vectors to NOOP.  Then when the code which needs to step through the array to execute some of the vectors, finds a NOOP, it will execute the NOOP instead and as a result, nothing will happen then.
> 
> 
> 
> For what it's worth.
> 
> 
> 
> Jason

Sounds like a great idea - temporary disabling words.
It's important that the stack picture has to be taken care of.

[toc] | [prev] | [next] | [standalone]


#31594

Frombruce.mcfarling@gmail.com
Date2014-06-16 08:00 -0700
Message-ID<96804ae8-1f1c-4a84-bc31-b96242ffe5ee@googlegroups.com>
In reply to#31086
On Saturday, May 31, 2014 1:56:26 PM UTC-4, visua...@rocketmail.com wrote:
> On Saturday, May 31, 2014 1:49:25 PM UTC-4, Jason Damisch wrote:

>> Suppose that you had an array of behaviors for a robot or something else.  Each item in the array is a vector to a behavior.  The word DON'T would set some of these vectors to NOOP.  Then when the code which needs to step through the array to execute some of the vectors, finds a NOOP, it will execute the NOOP instead and as a result, nothing will happen then.

> Sounds like a great idea - temporary disabling words.

> It's important that the stack picture has to be taken care of.

Aha, so there's the stack picture for don't:

\ DON'T ( x*u1 u1 u2 a -- )
\ a is the address of an EXECUTE vector
\ u2 is the number of items to remove from the stack
\ ( x*u1 u1 ) is the data to return on the stack

\ JUST ( a -- 0 0 a )

With, eg, {name} as a pattern for vector locations in a current vector table ...

0 0 2 0 {Start-Message} DON'T

{PlayTune} JUST DON'T

[toc] | [prev] | [next] | [standalone]


#31595

From"Alex McDonald" <blog@rivadpm.com>
Date2014-06-16 16:16 +0100
Message-ID<lnn1p0$t9k$1@dont-email.me>
In reply to#31594
on 16/06/2014 16:00:28,  wrote:
> On Saturday, May 31, 2014 1:56:26 PM UTC-4, visua...@rocketmail.com
> > wrote:
>> On Saturday, May 31, 2014 1:49:25 PM UTC-4, Jason Damisch wrote:
> wrote:
> 
>>> Suppose that you had an array of behaviors for a robot or something else
> . Each item in the array is a vector to a behavior. The word DON'T
> would set some of these vectors to NOOP. Then when the code which
> needs to step through the array to execute some of the vectors, finds
> a NOOP, it will exe cute the NOOP instead and as a result, nothing
> will happen then.
> 
>> Sounds like a great idea - temporary disabling words.
> 
>> It's important that the stack picture has to be taken care of.
> 
> Aha, so there's the stack picture for don't:
> 
> \ DON'T ( x*u1 u1 u2 a -- )
> \ a is the address of an EXECUTE vector
> \ u2 is the number of items to remove from the stack
> \ ( x*u1 u1 ) is the data to return on the stack
> 
> \ JUST ( a -- 0 0 a )
> 
> With, eg, {name} as a pattern for vector locations in a current vector
> tabl e ...
> 
> 0 0 2 0 {Start-Message} DON'T
> 
> {PlayTune} JUST DON'T
> 

Scottish Firth has the following additional words over traditional Forth;

AN AWFY DAE DIN GONNAE NO THAT and WHIT

The above would be 

{PlayTune} WHIT AN AWFY DIN
0 0 2 0 {Start-Message} GONNAE NO DAE THAT

I'm unsure as to the stack effects of these words as SEE <word> always
responds with YOU JIMMY regardless of the word selected.

[toc] | [prev] | [next] | [standalone]


#31597

FromMark Wills <markwills1970@gmail.com>
Date2014-06-16 10:56 -0700
Message-ID<f3e47cf0-2c16-4cb3-b9c1-4006084953c4@googlegroups.com>
In reply to#31595
You forget the Doric word "Ken" which has no stack effects at all. It's essentially a NOOP as long as you put it at the end of a sentence ;-)

[toc] | [prev] | [next] | [standalone]


#31605

From"Alex McDonald" <blog@rivadpm.com>
Date2014-06-17 08:05 +0100
Message-ID<lnopcg$b27$1@dont-email.me>
In reply to#31597
on 16/06/2014 18:56:35, Mark Wills wrote:
> You forget the Doric word "Ken" which has no stack effects at all.
> It's essentially a NOOP as long as you put it at the end of a sentence
> ;-)
> 

I'm not so sure. What about AH DINNAE KEN ?

[toc] | [prev] | [next] | [standalone]


#31610

Frombruce.mcfarling@gmail.com
Date2014-06-17 08:10 -0700
Message-ID<e23b993e-8a37-465f-8b37-44939658233f@googlegroups.com>
In reply to#31605
On Tuesday, June 17, 2014 3:05:53 AM UTC-4, Alex McDonald wrote:
> on 16/06/2014 18:56:35, Mark Wills wrote:
> 
> > You forget the Doric word "Ken" which has no stack effects at all.
> 
> > It's essentially a NOOP as long as you put it at the end of a sentence
> 
> > ;-)
> 
> I'm not so sure. What about AH DINNAE KEN ?

But in implementations where ``AH DINNAE'' in any event sets up the status return with KEN as the default, KEN still *functions* as a NOOP, only inserted for clarity.

[toc] | [prev] | [next] | [standalone]


#31631

FromMark Wills <markwills1970@gmail.com>
Date2014-06-18 01:54 -0700
Message-ID<c1486397-470c-41ad-8968-8bc1584ec3ba@googlegroups.com>
In reply to#31610
On Tuesday, 17 June 2014 16:10:01 UTC+1, bruce.m...@gmail.com  wrote:
> On Tuesday, June 17, 2014 3:05:53 AM UTC-4, Alex McDonald wrote:
> 
> > on 16/06/2014 18:56:35, Mark Wills wrote:
> 
> > 
> 
> > > You forget the Doric word "Ken" which has no stack effects at all.
> 
> > 
> 
> > > It's essentially a NOOP as long as you put it at the end of a sentence
> 
> > 
> 
> > > ;-)
> 
> > 
> 
> > I'm not so sure. What about AH DINNAE KEN ?
> 
> 
> 
> But in implementations where ``AH DINNAE'' in any event sets up the status return with KEN as the default, KEN still *functions* as a NOOP, only inserted for clarity.

Of course, in such an instance a second application of KEN can greatly enhance readability. As in:

AH DINNAE KEN KEN

Ken?

[toc] | [prev] | [next] | [standalone]


#31634

Frombruce.mcfarling@gmail.com
Date2014-06-18 02:34 -0700
Message-ID<974dca9e-e78c-44ea-9701-7f5385f04c64@googlegroups.com>
In reply to#31631
On Wednesday, June 18, 2014 4:54:23 AM UTC-4, Mark Wills wrote:
> Of course, in such an instance a second application of KEN can greatly enhance readability. As in:
 
> AH DINNAE KEN KEN

Though of course that is only assured to work in the context-insensitive implementation, but when I tried to make a context sensitive implementation, the only output I got was, 

SENSITIVE? OH, AYE.

And then input/output hung, so I gave it up as beyond my capacities.

[toc] | [prev] | [next] | [standalone]


#31603

FromBruceMcF <agila61@netscape.net>
Date2014-06-16 15:39 -0700
Message-ID<3be41b2b-f8e3-457d-8284-88c00c2e0714@googlegroups.com>
In reply to#31595
On Monday, June 16, 2014 11:16:49 AM UTC-4, Alex McDonald wrote:
> on 16/06/2014 16:00:28,  wrote:
> Scottish Firth has the following additional words over traditional Forth; 
>   AN AWFY DAE DIN GONNAE NO THAT and WHIT

> The above would be 
> {PlayTune} WHIT AN AWFY DIN
 
> 0 0 2 0 {Start-Message} GONNAE NO DAE THAT

Ah yes ~ interestingly enough, a similar language design philosophy in some respects to the New Jersey based fork of Visual Basic, Watcha Lookinatt Basic.

[toc] | [prev] | [next] | [standalone]


#31096

From"Rod Pemberton" <dont_use_email@xnothavet.cqm>
Date2014-05-31 17:58 -0400
Message-ID<op.xgqvbbpq6zenlw@localhost>
In reply to#31084
On Sat, 31 May 2014 13:49:25 -0400, Jason Damisch <jasondamisch@yahoo.com>  
wrote:

> There is a Forth word called DO, but there is not a Forth word called  
> DON'T.  I was playing with the idea of how could there be a Forth word  
> called DON'T.  Then I had a funny idea.
>
> Suppose that you had an array of behaviors for a robot or something  
> else.  Each item in the array is a vector to a behavior.  The word DON'T  
> would set some of these vectors to NOOP.  Then when the code which needs  
> to step through the array to execute some of the vectors, finds a NOOP,  
> it will execute the NOOP instead and as a result, nothing will happen  
> then.
>
> For what it's worth.
>

But, your DON'T is _not_ related in any way to Forth's DO ...

Or, what's wrong with a DON'T ... LOOP ?

I think hear some laughter, but I'm not joking ...

Perhaps, DON'T could define a range to skip in a LOOP.
E.g., modified "Starting Forth" example for DO ... LOOP:

10 0 3 7 DON'T  I .  LOOP

0 1 2 7 8 9

It might be implementable with a conditional +LOOP when I is 3 ... ?

I have no serious thoughts on the order of 3 7 is 3 7 or 7 3 or
whether 3 or 7 are inclusive or exclusive.  Your choice.

Also, not to be finicky, but would you really put an apostrophe
in the name of a FORTH word?  Yes, we have ' (tick) ['] but otherwise ...


Rod Pemberton

[toc] | [prev] | [next] | [standalone]


#31098

FromJason Damisch <jasondamisch@yahoo.com>
Date2014-05-31 15:15 -0700
Message-ID<be053ebf-b893-4085-8b62-059f94ad1c04@googlegroups.com>
In reply to#31096
On Saturday, May 31, 2014 2:58:13 PM UTC-7, Rod Pemberton wrote:

> But, your DON'T is _not_ related in any way to Forth's DO ...

Let me think about this for a minute.

DO     DON'T
DOES>  DOESN'T
IS     ISN'T

WILL   WON'T

WILL is not a word in Forth, so maybe I can use WON'T for the execution array thing, and we can use DON'T for the special case DO

Jason

[toc] | [prev] | [next] | [standalone]


#31099

FromMark Wills <markwills1970@gmail.com>
Date2014-05-31 15:21 -0700
Message-ID<2965782c-6259-4959-a8d9-74936f96eea1@googlegroups.com>
In reply to#31098
I like where this is going! We're so used to defining our programs in terms of what they must do, that specifying what they mustn't do is a bit of a brain warp!

Me like it!

[toc] | [prev] | [next] | [standalone]


#31106

From"Elizabeth D. Rather" <erather@forth.com>
Date2014-05-31 17:35 -1000
Message-ID<G7ednaiNMaEPAhfOnZ2dnUVZ_qGdnZ2d@supernews.com>
In reply to#31096
On 5/31/14 11:58 AM, Rod Pemberton wrote:
> Also, not to be finicky, but would you really put an apostrophe
> in the name of a FORTH word?  Yes, we have ' (tick) ['] but otherwise ...

Why on earth not? Special characters may be used where they have 
suggested meanings (' = XT, . = display, , = compile, etc.) but they 
also are part of common English. If you were coding DON'T it would look 
pretty funny without its apostrophe! With it, it's more suggestive.

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] | [next] | [standalone]


#31108

From"Rod Pemberton" <dont_use_email@xnothavet.cqm>
Date2014-06-01 00:14 -0400
Message-ID<op.xgrcqib66zenlw@localhost>
In reply to#31106
On Sat, 31 May 2014 23:35:45 -0400, Elizabeth D. Rather  
<erather@forth.com> wrote:
> On 5/31/14 11:58 AM, Rod Pemberton wrote:

>> Also, not to be finicky, but would you really put an apostrophe
>> in the name of a FORTH word?  Yes, we have ' (tick) ['] but otherwise  
>> ...
>
> Why on earth not? Special characters may be used where they have
> suggested meanings (' = XT, . = display, , = compile, etc.) but they
> also are part of common English. If you were coding DON'T it would look
> pretty funny without its apostrophe! With it, it's more suggestive.
>

:-)  OK.

(To answer the question, just trivial typeability, readability.)

Of course, I wouldn't recommend defining words with lots of ticks...

  ' '' ''' '''' ''''' '''''' '''''''

Technically, that could be a program in Forth...  ;-)

So could smileys:

: :-) ." Smile!" ;


RP

[toc] | [prev] | [next] | [standalone]


#31144

Fromhughaguilar96@yahoo.com
Date2014-06-01 19:14 -0700
Message-ID<ae36a8fd-e346-4dfd-9b8c-8cb30b759065@googlegroups.com>
In reply to#31096
On Saturday, May 31, 2014 2:58:13 PM UTC-7, Rod Pemberton wrote:

> But, your DON'T is _not_ related in any way to Forth's DO ...
> 
> Or, what's wrong with a DON'T ... LOOP ?
> 
> I think hear some laughter, but I'm not joking ...
> 
> Perhaps, DON'T could define a range to skip in a LOOP.
> 
> E.g., modified "Starting Forth" example for DO ... LOOP:
> 
> 10 0 3 7 DON'T  I .  LOOP
> 
> 0 1 2 7 8 9
> 
> It might be implementable with a conditional +LOOP when I is 3 ... ?
> 
> I have no serious thoughts on the order of 3 7 is 3 7 or 7 3 or
> whether 3 or 7 are inclusive or exclusive.  Your choice.

In my novice package I have ordered associations. I have the words WITHIN and WITHOUT that copy an association into another association. WITHIN only copies the nodes that are within a given range, and WITHOUT only copies the nodes that are not within the given range. The nodes are copied into another association --- if it is empty, then it gets filled with everything that got copied, but if it already has nodes in it then the nodes copied get merged into it. 

Note that copying nodes relies heavily on my implementation of ALLOCATE etc., that provides ALLOCATION. To copy a node, it is necessary to know how big the node is. The association may contain nodes of various different data types (all in the same parent-child chain), and hence of various different sizes. My code uses ALLOCATION internally to determine how much data to copy --- if the nodes contain pointers to other structs however, then the pointers just get copied over as data --- my code is not smart enough to recognize pointers and recursively copy the sub-structs.

[toc] | [prev] | [next] | [standalone]


#31100

FromPaul Rubin <no.email@nospam.invalid>
Date2014-05-31 15:26 -0700
Message-ID<7xa99xtwjr.fsf@ruckus.brouhaha.com>
In reply to#31084
Jason Damisch <jasondamisch@yahoo.com> writes:
> There is a Forth word called DO, but there is not a Forth word called
> DON'T.  I was playing with the idea of how could there be a Forth word
> called DON'T.  Then I had a funny idea.

A Forth impelementation of DON'T would indeed be nice:

http://hackage.haskell.org/package/acme-dont

[toc] | [prev] | [next] | [standalone]


#31150

Fromchitselb <chitselb@gmail.com>
Date2014-06-02 06:02 -0700
Message-ID<82dd9214-0471-4303-9796-36a6d63c6051@googlegroups.com>
In reply to#31084
On Saturday, May 31, 2014 1:49:25 PM UTC-4, Jason Damisch wrote:
> There is a Forth word called DO, but there is not a Forth word called DON'T.  I was playing with the idea of how could there be a Forth word called DON'T.  Then I had a funny idea.
> 
> 
> 
> Suppose that you had an array of behaviors for a robot or something else.  Each item in the array is a vector to a behavior.  The word DON'T would set some of these vectors to NOOP.  Then when the code which needs to step through the array to execute some of the vectors, finds a NOOP, it will execute the NOOP instead and as a result, nothing will happen then.
> 
> 
> 
> For what it's worth.
> 
> 
> 
> Jason

What does UNDER do? 

[toc] | [prev] | [next] | [standalone]


#31155

FromCoos Haak <chforth@hccnet.nl>
Date2014-06-03 01:13 +0200
Message-ID<tut7kbola06z$.1sgt6vqul6d9t$.dlg@40tude.net>
In reply to#31150
Op Mon, 2 Jun 2014 06:02:16 -0700 (PDT) schreef chitselb:

> On Saturday, May 31, 2014 1:49:25 PM UTC-4, Jason Damisch wrote:
>> There is a Forth word called DO, but there is not a Forth word called DON'T.  I was playing with the idea of how could there be a Forth word called DON'T.  Then I had a funny idea.
>> 
>> 
>> 
>> Suppose that you had an array of behaviors for a robot or something else.  Each item in the array is a vector to a behavior.  The word DON'T would set some of these vectors to NOOP.  Then when the code which needs to step through the array to execute some of the vectors, finds a NOOP, it will execute the NOOP instead and as a result, nothing will happen then.
>> 
>> 
>> 
>> For what it's worth.
>> 
>> 
>> 
>> Jason
> 
> What does UNDER do?

Whatever you want. Twenty years ago I saw : UNDER SWAP DROP ;
but anything like : UNDER OVER SWAP TUCK NIP ROT ; is likely possible ;-(
I looked and neither Gforth, Win32Forth or SwiftForth have it.

-- 
Coos

CHForth, 16 bit DOS applications
http://home.hccnet.nl/j.j.haak/forth.html 

[toc] | [prev] | [next] | [standalone]


#31156

FromBernd Paysan <bernd.paysan@gmx.de>
Date2014-06-03 01:23 +0200
Message-ID<lmj123$tm7$1@online.de>
In reply to#31155
Coos Haak wrote:
> Whatever you want. Twenty years ago I saw : UNDER SWAP DROP ;
> but anything like : UNDER OVER SWAP TUCK NIP ROT ; is likely possible ;-(
> I looked and neither Gforth, Win32Forth or SwiftForth have it.

VolksForth had UNDER as what is now TUCK ( n1 n2 -- n2 n1 n2 ) (bigForth 
inherited it, Gforth didn't).  Another possibile definition could have been

: UNDER ( n1 n2 -- n1 n1 n2 )  >R DUP R> ;

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

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | comp.lang.forth


csiph-web