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

Topics - dukester

#1
Is there one hiding somewhere? I searched this Forum and the Home site w/o any luck.
#2
newLISP in the real world / $HOME/.init.lsp
May 09, 2022, 09:15:00 PM
What should I have in this file?

Having issues loading modules.

Have to do for example:

(load (append (env "NEWLISPDIR")"/modules/cgi.lsp"))



Can this be done in the ~/.init.lsp file?



TIA ...
#3
newLISP in the real world / Code Lisp-ish enough??
April 29, 2021, 07:19:34 AM
Getting back to Lisp and family ...



Using a temperature converting utility as a starting point.



Is my code here:   https://controlc.com/4a38c367">https://controlc.com/4a38c367



Lisp-ish enough! To me it doesn't seem much different than my similar renditions in Free Pascal or Icon.
#4
Not for me anyway!



c:binnewlisp>newlisp

newLISP v.10.7.1 64-bit on Windows IPv4/6 UTF-8 libffi, options: newlisp -h



> (load "guiserver.lsp")

(lambda (gs:id gs:action) (net-send gs:out (string "frame-resized " gs:id " " gs:action  "n")))

>
#5
I've been running newlisp  -http -d8080  etc etc



I haven't anything in the manual that indicates how to gracefully shutdown newlisp in daemon mode on a windows box.
#6
PS C:binnewlisp> newlisp -v

newLISP v.10.7.1 64-bit on Windows IPv4/6 UTF-8 libffi.



Running Apache2.4 on a Win10 box.



Apache is choking - once again - on the header sent by newlisp:


QuoteContent-type' contains invalid characters, aborting request


Lutz fixed a similar issue back in 2015, but it seems to have re-surfaced!



This is the code used then and now:
#!C:binnewlispnewlisp.exe
(print "Content-type: text/htmlnn")

(print "<html>")
(print "<h4>CGI by newLISP v" (sys-info -2)" on " ostype "</h4>")
(dolist (e (env)) (println (e 0) " : " (e 1) "</br>"))
(println "</html>")
(exit)


Anybody know how to fix this issue?
#7
I have this test code:

#!c:binnewlispnewlisp.exe
(println (main-args 2))   ;; works OK

(dolist (x (main-args))
(println $idx ":" x))
(exit)


The above code works fine!  BUT  - when I ask dolist to use a "break expression", I'm making it choke and I don't know why!



So if I do:

(dolist (x (main-args 2))


No joy!!  Help!!  and I have read the manual!!   TIA ....



BTW, this is happening on a Win10 box
#8
newLISP in the real world / set - setf - setq woes
August 21, 2017, 03:49:39 PM
I'm getting back to playing with newLISP!  - Again!!  :)

The following code broke when I used setf or setq!  Why is that?  What is the subtle diffs between the three?  I want to grok this ASAP - so that I don't spin my wheel ever again with setting a symbol, etc.  TIA



(set 'vowels '("a", "e", "i", "o", "u"))

;; define a function called pig-latin

(define (in-pig-latin this-word)
(set 'first-letter (first this-word))
(if (find  first-letter vowels)
(append this-word "ay") ; concatenate word and "ay"
(append (slice this-word 1) first-letter "ay")))  ; concatenate

;; test the function

(println (in-pig-latin "red"))
(println (in-pig-latin "orange"))
(exit 0)

;; output is
;;edray
;;orangeay

;;Notes:  the setf and setq function BROKE the code when I tried to use them
;;  Why was that?  When is setf and setq used in NL?
#9
I've lost a lot of the little LISP-ishness that I managed to acquire over the years. Use it or loose it ....



Anyway, I have a variable/symbol --  let's say:


(set 'name  "some_name")

Down the road, I want to test te symbol name to see if it is equal to - say "dukester".  If it is, I want to execute a function - say  "emailPerson".



I thought that the following would work:


(if (= name "dukester") (emailPerson))

But it's not working!  Maybe there's a more LISP-ish of accomplishing this? TIA ...
#10
newLISP and the O.S. / Guiserver on Win10
July 23, 2016, 10:15:30 PM
Will not boot for me! A terminal window flashes by for a second or so, and then nothing. I accept all the defaults when I install. Ideas please!  TIA ....
#11
newLISP in the real world / Scheme "letrec" equivalent
February 17, 2015, 09:58:13 AM
Is there one in newLISP?  As in



(letrec
((IB "Enter initial balance: ")
( AT "Enter transaction (- for withdrawal): ")
(FB "Your final balance is: ")
         .
         .


I searched this forum, and found where Lutz had a conflab about "let" "let*" and "letrec" back in ancient times (around 2002 ish).  Nothing has shown up since.  TIA ...
#12
newLISP in the real world / newlisp-apache-win7
February 04, 2015, 12:08:58 PM
Can they "play nice" together?  How?  :D



I've got apache up and running. I've conf it to accept .cgi and .lsp scripts



I'm not sure how to write the initial "shebang" line??? I've been using the FQP to the newlisp executable, but no joy yet!!



Any ideas!!  TIA



[follow-up]



I keep getting this apache error:

[Wed Feb 04 15:16:51.241193 2015] [cgi:error] [pid 5544:tid 984] [client ::1:50169] End of script output before headers: index1.cgi



It means that the http headers are not being sent to the server by newlisp. Don't know why not ...



I seem to get less errors with this first line:



#!"C:Program Files (x86)newlispnewlisp.exe"



but no cigars yets!! lol
#13
newLISP and the O.S. / 10.6.0 fails to start on Lubuntu
December 27, 2014, 10:32:34 PM
I just installed newLISP v.10.6.0 for UBUNTU on i386 UTF-8 enabled in Lubuntu running in VMware on a win7 box.



Zero joy!!  It wont start! I have NEWLISPDIR set, and the software is where it's supposed to be!!



Any ideas as to what is causing this WTF moment?  lol ...   TIA
#14
Is it possible?



I have 5 symbols containing various strings.



I want to replace all the "<" characters with "<"  in one, slick expression.



I was thinking of:


(dolist (s (var1 var2 var3 var4 var5))
(replace "<" s "<"))


but it's not working!



Would someone point me in the right direction - please!!
#15
newLISP and the O.S. / newlisp-gs chokes on Win 7
March 26, 2012, 03:21:29 PM
I'm a Linux guy trying to get a Win 7 box to play nice with newlisp-gs. :(



I've searched this forum and found a similar thread, but nothing in there seems to work for me. i=I keep getting this error message:



ERR: no working directory found



Would one of you kind souls please post your relevant settings - before I nuke the partitions on my HDD and install my favorite Debian distro. LOL ...   TIA
#16
newLISP in the real world / Device names and/or numbers
September 19, 2009, 04:41:27 AM
Is there a list of device numbers somewhere? I've searched the manual with no luck. Something like:



Device Name    Device#

keyboard              0

crt                        1

etc

etc



As well, are:



STDIN

STDOUT

STDERR



defined?



Can I use STDIN in code to mean device#0? etc...
#17
I want to port a Perl function that does the following:


sub some_function {
declare a local_var
if (some_test) { do something
return local_var}

if (some_other_test) { return something}
else {return 0}
}


So I've come up with:


(define (my_func)
(local (my_var)
(if (= "blah" my_var) (do this))
return_something
    )
(if (= "blaah" some_var) (return_something_else))

(if none of the above are true (return nil))
)

I'm kinda stuck on returning different values depending on the outcome of the "if" statements.  I'm getting mixed up with the syntax for functions with that of "if" statements. Any advice?



Being used to imperative languages, I'm finding a functional language a bit of a challenge --- but fun! TIA..
#18
newLISP in the real world / Trapping file ops errors
September 16, 2009, 01:44:15 PM
Hey all....



Fooling around, getting comfortable with newLISP! Currently learning to load modules; trap load errors; checking for existence of files, etc.  I cobbled together the following:


(define (load_mod x)
(if (file? (append (env "NEWLISPDIR") "/modules/" x)) (print "Loading module: " x)
(throw-error  "module does not exist")
)
)


So, obviously, I'm first checking whether or not the required file "x", exists. If it does, it will get loaded (I have only a debug msg. at the moment).



Is there a way to absolutely tell that the file did get loaded?



Should "load_mod" be called from within a "catch", e.g.



(catch (load_mod "cgi.lsp")) ?
#19
Whither newLISP? / newLISP coding form
April 30, 2009, 01:42:20 PM
Would the following offend an old-salt  LISPer?




(define index? 1)
(map (fn (value3)
    (println "Item " index? "=  " value3)
    (inc index?)
     )
(sequence 25 20)
)
#20
Before I ask my question, I'd like to say that I'm familiar with using CGI with Apache along with Perl/PHP.



I have seen some examples on how to "invoke" newLISP in HTTP mode, but then what? Should I see something in my browser? Do I have to shutdown Apache first? Which port does HTTP newLISP listen to, 80 or 8080 or something else?



Tim Johnson: jump in, if you date ;)

TIA....