[comp.lang.forth] One and One doesn't equal two It equals 1 - The Who

cwpjr@cbnewse.att.com (clyde.w.jr.phillips) (03/22/91)

Dave asked:
(Dave Lowry @ Honeywell Systems & Research Center)(9 lines) 

With all this discussion of the merits of Forth, I wonder if somebody           could comment on the usefulness of a language that merrily accepts
things like:

: 1 2 ;

resulting in:

1 1 + . 4 ok
------------

The FORTH language is very useful. I suspect that's not what you're
fishin for but I bet the big one you're after get's away! 8^)

It merrily accepts : : do somthing else also ; . I find this a virtue.

I think it is a strength to be this flexible. Cosider fuzzy logic:

If I say : 1 1.004 : I have a waited value that can still be referred to
as "1".

I know of NO OTHER LANGUAGE that lets me SO MERRILY hide my complexity. 

Bill GATES Addressing AT&T 3/6/91 :

Sophisticated Simplicity. Writing complex software that enables people
with a few simple keystrokes, to have more info faster and better than before.

This in short is the vision I have always had.
----------------------------------------------

So I get to do what Bill wants and without being overly complex.
I still  say this is a virtue, where Virtue = Merit

Now the challenge:

Show me a shorter and cleaner way to weight an absolute ( from the user POV )
value. Your choice of language, don't even have to have merit but must
run on some existing computer we can test it on!

See you shortly, Clyde
"...the quicker it opens the sooner it closes" From "Run for the Roses" Garcia

hawley@adobe.COM (Steve Hawley) (03/23/91)

In article <1991Mar21.203114.7666@cbnewse.att.com> cwpjr@cbnewse.att.com (clyde.w.jr.phillips) writes:
>If I say : 1 1.004 : I have a waited value that can still be referred to
>as "1".
>
>I know of NO OTHER LANGUAGE that lets me SO MERRILY hide my complexity. 
...
>Now the challenge:
>
>Show me a shorter and cleaner way to weight an absolute ( from the user POV )
>value. Your choice of language, don't even have to have merit but must
>run on some existing computer we can test it on!

Forth:
: 1 1.004 ;
Scheme (or lisp):
(define 1 1.004)

This is a 5 character difference in length.  It can be reduced:
(define d define)
(d 1 1.004)
Such that the definition is the same length, but that's not the point.

The point is that, yes, this ability exists elsewhere in a clean fashion.

Steve Hawley
hawley@adobe.com
-- 
"Did you know that a cow was *MURDERED* to make that jacket?"
"Yes.    I didn't think there were any witnesses, so I guess I'll have to kill
 you too." -Jake Johansen

S47852EF@ETSUACAD.BITNET ("Frank C. Earl") (03/26/91)

On Mon, 25 Mar 91 10:43:42 GMT <zmleb@SCFVM.GSFC.NASA.GOV> said:
>
>Sorry, but any Scheme or Lisp I know of will complain that '1' is not a symbol.
>
>Markus

Indeed...    But, Forth will let you do it...   (I just LOOOVE that!   ;)
(I've tried it on my copy of TransLISP- it don't like it at *ALL*...)

Frank C. Earl

Internet   : s47852ef@etsuacad.etsu.edu
Bitnet     : s47852ef@etsuacad

--->  Starflight and Starflight II are successful PC and MAC games  <---
--->  that have been written in Forth!!!       (So, there!  ;)      <---

bouma@cs.purdue.EDU (William J. Bouma) (03/28/91)

In article <9103271403.AA16095@ucbvax.Berkeley.EDU> "Frank C. Earl" <S47852EF%ETSUACAD.BITNET@SCFVM.GSFC.NASA.GOV> writes:
>On Mon, 25 Mar 91 10:43:42 GMT <zmleb@SCFVM.GSFC.NASA.GOV> said:
>>
>>Sorry, but any Scheme or Lisp I know of will complain that '1' is not a symbol
>
>Indeed...    But, Forth will let you do it...   (I just LOOOVE that!   ;)

   The Forth philosophy seems to be that everything read in is a WORD.
   Upon reading "1" and not finding an entry in the dictionary, the 
   'default` action of "1" is performed.  Namely, to push the value 1
   on the stack.  This is consistent with Forth's refusal to acknowledge
   there are varied types of data.  The interpreter refuses to read
   anything other than WORDs.

   Lisp simply has a different philosophy.  Lisp is typed.  The reader
   returns the value 1 when it sees "1", rather than the symbol who's
   name is "1".  The reader returns a vector when it sees #() and a list
   when it sees '().  To have the reader return the symbol who's name is
   "1", the syntax (oh, no, that swear word again) is |1|.  In lisp, (I
   am really talking only CL here, don't know how Scheme does it), I
   could thus say (defun |1| () 2) or (setq |1| 2) without error.
   
   Notice Forth would need a special syntax to distinguish numbers and
   names of numbers if its search order were changed.  ie. Check if the
   string is a number first, if not, search in the dictionary.

   I have accidentally redefined a constant in FORTRAN before.  One did
   (do? depends on the implementation I guess) this by calling a subroutine
   with a constant argument.  Since FORTRAN passes arguments by address...
   This is a tough bug to find!  However, I find it hard to believe anyone
   could accidentally do this in Forth.  If you did misstype the name to a
   colon definition, it would be an easy bug to spot.

   You can love or hate that Forth allows you to do this.  It is novel but
   potentially dangerous.  What I dislike is the philosophy of Forth that
   makes it possible to allow you to do it. 8^)  But you know that already.
-- 
Bill <bouma@cs.purdue.edu>