Downloads

Oforth runs on 32 bits & 64 bits plateforms.

Linux Release V0.9.26

Windows Release V0.9.26

Mac OS Release V0.9.26

Change log and previous releases

Change Log

Previous releases

Some examples (from tutorials).

You can find lots of examples here

Factorial

: fact(n) -- n1
| i | 1 n loop: i [ i * ] ;



Fibonacci sequence

: fib(n) -- n1
   0 1 n #[ tuck + ] times drop ;



Look and say (see detail)

: lookAndSay(n)
   [ 1 ] n #[ dup println group map([#size, #first]) ] times ;



Sum of square roots of all even integers between 1 and 10000

seq(10000) filter(#isEven) map(#sqrt) sum .
333383.040171148



A ping pong between 2 tasks running concurrently and using channels to communicate

: pong(n, ch1, ch2)
| i |
  n loop: i [ ch1 receive ch2 send drop ] ;

: pingpong(n)
| ch1 ch2 i |
   Channel new ->ch1
   Channel new ->ch2
   #[ pong(n, ch1, ch2) ] &
   n loop: i [ i ch1 send drop ch2 receive . ] ;



An emitter that launches event listeners into parallel tasks running concurrently

: myemitter {
| e |
   Emitter new(null) ->e
   e onEventParallel($foo, #[ "foo" . ])
   e emit($foo)
   e onEventParallel($foo, #[ "bar" . ])
   e emit($foo)
   e close ;