62.9.1. Zpráva „Re: Ruby and Forth“ z comp.lang.forth
od Mark Probert <probertm@acm.org>
Ruby is an excellent scripting language that I personally
prefer to the likes of perl and python.
ATLAST is a light-weight embeded Forth, after F83.
Putting ATLAST into Ruby exposes the Ruby community to Forth,
and it makes it fun to do the things that Forth does well
in Forth rather than Ruby.
For example, I can write (in Ruby)
require 'Atlast' # include the ATLAST extension
t = Atlast.new # create a Forth interpreter
t.expr(": fact (n -- n!) dup 1 do i * loop ; ")
n = 1
until n > 10
fact = t.run("#{n} fact .") # (1..10)! in a loop
puts "#{n}! = #{fact}" # print n! = fact \n
end
or
t.expr(": linear ( a b -- ) create swap , , does> dup r> @ * r> 4 + @ + ;")
t.expr("3 17 linear aline")
y = t.run("10 aline .")