freenode/lisp - IRC Chatlog
Search
13:49:47
jmercouris
however if I set the environment variable I want to read via osicat, it seems to work
14:00:14
jmercouris
I use fish on my main machine, and bash before that, so I didn't know much about csh
17:38:17
grewal
I know I can make an image, but I'd rather just share the source code. There seems to be no clean way to handle dependencies
17:41:07
_death
I guess you could use https://www.quicklisp.org/beta/bundles.html .. in some of my "scripts" I have a quickload form with :silent t , but I also use a custom image that has most of the dependencies already loaded
17:41:39
dlowe
grewal: there's some projects that deal with this. cl-launch and roswell come to mind.
18:25:59
phoe
I have a list of triples in form (X Y Z). I am inside a loop that iterates over two variables. How can I find the value of Z if there is a triple with a matching X and Y in the list?
18:27:42
Bike
(third (find-if (lambda (triple) (and (eql (first triple) x) (eql (second triple) y))) list-of-triples))?
18:38:38
dlowe
(find (list x y) list-of-triples :test #'equal :key (lambda (x) (list (first x) (second x))))
19:17:04
pjb
grewal: imagine a shell script, but it uses non-standard applications and shell libraries!
19:17:57
pjb
grewal: definitely. You make a single-file executable. Or you provide a tarball to install in /opt/apps/$yourscript/ with a script to install in /usr/local/bin/$yourscript
19:19:29
pjb
grewal: there's cl-launch, but it doesn't work like I want, so in the end, now I build all my CL scripts (that used to hav #!/usr/local/bin/clisp …), in a single executable image called commands, and a bunch of symlinks into it.
19:22:16
pjb
grewal: oh yeah, the big problem with cl-launch, is that it compiles the lisp script. This means that you cannot write scripts that modify the environment for the rest of the script. This is something that is routinely done in scripts (bash, ruby, python, perl, lisp, whatever).
19:22:48
pjb
Once cl-launch compiles, we're not in the script world anymore, so you can as well compile and save an executable image.
19:24:12
grewal
I guess the biggest hangup is (potentially) having multiple copies of the same libraries
19:24:17
pjb
your scripts can be used by any users on any system. You cannot override the user's ~/quicklisp, so you have to setup a quicklisp elsewhere. (/usr/local/share/myscript/quicklisp for example). This is not a script, when you have external file dependencies.
19:24:32
dtw
grewal: You can distribute code, of course. Write a Makefile that installs Quicklisp and eventually compiles executable. I do that: https://github.com/tlikonen/tagdb
19:24:52
pjb
grewal: if the user can make a (quick-update) and break your script because it fetches a new version of a library, this is BAD!
19:25:58
grewal
pjb: I meant copies. If two different lisp images have cl-ppcre baked in, then you have 2 copies of the same library on your system
19:26:58
grewal
Obviously, if you need to pin to a particular version, then you have no choice. But most apis are stable
19:27:54
jasom
grewal: I would suggest just using ASDF and the consumer can quickload things if needed
19:28:37
pjb
grewal: again, it's not copies, it's two versions that happend to be the same version, but that at any time, can change in one, and not in the other.
19:28:59
pjb
grewal: or you must be prepared to recompile all your lisp software as soon as you do a (quick-update) (every month!)
19:48:21
_death
pjb: typo @ https://github.com/informatimago/commands/blob/master/generate-commands.lisp#L65
21:03:26
dale
I'm trying to do something like (let ((n 42)) (loop for n = n then n+1 until (>= n 50))) but n is nil on the first trip through the loop. Is there a good (or "remotely sane, relative to loop") way to have loop initialize its n from the surrounding n binding?
21:09:30
dale
verisimilitude: Sorry, my simplified example was obviously oversimplified. The actual code is a bit more complicated: http://ix.io/1Ezd/lisp
21:10:30
dale
verisimilitude: If I use WITH, how do I reassign n on each iteration after the first? Just slam in a DO (SETQ ...)?
21:11:54
verisimilitude
I agree that a simple renaming is likely easiest, but I'm wondering why you need N = N to start with.
21:12:45
dale
verisimilitude: I could rewrite it with a single FOR clause a la: for marker = (nav-stack-go-newer nav-stack-global-stack n) then (nav-stack-go-newer nav-stack-global-stack direction)
21:13:05
makomo
you'd like to start off with the outer value but then do something else on all the other iterations
21:13:58
makomo
dale: i've had a construct like that as well in some code, but the duplication annoys me
21:14:32
dale
I was surprised that "FOR n = n" seems to be like (let (n) (setq n n) ...) rather than (let ((n n)) ...).
21:14:56
dale
Well, I'm mostly thankful not to have been missing something obvious about loop. Thanks folks.