Thinking Forth

: infinite-love  ( - v - ) 

begin

    ." Love" 

again ;

OK…?

Forth is nifty. Not in the same way that Lisp is nifty, but still. Unfortunately I haven’t found a good Forth for 64-bit systems so far, so I haven’t played with Forth a lot yet.

I have played with Lisp; to be more precise, with Clojure (which some people will insist is not Lisp).

(defn infinite-love []
  (loop [_ nil]
    (recur (println "Love"))))

Now this reminds me of talk back in the day with the C64 and Abacus Software, they published all kinds of software like this, inclusing LOGO with Turtle Graphics :wink:

1 Like
\ Leo Brodie / Chuck Moore: Keep it simple - Factor out the noise.

: clojure-overkill ( -- )
    ." Bringing recursion, `_ nil`, and a JVM heap "
    ." to an infinite loop about love is peak over engineering." cr ;

: real-64bit ( -- )
    ." for 64-bit:  install gforth (or VFX / SwiftForth)." cr ;

: infinite-love ( cynicism -- )
    drop 
    begin 
        ." Love " 
    again ;

\ Execution:
clojure-overkill
real-64bit
infinite-love

:laughing: :sign_of_the_horns:

1 Like

``ciforth’’ is a factory for making implementations of Forth.
Forth is a standardized (ANS 94) computer language which is primarily
interactive, but has facilities for scripting and stand alone
executables.

The name ciforth derives from computer intelligence Forth, because
the original goal was to make a stand alone artificial intelligence
machine. Now you may think of it as common Intel Forth.
As long as your target is i86 based, you can pick your target to be:

  • 16 32 or 64 bit
  • interfacing through BIOS, MSDOS INT 21, MSDOS DPMI, WIN32 dll,
    unix systemcalls (OSX, and LINUX) or dynamic (.so) libraries
  • can be assembled using masm, nasm, gas or fasm.
: repeat-love ( n -- )
   0 DO
     ." Love "
   LOOP;

5 repeat-love

1 Like

~image~

What is Forth?

Those Lisp are sexp.

Rich Hickey is a genius.

He tried to get the business world to adopt Lisp, they refused.

Management in corporations were hesitant adopting technologies that didn’t have support.

Java was was the business ecosystem.

So he built Lisp on top of Java, and businesses were buying cuz java + efficiency.

(defn repeat-love [n]
  (when (pos? n)
    (println "Love")
    (recur (dec n))))

Or, if you don’t mind using a sequence instead of simple recursion:

(defn repeat-love [n]
  (doseq [_ (range 0 n)]
    (println "Love")))

Either way, invoke with:

(repeat-love 5)

Function with Love.

; by disk files or EPROM. Only the artificial-intelligence-languages,
; LISP and Forth, allow to have a program that extends itself
; indefinitely. Interestingly, you will find that most programs cripple