Author Topic: SBLisp  (Read 19097 times)

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
SBLisp
« on: July 29, 2014, 05:52:18 PM »
In conjunction with Dave's VB/COM adventures I thought I would see how compatible Script BASIC is with Microsoft's Quick BASIC 4.5. I found a LISP in BASIC example and converted it to Script BASIC. (see attached)  I have a slight problem with it and could use another set of eyes.  If you solve the riddle and not a forum member, please send me an e-mail at support@scriptbasic.org and I will give you credit for the find.

Here is where I'm at.

Code: [Select]
jrs@laptop:~/sb/sb22/sblisp$ scriba lisp.sb
Initializing Memory...
Initializing Lisp Environment...
LISP in BASIC v1.3 by Arthur Nunes-Harwitt
 0](+ 2 2)
ERROR: UNBOUND VARIABLE
ERROR: UNBOUND VARIABLE
ERROR: UNKNOWN APPLICATION
( ())
 0]
« Last Edit: July 29, 2014, 07:12:44 PM by support »

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
Re: SBLisp
« Reply #1 on: July 29, 2014, 08:43:11 PM »
I decided to install Steel Bank Common Lisp (SBCL) and Quicklisp library manager on my Ubuntu 12.04 LTS 64 bit development system. Here is a log of the install process.

Quote
* SDL_gfx is now integrated into lispbuilder-sdl. There is no longer a need to explicitly use lispbuilder-sdl-gfx as functions in SDL_gfx will be called from lispbuilder-sdl if the SDL_gfx library is available.

Code: [Select]
jrs@laptop:~/sb/sb22/sblisp/LeanLisp$ sudo apt-get install sbcl
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  libkms1
Use 'apt-get autoremove' to remove them.
Suggested packages:
  sbcl-doc sbcl-source slime
The following NEW packages will be installed:
  sbcl
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 10.7 MB of archives.
After this operation, 50.2 MB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu/ precise/universe sbcl amd64 2:1.0.55.0-1 [10.7 MB]
Fetched 10.7 MB in 3s (2,691 kB/s)
Selecting previously unselected package sbcl.
(Reading database ... 1039868 files and directories currently installed.)
Unpacking sbcl (from .../sbcl_2%3a1.0.55.0-1_amd64.deb) ...
Processing triggers for man-db ...
Setting up sbcl (2:1.0.55.0-1) ...
jrs@laptop:~/sb/sb22/sblisp/LeanLisp$ sbcl --load quicklisp.lisp
This is SBCL 1.0.55.0.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.

  ==== quicklisp quickstart 2014-02-01 loaded ====

    To continue with installation, evaluate: (quicklisp-quickstart:install)

    For installation options, evaluate: (quicklisp-quickstart:help)

* (quicklisp-quickstart:install)

; Fetching #<URL "http://beta.quicklisp.org/client/quicklisp.sexp">
; 0.82KB
==================================================
838 bytes in 0.00 seconds (818.36KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/client/2014-07-04/quicklisp.tar">
; 220.00KB
==================================================
225,280 bytes in 0.24 seconds (901.64KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/client/2014-01-28/setup.lisp">
; 4.96KB
==================================================
5,078 bytes in 0.00 seconds (4958.98KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/asdf/2.26/asdf.lisp">
; 194.07KB
==================================================
198,729 bytes in 0.19 seconds (1016.08KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/dist/quicklisp.txt">
; 0.40KB
==================================================
408 bytes in 0.00 seconds (398.44KB/sec)
Installing dist "quicklisp" version "2014-07-14".
; Fetching #<URL "http://beta.quicklisp.org/dist/quicklisp/2014-07-14/releases.txt">
; 252.74KB
==================================================
258,806 bytes in 0.80 seconds (317.11KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/dist/quicklisp/2014-07-14/systems.txt">
; 173.53KB
==================================================
177,697 bytes in 0.19 seconds (918.16KB/sec)

  ==== quicklisp installed ====

    To load a system, use: (ql:quickload "system-name")

    To find systems, use: (ql:system-apropos "term")

    To load Quicklisp every time you start Lisp, use: (ql:add-to-init-file)

    For more information, see http://www.quicklisp.org/beta/

NIL
* (ql:system-apropos "vecto")
#<SYSTEM adw-charting-vecto / adw-charting-20120909-http / quicklisp 2014-07-14>
#<SYSTEM cl-aa / cl-vectors-20130312-git / quicklisp 2014-07-14>
#<SYSTEM cl-aa-misc / cl-vectors-20130312-git / quicklisp 2014-07-14>
#<SYSTEM cl-glfw-opengl-apple_specular_vector / cl-glfw-20130615-git / quicklisp 2014-07-14>
#<SYSTEM cl-paths / cl-vectors-20130312-git / quicklisp 2014-07-14>
#<SYSTEM cl-paths-ttf / cl-vectors-20130312-git / quicklisp 2014-07-14>
#<SYSTEM cl-vectors / cl-vectors-20130312-git / quicklisp 2014-07-14>
#<SYSTEM com.elbeno.vector / vector-20130128-git / quicklisp 2014-07-14>
#<SYSTEM lispbuilder-sdl-cl-vectors / lispbuilder-20140113-svn / quicklisp 2014-07-14>
#<SYSTEM lispbuilder-sdl-cl-vectors-examples / lispbuilder-20140113-svn / quicklisp 2014-07-14>
#<SYSTEM lispbuilder-sdl-vecto / lispbuilder-20140113-svn / quicklisp 2014-07-14>
#<SYSTEM lispbuilder-sdl-vecto-examples / lispbuilder-20140113-svn / quicklisp 2014-07-14>
#<SYSTEM org.middleangle.foreign-numeric-vector / fnv-20140713-git / quicklisp 2014-07-14>
#<SYSTEM sb-vector-io / sb-vector-io-20110829-git / quicklisp 2014-07-14>
#<SYSTEM static-vectors / static-vectors-1.6 / quicklisp 2014-07-14>
#<SYSTEM static-vectors/test / static-vectors-1.6 / quicklisp 2014-07-14>
#<SYSTEM vecto / vecto-1.4.7 / quicklisp 2014-07-14>
* (ql:quickload "vecto")
To load "vecto":
  Install 5 Quicklisp releases:
    cl-vectors salza2 vecto zpb-ttf zpng
; Fetching #<URL "http://beta.quicklisp.org/archive/salza2/2013-07-20/salza2-2.0.9.tgz">
; 15.16KB
==================================================
15,525 bytes in 0.03 seconds (541.47KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/zpng/2011-12-03/zpng-1.2.1.tgz">
; 38.81KB
==================================================
39,743 bytes in 0.16 seconds (242.57KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/zpb-ttf/2013-07-20/zpb-ttf-1.0.3.tgz">
; 43.82KB
==================================================
44,869 bytes in 0.12 seconds (368.21KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/cl-vectors/2013-03-12/cl-vectors-20130312-git.tgz">
; 30.63KB
==================================================
31,364 bytes in 0.12 seconds (264.04KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/vecto/2014-01-13/vecto-1.4.7.tgz">
; 61.75KB
==================================================
63,236 bytes in 0.10 seconds (630.14KB/sec)
; Loading "vecto"
[package zpb-ttf].................................
[package salza2]..................................
[package zpng]....................................
[package net.tuxee.paths].........................
[package net.tuxee.aa]............................
[package net.tuxee.aa-bin]........................
[package net.tuxee.vectors].......................
[package vecto]..........
("vecto")
* (ql:add-to-init-file)
I will append the following lines to #P"/home/jrs/.sbclrc":

  ;;; The following lines added by ql:add-to-init-file:
  #-quicklisp
  (let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp"
                                         (user-homedir-pathname))))
    (when (probe-file quicklisp-init)
      (load quicklisp-init)))

Press Enter to continue.


#P"/home/jrs/.sbclrc"
* (quit)
jrs@laptop:~/sb/sb22/sblisp/LeanLisp$

To find out what's available in Quicklisp, use:

Code: [Select]
* (ql:system-apropos "xml")
#<SYSTEM bknr.xml / bknr-datastore-20131111-git / quicklisp 2014-07-14>
#<SYSTEM cl-html5-parser-cxml / cl-html5-parser-20140713-git / quicklisp 2014-07-14>
#<SYSTEM cl-libxml2 / cl-libxml2-20130615-git / quicklisp 2014-07-14>
#<SYSTEM cl-libxml2-test / cl-libxml2-20130615-git / quicklisp 2014-07-14>
#<SYSTEM cl-rdfxml / cl-rdfxml-20140713-git / quicklisp 2014-07-14>
#<SYSTEM cl-xmlspam / cl-xmlspam-20101006-http / quicklisp 2014-07-14>
#<SYSTEM cxml / cxml-20110619-git / quicklisp 2014-07-14>
#<SYSTEM cxml-dom / cxml-20110619-git / quicklisp 2014-07-14>
#<SYSTEM cxml-klacks / cxml-20110619-git / quicklisp 2014-07-14>
#<SYSTEM cxml-rng / cxml-rng-2008-11-30 / quicklisp 2014-07-14>
#<SYSTEM cxml-rpc / cxml-rpc-20121013-git / quicklisp 2014-07-14>
#<SYSTEM cxml-stp / cxml-stp-20120520-git / quicklisp 2014-07-14>
#<SYSTEM cxml-stp-test / cxml-stp-20120520-git / quicklisp 2014-07-14>
#<SYSTEM cxml-test / cxml-20110619-git / quicklisp 2014-07-14>
#<SYSTEM cxml-xml / cxml-20110619-git / quicklisp 2014-07-14>
#<SYSTEM hu.dwim.perec+hu.dwim.quasi-quote.xml / hu.dwim.perec-20140713-darcs / quicklisp 2014-07-14>
#<SYSTEM hu.dwim.quasi-quote.xml / hu.dwim.quasi-quote-20130813-darcs / quicklisp 2014-07-14>
#<SYSTEM hu.dwim.quasi-quote.xml+cxml / hu.dwim.quasi-quote-20130813-darcs / quicklisp 2014-07-14>
#<SYSTEM hu.dwim.quasi-quote.xml+hu.dwim.quasi-quote.js / hu.dwim.quasi-quote-20130813-darcs / quicklisp 2014-07-14>
#<SYSTEM hu.dwim.util.flexml / hu.dwim.util-20140713-darcs / quicklisp 2014-07-14>
#<SYSTEM pithy-xml / pithy-xml-20101006-git / quicklisp 2014-07-14>
#<SYSTEM s-xml / s-xml-20120909-cvs / quicklisp 2014-07-14>
#<SYSTEM s-xml-rpc / s-xml-rpc-20101006-http / quicklisp 2014-07-14>
#<SYSTEM s-xml.examples / s-xml-20120909-cvs / quicklisp 2014-07-14>
#<SYSTEM s-xml.test / s-xml-20120909-cvs / quicklisp 2014-07-14>
#<SYSTEM sexml / sexml-20140713-git / quicklisp 2014-07-14>
#<SYSTEM sexml-objects / sexml-20140713-git / quicklisp 2014-07-14>
#<SYSTEM xfactory / cl-libxml2-20130615-git / quicklisp 2014-07-14>
#<SYSTEM xfactory-test / cl-libxml2-20130615-git / quicklisp 2014-07-14>
#<SYSTEM xml-emitter / xml-emitter-1.0.2 / quicklisp 2014-07-14>
#<SYSTEM xml-mop / xml-mop-20110418-git / quicklisp 2014-07-14>
#<SYSTEM xml-render / cl-typesetting-20130420-git / quicklisp 2014-07-14>
#<SYSTEM xml.location / xml.location-20140713-git / quicklisp 2014-07-14>
#<SYSTEM xml.location-and-local-time / xml.location-20140713-git / quicklisp 2014-07-14>
#<SYSTEM xml.location-test / xml.location-20140713-git / quicklisp 2014-07-14>
#<SYSTEM xmls / xmls-1.5 / quicklisp 2014-07-14>
#<SYSTEM xmls-test / xmls-1.5 / quicklisp 2014-07-14>
#<SYSTEM xmls-tools / xmls-tools-20110320-http / quicklisp 2014-07-14>
#<SYSTEM xoverlay / cl-libxml2-20130615-git / quicklisp 2014-07-14>
#<SYSTEM zaws-xml / zaws-20121125-git / quicklisp 2014-07-14>
*
« Last Edit: July 29, 2014, 09:33:37 PM by support »

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
Re: SBLisp
« Reply #2 on: August 04, 2014, 09:40:18 PM »
We were able to get the SBLisp Scheme (Lisp) interpreter working and could use some help beta testing. I have created a SBLisp Bitbucket Repository to get a copy of the current source and eventually documentation. A good resource for Scheme is the MIT/GNU Scheme Project.

FYI: The link to the SBLisp Bitbucket site can be found in the News section at the top right corner of the forum.

Code: Scheme
  1. jrs@laptop:~/sb/sb22/sblisp$ scriba lisp.sb
  2. Initializing Memory...
  3. Initializing Lisp Environment...
  4. LISP in BASIC v1.3 by Arthur Nunes-Harwitt
  5. 0](define factorial (lambda (n)
  6. 2](if (<= n 0)
  7. 3]1
  8. 3](* n (factorial (- n 1))))))
  9. FACTORIAL
  10. 0](factorial 8)
  11. 40320
  12. 0](quit)
  13. Bye!
  14. jrs@laptop:~/sb/sb22/sblisp$
  15.  
« Last Edit: August 28, 2014, 01:09:30 AM by support »

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
Re: SBLisp
« Reply #3 on: August 07, 2014, 11:35:09 AM »
I'm only posting milestones here about SBLisp. If you want to follow the action with Lisp in BASIC then head on over to the OxygenBasic Forum. Charles (O2 author) is creating his own version of Lisp he calls LeanLisp. Mike (FBSL author) and I have converted a QB 4.5 Scheme based version of Lisp in both SB and FBSL which we are co-developing.

« Last Edit: August 07, 2014, 11:36:46 AM by support »

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
Re: SBLisp
« Reply #4 on: August 09, 2014, 01:58:20 PM »
A few changes going on with the SBLisp project you should be aware of.

  • Mike Lobanovsky  (FBSL author) has taken the project lead.
  • SBLisp is an abbreviation for Scheme BASIC Lisp
  • Mike (for the most part) and I have fixed some bugs and added a couple new features to SBLisp
SBLisp is a Scheme based version of Lisp written in traditional BASIC. Current supported languages are Script BASIC and FBSL.
« Last Edit: August 09, 2014, 02:01:57 PM by support »

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
Re: SBLisp
« Reply #5 on: August 11, 2014, 05:40:06 PM »
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.
« Last Edit: August 20, 2014, 09:18:54 PM by support »

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
Re: SBLisp
« Reply #6 on: August 20, 2014, 09:14:48 PM »
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
  1. ;;; Rob's macros
  2.  
  3. (define make-listx
  4.      (lambda (i x L)
  5.       (if (= i x) L
  6.           (make-listx (+ i 1) x (cons i L)))))
  7.  
  8. (define range
  9.   (lambda (x)
  10.     (reverse (make-listx 0 x '() ))))
  11.  
  12. (define iterate
  13.   (lambda (op it)
  14.     (map (eval op) (range it))
  15.   T ))
  16.  
  17.  
  18.  
  19. ;;; ======= My LISP program ======
  20.  
  21. ;; Define iterators
  22. (define m 0)
  23. (define n 0)
  24.  
  25. ;; John's recursive Ackermann algo redefined
  26. (define A
  27.   (lambda (x y)
  28.     (cond
  29.       ((= x 0) (+ y 1))
  30.       ((= y 0) (A (- x 1) 1))
  31.       (else
  32.         (A (- x 1) (A x (- y 1)))
  33.       )
  34.     )
  35.   )
  36. )
  37.  
  38. ;; My Ackermann call
  39. (define Ackermann
  40.   (lambda ()
  41.     (print '"A(") (print m)
  42.       (print '", ") (print n)
  43.         (print '") = ") (print (A m n))
  44.     (newline)
  45.     (set! n (+ n 1))
  46.   )
  47. )
  48.  
  49. (define for-inner
  50.   (lambda ()
  51.     (set! n 0)
  52.     (iterate 'ackermann (- 6 m))
  53.     (set! m (+ m 1))
  54.   )
  55. )
  56.  
  57. (define for-outer
  58.   (lambda ()
  59.     (iterate 'for-inner 4)
  60.   )
  61. )
  62.  
  63. (define main
  64.   (lambda ()
  65.     (iterate 'newline 10)
  66.     (print  '========================== ) (newline)
  67.     (print '"My First XBLisp Program :)") (newline)
  68.     (print  '========================== ) (newline) (newline)
  69.     (for-outer)
  70.   )
  71. )
  72.  
  73. (main)
  74. (quit)
  75.  
  76. ;;; ==== THAT'S ALL FOLKS! ====
  77.  

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$
« Last Edit: August 21, 2014, 12:53:27 AM by support »