On Mar 13, 1:52 pm, John Doty <j...@[EMAIL PROTECTED]
> wrote:
> William James wrote:
> > On Mar 10, 6:05 pm, "Ed" <nos...@[EMAIL PROTECTED]
> wrote:
>
> >> : BETWEEN ( n1|u1 n2|u2 n3|u3 -- flag ) OVER - -ROT - U< 0= ;
>
> > Conside people who know nothing about Forth or Ruby.
> > Most would find this more comprehensible.
>
> > def between x, low, high
> > (low..high).include? x
> > end
>
> > # test it
> > -1.upto(5){|i|
> > puts "#{ i } #{ between(i,2,4) }"
> > }
>
> > --- output ---
> > -1 false
> > 0 false
> > 1 false
> > 2 true
> > 3 true
> > 4 true
> > 5 false
>
> Wonderful example! I knew *no* Ruby before reading this post. But "sudo
> apt-get ruby", "ruby --help", and I figured out to run this, and even
> make small modifications and other simple programs from this example.
>
> I've never read a word of Ruby do***entation.
>
> It's nearly comment-free: the code speaks for itself.
>
> I cannot imagine anyone learning any Forth directly from the example
> given, without substantial, complex explanation.
>
> It's a powerful refutation of the "all languages are created equal"
notion.
>
> --
> John Doty, Noqsi Aerospace, Ltd.http://www.noqsi.com/
> --
> History teaches that logical consistency is neither sufficient nor
> necessary to establish practical, real world truth. Those who attempt to
> use logic for that purpose are abusing it.
Type "irb" at your shell prompt to interact with Ruby as you do with
Forth:
>> irb
irb(main):001:0> (2..4).class
=> Range
irb(main):002:0> (2..4).methods.sort
[ Too many methods to show here. ]
irb(main):003:0> (2..4).to_a
=> [2, 3, 4]
irb(main):004:0> quit
Back at the shell, type "ri Range" to get some info about Range.
To get info about the instance method "include?", type
"ri Range#include?".


|