I wrote this up quickly last night and this afternoon.
It's a database library written completely in newLISP. It's very simple, but I'll make it more capable in later releases. I wrote this because I didn't want to deal with SQL. I suppose I could have written a wrapper around the sqlite3 library for newLISP to hide the SQL from me, but that would have been less fun.
See the README file for general information, and the example.lsp file for example usage.
http://kinghajj.home.comcast.net/nldb.tar.bz2
newLISP Database
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
Wow - really good stuff here! It makes sense to do a DB this way - anyway, sqlite3.lsp is also available if people want.
Have you checked out newlispdoc for your documentation needs? It makes generating a 'module' listing easy, anyway.
How about this for truncate:
Have you checked out newlispdoc for your documentation needs? It makes generating a 'module' listing easy, anyway.
How about this for truncate:
Code: Select all
(define (truncat lst size)
(let (len (length lst))
(if (<= len size)
(set 'lst (append lst (dup nil (- size len))))
(set 'lst (chop lst (- len size))))
lst
)
)
Wow, that is a much cleaner version of truncate! Here's a more concise version.
I'll use this in the next release. Thanks.
Code: Select all
(define (truncate lst size)
(let ((len (length lst)))
(if (<= len size)
(append lst (dup nil (- size len)))
(chop lst (- len size)))))
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
Or:
If you like implicit slices...
Code: Select all
(define (truncate1 lst size)
(0 size (append lst (dup nil size))))