Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - jeremyc

#1
Whither newLISP? /
September 08, 2009, 05:48:15 AM
Sorry. Yes, closed source is what I mean.
#2
Whither newLISP? /
September 07, 2009, 05:20:59 PM
I guess no change in the licensing, any commercial software is still prohibited by the licensing of NewLISP?



Jeremy
#3
Whither newLISP? /
October 30, 2008, 11:23:00 AM
Has any more thought went into this? I have enjoyed toying with newLisp, but cannot consider it a language for me to use because of the licensing restrictions. If I spend time developing something, I would want the freedom to do with it as I wish, without all kinds of hoops to jump through.



Jeremy
#4
Whither newLISP? /
December 04, 2007, 06:52:31 AM
Lutz, are you saying then, that it is against the license to distribute a closed source commercial app with newlisp?



Jeremy
#5
Is something like this possible?



(define (create-greeter greeting)
  (lambda (n)
    (println greeting " " n "!")))
(set 'hello-greeter (create-greeter "Hello"))
(set 'goodbye-greeter (create-greeter "Goodbye"))
(hello-greeter "World")
(goodbye-greeter "World")


The obvious desired output is:



Hello World
Goodbye World


Jeremy
#6
newLISP in the real world / sym and lookup problem
March 10, 2007, 08:21:29 AM
I have the following function:



(define (rowAsHash res idx)
  (set 'h '())
  (dotimes (fidx (fieldCount res))
  (push (list (sym (fieldName res fidx)) (value res idx fidx)) h))
  h)


fieldName returns a string. value returns the contents of the particular row/field index combo. Basically, I do:



(pg:query db "SELECT id, code FROM users"
  (lambda (rec) ;; rec = result of rowAsHash
    (println "Id: " (lookup 'id rec) " code: " (lookup 'code rec))))


Now, what happens is my id and code print's are nil. If I do a (println rec) then I get:



((id 10) (code "jdoe"))


Which looks OK. Now, if I remove the (sym ... ) around the (fieldName ...) portion of my rowAsHash function, therefore, I have:



(define (rowAsHash res idx)
  (set 'h '())
  (dotimes (fidx (fieldCount res))
  (push (list (fieldName res fidx) (value res idx fidx)) h))
  h)


I can do this



(pg:query db "SELECT id, code FROM users"
  (lambda (rec) ;; rec = result of rowAsHash
    (println "Id: " (lookup "id" rec) " code: " (lookup "code" rec))))


And that works as expected. My output is:



Id: 10 code: jdoe


Does anyone have an idea as to what I am doing wrong with the first example? Also, is it possible that I could have symbol collisions, say, if someone query's a table with the field name, "name"? Thus using the reserved symbol 'name ?



Thanks,



Jeremy
#7
newLISP newS / PostgreSQL module
March 09, 2007, 06:35:33 AM
I have created pgsql.lsp that accesses PostgreSQL from newLISP.  I am planning on doing some more work on it this weekend. I have not officially released the code, but I would like if those interested would review the code and offer any suggestions. I am a new newLISP programmer and in many ways, a new LISP programmer as well, so I am sure some things will stick right out and grab you that I may not find for a while.



The code is located at: http://jeremy.cowgar.com/index.cgi?page=newLispAndPostgreSQL">http://jeremy.cowgar.com/index.cgi?page ... PostgreSQL">http://jeremy.cowgar.com/index.cgi?page=newLispAndPostgreSQL



Any input would be greatly appriciated. Please post your comments here.



Thansk,



Jeremy
#8
newLISP in the real world /
March 08, 2007, 07:58:41 PM
Ok, I figured out this to make things work, but not sure if it's the right or best or even only way to do it:



(define-macro (seg-name seg val)
  (if val (nth-set 0 (eval seg) val))
  ((eval seg) 0))
#9
I have the follow function:



(define (seg-name seg val) (if val (nth-set 0 seg val)) (seg 0))


I want to be able to:



(set 'seg '("NM1" "85" "DEF"))
(println (seg-name seg)) ;; "NM1"
(seg-name seg "HL2")
(println (seg-name seg)) ;; "HL2" ---- that's what I want
(println (seg-name seg)) ;; "NM1" ---- is what I actually get


Is there any way to accomplish this? nth-set is a destructive operation, however, it appears to only be working on "seg" inside of the function, not the "seg" in the parent namespace.



Any thoughts?
#10
newLISP in the real world /
February 21, 2007, 01:21:31 PM
Quote from: "Lutz"not sure what you mean, but


Hm, my code was incorrect above. I simplified:



(set 'lst '((name 20 trim) (age 5 int)))
(print ((lst 0 2) "JEREMY           ") "n")

;; Desired output: JEREMYn


Right now the output is:


invalid function in function print : ((lst 0 2) "JEREMY           ")
#11
newLISP in the real world / Function from symbol?
February 21, 2007, 12:02:35 PM
How can I:



(define (greet who) (print "Hello " who))
(set 'lst '((name "John" who) (age 10)))
((lst 0 2) (lst 0 1))


In other words, reference a dynamic function inside a quoted list. The real reason for this is a process I created for parsing fixed width files:



(define (special-conversion-function str) (do-something str))
(set 'layout '((name 10) (dob 6 special-conversion-function) (country 2)))
(import-data "file.txt" layout)


Now, the import-data function recognizes that dob requires a special conversion by the inclusion of another parameter in the fixed width format specification. I want import-data to then call the function "special-conversion-function" but I am failing to make it work.



Thanks,



Jeremy
#12
newLISP and the O.S. /
February 21, 2007, 10:29:11 AM
I am assuming yes, I have a wiki, plane and pic of me :-) Well, sorta. I don't own that plane, but the glider club I use to belong to owns it and it's the one I solo'd in.
#13
newLISP and the O.S. /
February 21, 2007, 06:23:52 AM
Hm. Your right. I guess I was thinking newlisp-tk was a binary that had to be compiled. I didn't see it scroll by, so I figured it was not building it. My bad.



Thanks for walking me through it, sorry to waste your time.
#14
newLISP and the O.S. /
February 21, 2007, 06:18:38 AM
$ ./configure



Discovered Darwin MacOS X with readline suport, enter:

     make

to make for MacOS X with readline support



$ make

./build



Discovered Darwin Mac OSX with readline suport:

make -f makefile_darwin

cc -L/usr/lib -Wall -O2 -I/usr/include -c -g -DREADLINE -DMAC_OSX newlisp.c

cc -L/usr/lib -Wall -O2 -I/usr/include -c -g -DREADLINE -DMAC_OSX nl-symbol.c

cc -L/usr/lib -Wall -O2 -I/usr/include -c -g -DREADLINE -DMAC_OSX nl-math.c

cc -L/usr/lib -Wall -O2 -I/usr/include -c -g -DREADLINE -DMAC_OSX nl-list.c

cc -L/usr/lib -Wall -O2 -I/usr/include -c -g -DREADLINE -DMAC_OSX nl-liststr.c

cc -L/usr/lib -Wall -O2 -I/usr/include -c -g -DREADLINE -DMAC_OSX nl-string.c

cc -L/usr/lib -Wall -O2 -I/usr/include -c -g -DREADLINE -DMAC_OSX nl-filesys.c

cc -L/usr/lib -Wall -O2 -I/usr/include -c -g -DREADLINE -DMAC_OSX nl-sock.c

cc -L/usr/lib -Wall -O2 -I/usr/include -c -g -DREADLINE -DMAC_OSX nl-import.c

cc -L/usr/lib -Wall -O2 -I/usr/include -c -g -DREADLINE -DMAC_OSX nl-xml.c

cc -L/usr/lib -Wall -O2 -I/usr/include -c -g -DREADLINE -DMAC_OSX nl-web.c

cc -L/usr/lib -Wall -O2 -I/usr/include -c -g -DREADLINE -DMAC_OSX nl-matrix.c

cc -L/usr/lib -Wall -O2 -I/usr/include -c -g -DREADLINE -DMAC_OSX nl-debug.c

cc -L/usr/lib -Wall -O2 -I/usr/include -c -g -DREADLINE -DMAC_OSX pcre.c

cc -L/usr/lib newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-filesys.o nl-sock.o nl-import.o nl-xml.o nl-web.o nl-matrix.o nl-debug.o pcre.o -g -lm -lreadline -o newlisp

strip newlisp
#15
newLISP and the O.S. /
February 21, 2007, 06:05:26 AM
I thought the OSX installer was PPC? I'm on an intel mac.