Help with tutorial please 
Author Message
 Help with tutorial please

Hi everybody,

I'm wondering if anybody can help me with my first word definition in
Forth.  I'm doing the tutorial that comes with pforth.exe, and I'm using
Win2000.  Now the coded word definition I saved as a file is as follows:

\ Sample Forth Code
\ Author: Roy

: SQUARE ( n -- n*n , square number )
    DUP *
;

: TEST.SQUARE ( -- )
    CR ." 7 squared = "
    7 SQUARE . CR
;

Next I saved it as 'sample', and went to the pforth window and typed

INCLUDE C:\SAMPLE.TXT

and got the following:

Include C:\SAMPLE.TXT
    include added 56 bytes,264508 left.

Next I did as the tutorial said and typed

TEST.SQUARE

and got the following:

TEST.SQUARE  ? - unrecognized word!

But then when I typed '7 SQUARE' it got it right and typed '49'.  Then I
typed FORGET SQUARE as the tutorial said, but it would not forget
SQUARE.  However, the pforth.exe program shut down while I was trying to
copy parts of it for inclusion in this post, and when I re-did the
sequence above, it did forget SQUARE, but also did not do TEST.SQUARE.  
Also I've experienced a few sudden crashes of the computer while doing
parts of the tutorial.  I suppose it is all due to me using Win2000
instead of earlier versions, but I don't know.  Any help and references
to where I go from here would be much appreciated.

Roy
--
http://www.*-*-*.com/



Tue, 16 Mar 2004 05:07:59 GMT  
 Help with tutorial please

Quote:

> Hi everybody,

> I'm wondering if anybody can help me with my first word definition in
> Forth.  I'm doing the tutorial that comes with pforth.exe, and I'm using
> Win2000.  Now the coded word definition I saved as a file is as follows:

> \ Sample Forth Code
> \ Author: Roy

> : SQUARE ( n -- n*n , square number )
>     DUP *
> ;

> : TEST.SQUARE ( -- )
>     CR ." 7 squared = "
>     7 SQUARE . CR
> ;

> Next I saved it as 'sample', and went to the pforth window and typed

> INCLUDE C:\SAMPLE.TXT

> and got the following:

> Include C:\SAMPLE.TXT
>     include added 56 bytes,264508 left.

> Next I did as the tutorial said and typed

> TEST.SQUARE

> and got the following:

> TEST.SQUARE  ? - unrecognized word!

> But then when I typed '7 SQUARE' it got it right and typed '49'.  Then I
> typed FORGET SQUARE as the tutorial said, but it would not forget
> SQUARE.  However, the pforth.exe program shut down while I was trying to
> copy parts of it for inclusion in this post, and when I re-did the
> sequence above, it did forget SQUARE, but also did not do TEST.SQUARE.
> Also I've experienced a few sudden crashes of the computer while doing
> parts of the tutorial.  I suppose it is all due to me using Win2000
> instead of earlier versions, but I don't know.  Any help and references
> to where I go from here would be much appreciated.

> Roy
> --
> http://www.*-*-*.com/

May I suggest that if you are using Forth under Windows you
download Win32Forth, from one of the repositories or from
my web page

    http://www.*-*-*.com/ .{*filter*}ia.edu/classes/551.jvn.fall01/programs.htm

and try that. I do not know pForth and cannot say whether it has
an incompatibility with Win2K. I have used it under Win95, Win98,
WinNT and WinME with no problems. And your little program worked
fine both interactively and as a file.

It also works fine with GForth 5.0.

--
Julian V. Noble
Professor of Physics

Galileo's Commandment:

   "Science knows only one commandment: contribute to science."
   -- Bertolt Brecht, "Galileo".



Tue, 16 Mar 2004 06:25:24 GMT  
 Help with tutorial please
Quote:


> > Hi everybody,

> > I'm wondering if anybody can help me with my first word definition in
> > Forth.  I'm doing the tutorial that comes with pforth.exe, and I'm using
> > Win2000.  Now the coded word definition I saved as a file is as follows:

> > \ Sample Forth Code
> > \ Author: Roy

> > : SQUARE ( n -- n*n , square number )
> >     DUP *
> > ;

> > : TEST.SQUARE ( -- )
> >     CR ." 7 squared = "
> >     7 SQUARE . CR
> > ;

> > Next I saved it as 'sample', and went to the pforth window and typed

> > INCLUDE C:\SAMPLE.TXT

> > and got the following:

> > Include C:\SAMPLE.TXT
> >     include added 56 bytes,264508 left.

> > Next I did as the tutorial said and typed

> > TEST.SQUARE

> > and got the following:

> > TEST.SQUARE  ? - unrecognized word!

> > But then when I typed '7 SQUARE' it got it right and typed '49'.  Then I
> > typed FORGET SQUARE as the tutorial said, but it would not forget
> > SQUARE.  However, the pforth.exe program shut down while I was trying to
> > copy parts of it for inclusion in this post, and when I re-did the
> > sequence above, it did forget SQUARE, but also did not do TEST.SQUARE.
> > Also I've experienced a few sudden crashes of the computer while doing
> > parts of the tutorial.  I suppose it is all due to me using Win2000
> > instead of earlier versions, but I don't know.  Any help and references
> > to where I go from here would be much appreciated.

> > Roy
> > --
> > http://www.*-*-*.com/

> May I suggest that if you are using Forth under Windows you
> download Win32Forth, from one of the repositories or from
> my web page

>     http://www.*-*-*.com/ .{*filter*}ia.edu/classes/551.jvn.fall01/programs.htm

> and try that. I do not know pForth and cannot say whether it has
> an incompatibility with Win2K. I have used it under Win95, Win98,

                                             ^^
        I meant to say "I have used Win32Forth under ..."

Quote:
> WinNT and WinME with no problems. And your little program worked
> fine both interactively and as a file.

> It also works fine with GForth 5.0.

> --
> Julian V. Noble
> Professor of Physics

> Galileo's Commandment:

>    "Science knows only one commandment: contribute to science."
>    -- Bertolt Brecht, "Galileo".

--
Julian V. Noble
Professor of Physics

Galileo's Commandment:

   "Science knows only one commandment: contribute to science."
   -- Bertolt Brecht, "Galileo".



Tue, 16 Mar 2004 06:36:05 GMT  
 Help with tutorial please

Quote:

> > May I suggest that if you are using Forth under Windows you
> > download Win32Forth, from one of the repositories or from
> > my web page

> >     http://www.*-*-*.com/ .{*filter*}ia.edu/classes/551.jvn.fall01/programs.htm

> > and try that. I do not know pForth and cannot say whether it has
> > an incompatibility with Win2K. I have used it under Win95, Win98,
>                                         ^^
>    I meant to say "I have used Win32Forth under ..."

> > WinNT and WinME with no problems. And your little program worked
> > fine both interactively and as a file.

> > It also works fine with GForth 5.0.

> > --
> > Julian V. Noble
> > Professor of Physics


   Thanks.  I tried my little program on it and it worked!  
   In the Introduction, Mr. Zimmer mentions that his philosophy has been
that (quote) "This file contains the bear minimum of information to get
you started with Win32Forth.  Forth is not inherently a complex
language, but when it is integrated into a Windows environment, much
complexity creeps in."
   I don't know what he means by an integrated Windows environment, but
apparently Win32For can make executable files that run in Windows.  Are
these the same as stand-alone applications?  Maybe in trying to make
Forth fully compatible with Windows 'C' he has sacrificed some of the
inherent flexibility of Forth.  In other words, if all we really cared
for was the ability of Forth to function in the given OS, there would be
no need to have it go into the complexities of object-oriented-
languages.  In any case, such extreme efforts at compatibility between
programs is probably only useful in very complex applications for which
the choice of a common language becomes even more imperative.  

--
http://www.*-*-*.com/



Tue, 16 Mar 2004 08:58:08 GMT  
 Help with tutorial please
Note: This does not address the original question.

Wouldn't it be quicker/easier/nicer to just type in
the code as follows:

: SQUARE ( n -- n*n , square number )
    DUP *
;

: TEST.SQUARE ( -- )
    CR ." 7 squared = "
    7 SQUARE . CR
;

Then simply hilite the code in the text editor with the mouse and
press <enter> which would compile the two definitions.

Then a quick copy/paste on TEST.SQUARE and press <enter> again.  Voila.
This is all done in the text editor window.
A much quicker edit/compile/test iteration.  Not necessary to muck
about with saving as a file and typing in load file incantations
when one simply wants to test small snipetts of code.

(on some machines <enter> may need a modifier key such as <alt>)

-Doug


Quote:

>Hi everybody,

>: SQUARE ( n -- n*n , square number )
>    DUP *
>;

>: TEST.SQUARE ( -- )
>    CR ." 7 squared = "
>    7 SQUARE . CR
>;

>Next I saved it as 'sample', and went to the pforth window and typed

>INCLUDE C:\SAMPLE.TXT

>and got the following:

>Include C:\SAMPLE.TXT
>    include added 56 bytes,264508 left.

>Next I did as the tutorial said and typed

>TEST.SQUARE



Tue, 16 Mar 2004 09:03:55 GMT  
 Help with tutorial please

Quote:
>In other words, if all we really cared
>for was the ability of Forth to function in the given OS, there would be
>no need to have it go into the complexities of object-oriented-
>languages.

Some would argue that Object Oriented Programming results in
simplification.  As I recall, Tom Z. supplies several
programming examples that are done both ways, that is via OOP
and without.  Such as the "Hello World" example.  Take a look and
draw your own conclusion.

-Doug



Tue, 16 Mar 2004 09:18:06 GMT  
 Help with tutorial please

info.com says...

Quote:
> Note: This does not address the original question.

> Wouldn't it be quicker/easier/nicer to just type in
> the code as follows:

> : SQUARE ( n -- n*n , square number )
>     DUP *
> ;

> : TEST.SQUARE ( -- )
>     CR ." 7 squared = "
>     7 SQUARE . CR
> ;

> Then simply hilite the code in the text editor with the mouse and
> press <enter> which would compile the two definitions.

That's as far as I got Doug.  My code disappeared.  Where do I copy or
paste TEST.SQUARE then?

Quote:

> Then a quick copy/paste on TEST.SQUARE and press <enter> again.  Voila.
> This is all done in the text editor window.
> A much quicker edit/compile/test iteration.  Not necessary to muck
> about with saving as a file and typing in load file incantations
> when one simply wants to test small snipetts of code.

> (on some machines <enter> may need a modifier key such as <alt>)

> -Doug

--
http://listen.to/Baha


Tue, 16 Mar 2004 09:35:01 GMT  
 Help with tutorial please

Quote:

> > > May I suggest that if you are using Forth under Windows you
> > > download Win32Forth...

>    Thanks.  I tried my little program on it and it worked!
>    In the Introduction, Mr. Zimmer mentions that his philosophy has been
> that (quote) "This file contains the bear minimum of information to get
> you started with Win32Forth.  Forth is not inherently a complex
> language, but when it is integrated into a Windows environment, much
> complexity creeps in."
>    I don't know what he means by an integrated Windows environment, but
> apparently Win32For can make executable files that run in Windows.  Are
> these the same as stand-alone applications?  Maybe in trying to make
> Forth fully compatible with Windows 'C' he has sacrificed some of the
> inherent flexibility of Forth.  In other words, if all we really cared
> for was the ability of Forth to function in the given OS, there would be
> no need to have it go into the complexities of object-oriented-
> languages.  In any case, such extreme efforts at compatibility between
> programs is probably only useful in very complex applications for which
> the choice of a common language becomes even more imperative.

It depends on what the programmer's objectives are.  I am not familiar
with Win32Forth, but our Windows product SwiftForth also features
added complexity required for dealing with Windows.

To write simple definitions such as you're doing for learning purposes,
or for writing library functions that you hope will be portable, you don't
have to deal with these complexities (although the implementor had to
be waist-deep in them in order to present an easy-to-use programming
environment).  However, many users of Win32Forth and SwiftForth
(as well as MPE's ProForth VFX for Windows, another commercial
product) have the objective of writing a Windows application, with a
Windows-
like user interface.  To do this, you have to interact with Windows
(or re-invent it!), which is why Windows Forths go the extra mile to
make it possible for you to access Windows features from Forth.

Contrary to the public myth, it isn't necessary to use C/C++ to write
Windows applications.  Forth's interactive programming style makes
it quite attractive for Windows programming, providing the
implementation allows full access to Windows features, DLLs, etc.
which the good ones all do.

Frankly, I do not feel any of the "inherent flexibility" of Forth is
necessarily sacrificed in order to have a powerful, easy-to-use
Windows version.

Cheers,
Elizabeth-

--
================================================
Elizabeth D. Rather   (US & Canada)       800-55-FORTH
FORTH Inc.                                      +1 310-491-3356
5155 W. Rosecrans Ave. #1018  Fax: +1 310-978-9454
Hawthorne, CA 90250
http://www.forth.com

"Forth-based products and Services for real-time
applications since 1973."
================================================



Tue, 16 Mar 2004 09:36:02 GMT  
 Help with tutorial please

Quote:

>That's as far as I got Doug.  My code disappeared.  Where do I copy or
>paste TEST.SQUARE then?

My apologies.  I wasn't very clear.  Your problem was already
addressed with the suggestion to try Win32Forth.

I am speaking in general terms of the edit/compile/test
sequence, not about your specific problem (your problem
seems to have been solved by switching Forths).

-Doug



Tue, 16 Mar 2004 09:40:00 GMT  
 Help with tutorial please
[..]

Quote:
> Wouldn't it be quicker/easier/nicer to just type in
> the code as follows:
> : SQUARE ( n -- n*n , square number )
>     DUP *
> ;
> : TEST.SQUARE ( -- )
>     CR ." 7 squared = "
>     7 SQUARE . CR
> ;
> Then simply hilite the code in the text editor with the mouse and
> press <enter> which would compile the two definitions.
> Then a quick copy/paste on TEST.SQUARE and press <enter> again.  Voila.

Well, this is exactly how it works in _any_ Forth that runs
under windows? Copy text anywhere on the screen and paste it in the
Forth window. This works even for DOS windows/Forths.

Quote:
> This is all done in the text editor window.

Extra step: you would need to move the mouse to the Forth window.

-marcel



Tue, 16 Mar 2004 15:57:22 GMT  
 Help with tutorial please

Quote:

>> In other words, if all we really cared
>> for was the ability of Forth to function in the given OS, there would be
>> no need to have it go into the complexities of object-oriented-
>> languages.

> Some would argue that Object Oriented Programming results in
> simplification.  As I recall, Tom Z. supplies several
> programming examples that are done both ways, that is via OOP
> and without.  Such as the "Hello World" example.  Take a look and
> draw your own conclusion.

You will have to elaborate on that point. If you check out what
is done in hello.f, the conclusion is that OOP is some giant steps
backward, compared to just typing in the two lines of this program
( square and test-square ) that do real work.

FOOP itself doesn't bring *anything* in a text-based environment.

-marcel



Tue, 16 Mar 2004 16:06:44 GMT  
 Help with tutorial please


Quote:
> Note: This does not address the original question.

> Wouldn't it be quicker/easier/nicer to just type in
> the code as follows:

> : SQUARE ( n -- n*n , square number )
>     DUP *
> ;

> : TEST.SQUARE ( -- )
>     CR ." 7 squared = "
>     7 SQUARE . CR
> ;

> Then simply hilite the code in the text editor with the mouse and
> press <enter> which would compile the two definitions.

> Then a quick copy/paste on TEST.SQUARE and press <enter> again.  Voila.
> This is all done in the text editor window.
> A much quicker edit/compile/test iteration.  Not necessary to muck
> about with saving as a file and typing in load file incantations
> when one simply wants to test small snipetts of code.

> (on some machines <enter> may need a modifier key such as <alt>)

> -Doug



> >Hi everybody,

> >: SQUARE ( n -- n*n , square number )
> >    DUP *
> >;

> >: TEST.SQUARE ( -- )
> >    CR ." 7 squared = "
> >    7 SQUARE . CR
> >;

> >Next I saved it as 'sample', and went to the pforth window and typed

> >INCLUDE C:\SAMPLE.TXT

> >and got the following:

> >Include C:\SAMPLE.TXT
> >    include added 56 bytes,264508 left.

> >Next I did as the tutorial said and typed

> >TEST.SQUARE

    For that matter, why bother with an editor?  I just did the same thing
using cut and paste between the browser window and the Quest32 command line:

Quote:
>: SQUARE ( n -- n*n , square number )
>    DUP *
>;

>: TEST.SQUARE ( -- )
>    CR ." 7 squared = "
>    7 SQUARE . CR
>;

>TEST.SQUARE

7 squared = 49

--

-GJC

-Abolish Public Schools.



Tue, 16 Mar 2004 20:12:14 GMT  
 Help with tutorial please

Quote:


>info.com says...
>> Note: This does not address the original question.

>> Wouldn't it be quicker/easier/nicer to just type in
>> the code as follows:

>> : SQUARE ( n -- n*n , square number )
>>     DUP *
>> ;

>> : TEST.SQUARE ( -- )
>>     CR ." 7 squared = "
>>     7 SQUARE . CR
>> ;

>> Then simply hilite the code in the text editor with the mouse and
>> press <enter> which would compile the two definitions.

>That's as far as I got Doug.  My code disappeared.  Where do I copy or
>paste TEST.SQUARE then?

                  <snip>

I used Win32for on your little program three different ways and all worked.

What may be confusing is that at the start, you are in the Win32for  command
window. If you press F1 you open the WinView editor with the Hello Doc.
displayed in a separate window.  At the bottom of your screen you should see
two buttons --Win32for and WinView showing that two programs are running.

To start, press Win32for to get the command screen on top.

#1   Write --
         : square   dup * ;
         : tstsq   7 square  .  ;
Then
         tstsq      _ 49  ok_

You should get an  ok  after each colon definition since you are compiling
from the command line.

#2   Press WinView to get to the editor..  Press the 'New File' Button to
get a clean screen.  On the left screen you will see 'unamed.f'.  Don't
worry.  Write the two line program as before. Now click 'File' and do a Save
as  SQUARE.F.  Go back to Win32for window, and on the command line write --
fload  square.f .. You will get some warning messages saying that SQUARE and
TSTSQ  are not unique. That's because you previously defined these words in
#1. Run TSTSQ    49   ok

#3  Go back to WinView.  Mark the block of program text. Click Edit and
Copy the text to the clipboard.  Now go back to Win32for. Press enter to get
on a clean line.  Go to Edit and Paste the text to the command line. It will
compile giving the same warnings as before.   Run  TSTSQ  You should get
49  ok

Hope this helps.

Walter Rottenkolber



Wed, 17 Mar 2004 01:21:31 GMT  
 Help with tutorial please

Quote:

>Well, this is exactly how it works in _any_ Forth that runs
>under windows? Copy text anywhere on the screen and paste it in the
>Forth window. This works even for DOS windows/Forths.

>> This is all done in the text editor window.

>Extra step: you would need to move the mouse to the Forth window.

Actually, I would normally do it this way:

1) Type in the code.

: SQUARE ( n -- n*n , square number )
     DUP *
;

: TEST.SQUARE ( -- )
    CR ." 7 squared = "
    7 SQUARE . CR
;

TEST.SQUARE

2) Hilite the code with the mouse.

3) Press <enter>.  Done.  Extra optional bonus,
   the output appears in the editor window as editable text.

Doing it the way you described would require the extra steps:

a) Copy to clipboard
b) switch to console window
c) Paste from clipboard
d) switch back to editor window

That's 7 steps you've got vs. my 3.

The edit/compile/test sequence I use is based heavily on
the marvelous MacForth Sibley editor.

-Doug



Wed, 17 Mar 2004 05:30:11 GMT  
 Help with tutorial please

Quote:

>You will have to elaborate on that point. If you check out what
>is done in hello.f, the conclusion is that OOP is some giant steps
>backward, compared to just typing in the two lines of this program
>( square and test-square ) that do real work.

No, no.  Compare "hello.f" to "winhello.f".

You are talking apples and oranges.

Quote:

>FOOP itself doesn't bring *anything* in a text-based environment.

Nothing could be further from the truth.

-Doug



Wed, 17 Mar 2004 05:32:55 GMT  
 
 [ 80 post ]  Go to page: [1] [2] [3] [4] [5] [6]

 Relevant Pages 

1. Looking for good tutorial books...please HELP !!!

2. please, please, please, please, help

3. will someone please, please, please, please HELP me?!!

4. VSE 3.1 Repository Problem: Please help (please please?)

5. PLEASE PLEASE PLEASE HELP !!!!!!!!!!!!

6. please,please please do help us

7. help please-----please help about array in DLL

8. HELP !..PLEASE,PLEASe,PLEAse,PLEase,PLease,Please,please.....

9. Ord Function HELP Please HELP HELP HELP

10. ***HELP***HELP***HELP***Please.

11. HELP HELP HELP PLEASE Ordinal Function

12. Help Help Help Please

 

 
Powered by phpBB® Forum Software