Support > General Discussions

SBLisp

<< < (2/2)

Support:
Attached is a standalone Windows 32 bit version of SBLisp. (Scheme BASIC Lisp) The documentation provided by the original author is attached as well. A PDF from Randy Beer that wrote the first cut that Arthur used as a reference to write LISP in BASIC is also attached.

Update - 2014-AUG-16 - SBLisp  (standalone executable) Windows 32 bit & Ubuntu 64 bit.

Support:
Mike (FBSL author) created this Ackermann example in SBLisp to show the progress we have made with the Scheme BASIC Lisp interpreter.

SBLisp current standalone executables for Windows 32 bit and Ubuntu 64 bit attached. (see attached for this running on CompileOnLine.com)


--- Code: Scheme ---;;; Rob's macros (define make-listx     (lambda (i x L)      (if (= i x) L          (make-listx (+ i 1) x (cons i L))))) (define range  (lambda (x)    (reverse (make-listx 0 x '() )))) (define iterate  (lambda (op it)    (map (eval op) (range it))  T ))   ;;; ======= My LISP program ====== ;; Define iterators(define m 0)(define n 0) ;; John's recursive Ackermann algo redefined(define A  (lambda (x y)    (cond      ((= x 0) (+ y 1))      ((= y 0) (A (- x 1) 1))      (else        (A (- x 1) (A x (- y 1)))      )    )  )) ;; My Ackermann call(define Ackermann  (lambda ()    (print '"A(") (print m)      (print '", ") (print n)        (print '") = ") (print (A m n))    (newline)    (set! n (+ n 1))  )) (define for-inner  (lambda ()    (set! n 0)    (iterate 'ackermann (- 6 m))    (set! m (+ m 1))  )) (define for-outer  (lambda ()    (iterate 'for-inner 4)  )) (define main  (lambda ()    (iterate 'newline 10)    (print  '========================== ) (newline)    (print '"My First XBLisp Program :)") (newline)    (print  '========================== ) (newline) (newline)    (for-outer)  )) (main)(quit) ;;; ==== THAT'S ALL FOLKS! ==== 
Output

jrs@laptop:~/sb/sb22/sblisp$ time scriba lisp.sb ackermann.scm
SBLisp - Scheme BASIC Lisp

(define make-listx
     (lambda (i x L)
      (if (= i x) L
          (make-listx (+ i 1) x (cons i L)))))
MAKE-LISTX
(define range
  (lambda (x)
    (reverse (make-listx 0 x '() ))))
RANGE
(define iterate
  (lambda (op it)
    (map (eval op) (range it))
  T ))
ITERATE
(define m 0)
M
(define n 0)
N
(define A
  (lambda (x y)
    (cond
      ((= x 0) (+ y 1))
      ((= y 0) (A (- x 1) 1))
      (else
        (A (- x 1) (A x (- y 1)))
      )
    )
  )
)
A
(define Ackermann
  (lambda ()
    (print '"A(") (print m)
      (print '", ") (print n)
        (print '") = ") (print (A m n))
    (newline)
    (set! n (+ n 1))
  )
)
ACKERMANN
(define for-inner
  (lambda ()
    (set! n 0)
    (iterate 'ackermann (- 6 m))
    (set! m (+ m 1))
  )
)
FOR-INNER
(define for-outer
  (lambda ()
    (iterate 'for-inner 4)
  )
)
FOR-OUTER
(define main
  (lambda ()
    (iterate 'newline 4)
    (print  '=================== ) (newline)
    (print  '"Ackermann - SBLisp") (newline)
    (print  '=================== ) (newline) (newline)
    (for-outer)
  )
)
MAIN
(main)




===================
ACKERMANN - SBLISP
===================

A(0, 0) = 1
A(0, 1) = 2
A(0, 2) = 3
A(0, 3) = 4
A(0, 4) = 5
A(0, 5) = 6
A(1, 0) = 2
A(1, 1) = 3
A(1, 2) = 4
A(1, 3) = 5
A(1, 4) = 6
A(2, 0) = 3
A(2, 1) = 5
A(2, 2) = 7
A(2, 3) = 9
A(3, 0) = 5
A(3, 1) = 13
A(3, 2) = 29
T
(quit)

real   0m1.133s
user   0m1.116s
sys   0m0.012s
jrs@laptop:~/sb/sb22/sblisp$

Navigation

[0] Message Index

[*] Previous page

Go to full version