Load path?

Started by rickyboy, April 20, 2007, 07:24:20 AM

Previous topic - Next topic

rickyboy

Lutz?  Any one?  Is there a load path for newLISP?



I need my newLISP library routines to be loaded on demand (as opposed to all the time, e.g. init.lsp in the share directory).  And I'd like to avoid saying


(load "/path/to/rickyboys/libs/mylib.lsp")
but rather say


(load "mylib.lsp")
and have /path/to/rickyboys/libs in the "load path."  Thinking of emacs here -- so what is the newLISP way?



Thanks for any help!  --Ricky
(λx. x x) (λx. x x)

newdep

#1
Hi Ricky,



well by default there is not, but indeed newlisp seeks for init.lsp



But you could add to you ENV someting like export NEWLISP_PATH=/mylibs





Then put an (env "NEWLISP_PATH") in your init.lsp and append

that always to your files..or script and it will load from there...



But perhpas a default path setting inside newlisp would help out ;-)
-- (define? (Cornflakes))

rickyboy

#2
I couldn't find it in the manual or the source code; so it looks as if I need to write my own load function which will be located in init.lsp and which honors a "load path".



Thanks!  --Ricky
(λx. x x) (λx. x x)

rickyboy

#3
Quote from: "newdep"Hi Ricky,



well by default there is not, but indeed newlisp seeks for init.lsp



But you could add to you ENV someting like export NEWLISP_PATH=/mylibs





Then put an (env "NEWLISP_PATH") in your init.lsp and append

that always to your files..or script and it will load from there...



But perhpas a default path setting inside newlisp would help out ;-)


Hey Norman,  You were writing at the same time I was and we came to the same conclusion.  Great minds think alike, it is said.  ;-)



Thanks!  --Ricky
(λx. x x) (λx. x x)

newdep

#4
the init.lsp is hidden in /usr/share/newlisp..



or in your ~/.init.lsp



its called init.lsp.example by default...





put (set-env "NEWLISP_LIBS" "/mylibs") in your init.lsp





in your scripts or in init.lsp put something like



(setq $L (env "NEWLISP_LIBS"))



now $L always has your directory..





could be done differently though...
-- (define? (Cornflakes))

newdep

#5
hehehe..
-- (define? (Cornflakes))