freenode/#lisp - IRC Chatlog
Search
8:23:23
splittist
I would like to use a Docker container to build an executable from a lisp project. There are many fine lisp images, but what's the best way to give the container access to the local projects (i.e. the components not in quicklisp) that are needed to create that executable?
8:29:01
lukego
splittist: Maybe docker's `-v` to bind-mount ~/quicklisp/local-projects from your master repos on the host? https://docs.docker.com/storage/bind-mounts/
8:31:21
lukego
new keyboard! I remember seeing your old one, it looked like the best one available on the market ;-)
8:32:36
lukego
Maybe `-v` isn't ideal really since that's more of a runtime rather than build-time thing. If you want `docker build` to do the whole job then maybe that doesn't work. I guess you could have your Dockerfile COPY stuff into the same location instead?
8:33:13
lukego
disclaimer: I've used Docker for various things but usually just cutting through the shortest path without necessarily knowing what is correct..
8:36:44
splittist
I sort of have this feeling I should be copying the local projects and letting quicklisp pull things into the container. Particularly since I have a locally-patched version of some things to make them work on my Windows dev machine and the container will be linux, of course.
12:50:29
splittist
My problem is that the executable is to use in a non-lisp project (<gasp!>), and I was hoping to use a multi-stage dockerfile to build the executable then COPY -from=lisp-building-container-thingy etc. But dockerfiles can't pick up context outside their root.
12:52:41
splittist
(I'm mangling the terminology, sorry.) So either I (a) copy the relevant local-projects into the non-lisp project; (b) develop them under this non-lisp project (but some of the lisp projects are general libraries, not limited to this use case); or (c) create my own quicklisp distribution ???
12:53:26
Xach
you don't need a distribution if you just want to get some code. it could be a tarball that you fetch and unpack.
12:55:19
splittist
OK. (It's just annoying that the files are sitting there in a sibling directory and I have to do something outside the dockerfile to get at them. I understand the reasons, but... I think I'm thinking about this the wrong way.)
15:22:41
dbotton
Working now on "thick" bindings with clog now - Working api for desktop environment in and now adding dialogs etc :)
15:42:55
splittist
So my solution is to create the lisp-builder with executable image separately. Only my dump-exe.lisp script, which runs fine from outside the container, and fine from inside the container, does not run from a RUN command in the Dockerfile.
16:15:41
flip214
Is there an equivalent of CHECK-TYPE that evaluates the type? So that I can pass in expected array sizes?
16:17:36
flip214
jackdaniel: well, I want to tell the compiler that the used indizes _must_ be in the array, so no bounds checks are necessary in a loop
16:20:21
jackdaniel
flip214: all I can think of is typecase with known sizes put in there and a generic otherwise clause
16:22:07
scymtym
flip214: do you want the code to still be safe? if not, (locally (declare (optimize (sb-c::insert-array-bounds-checks 0))) …) would be one (non-portable) option
16:24:12
flip214
scymtym: I'd like to still be safe... OTOH, if I check the input types beforehand, the arithmetic can't go wrong - so SAFETY 0 might be acceptable
16:24:43
jmercouris
(INTERN (SYMBOL-NAME INTERFACE) (PACKAGE-NAME (SYMBOL-PACKAGE INTERFACE))) is not a string designator.
16:25:08
flip214
well, I've got an (ASSERT (TYPEP input `(array fixnum (,size ,size)))) and (DOTIMES (i (1- size)) (DOTIMES (j (1- size)) ...))
16:27:23
scymtym
flip214: or compile specialized versions dynamically if jackdaniel's suggestion is impractical: (lambda (a) (let ((table (load-time-value (make-hash-table :test #'equal))) (dims (array-dimensions a))) (funcall (alexandria:ensure-gethash dims table (compile nil `(lambda (a) (declare (type (array t ,dims) a)) a))) a))) (not thread-safe)
16:32:02
contrapunctus
Anyone know why SLIME autodoc might work correctly for a local image, but stop working over SSH?
16:33:30
prxq
contrapunctus: what exactly do you mean 'over SSH'? You log in via SSH remotely? Or are u using swank?
16:33:52
flip214
scymtym: well, I'd like to tell the compiler that the array is a specific size; and DOTIMES won't go over the limit (that should be known already)
16:39:48
contrapunctus
prxq, jackdaniel: oh, I was following the steps here - https://common-lisp.net/project/slime/doc/html/Connecting-to-a-remote-lisp.html but now that I think about it, I can't remember if I did the path translation thing. I'll take a look at that.
16:44:46
flip214
even (DOTIMES (i (array-dimension input 0)) ...) doesn't help.... what am I doing wrong?
16:56:53
Nilby
although I guess, like the case in the paste, sometimes it's obvious it's not displaces, fill-pointered, or adjusted
17:52:10
scymtym
flip214: as bike said, to generate optimized array accesses, SBCL must infer the simpleness of the array, the array element type (even if t) and the array dimensions. i'm certain that it can't do that based on a dynamically constructed TYPEP assertion. however, if you write something like (dotimes (i (array-dimension a 0)) …), SBCL can infer a constraint between I and A so that accesses in the body will not require a bounds
17:54:49
scymtym
here is a small example that shows the constraint: https://techfak.de/~jmoringe/sbcl-infer-array-in-bounds.png
18:42:06
flip214
scymtym: Bike: https://paste.debian.net/hidden/0601d838/ has simple-array in the assert, and uses array-dimension - still, there's a HAIR in the soup...
18:44:09
scymtym
flip214: 1) what is MATRIX? 2) as i said, i don't think the (assert (typep …)) with a dynamically constructed type specifier allows inferring anything
18:46:25
scymtym
also, speed 3 with safety 0 will elide the bounds irregardless of type inference and constraints
18:47:45
scymtym
(compile nil (lambda () …)) (as opposed to (compile nil '(lambda () …))) does not usually compile
19:18:00
nij
Any more interesting examples that make use of monads, as in https://common-lisp.net/project/cl-monad-macros/monad-macros.htm ?
19:19:10
_death
https://8c6794b6.github.io/posts/Delimited-continuations-with-monadic-functions-in-Common-Lisp.html