freenode/lisp - IRC Chatlog
Search
17:52:10
rlp10
phoe: Thank you, that's really helpful. I guess it's the other way round from what I was expecting, but that makes no odds. I don't know why I was struggling to find it so much. Anyway, I appreciate your quick response - thanks.
17:53:42
aeth
phoe: shouldn't it be uiop:merge-pathnames* to fix portability issues between implementations?
17:55:19
rlp10
aeth: So is that what I should be using? Quite a bit of my scripting deals with folders, files, their contents etc.
17:57:25
aeth
rlp10: uiop/filesystem and uiop/pathname and uiop/configuration (and maybe a few other parts of uiop) may be able to help with some of your problems, but I'm not very familiar with the nuances because I rarely work with complicated file-based operations. Iirc, ASDF mostly uses UIOP for this.
17:58:03
aeth
rlp10: e.g. (uiop:xdg-config-home) should get you the correct parent directory of where you should put your configurations.
17:58:30
aeth
Well, on Linux (XDG) and on Windows (whatever Windows uses). It treats macOS like a Unix, rather than using macOS's custom conventions, so it might not be fully idiomatic there depending on what you're doing.
17:58:42
rlp10
OK, I have to confess that I'm new, so I don't fully understand what uiop and asdf are. I'd probably better start by reading their websites.
18:00:37
aeth
rlp10: Packages in CL are namespaces for symbols. Quicklisp is the "package" manager, but since the name "package" was taken, it's really the "system" manager. Systems are ASDF systems, and they basically are the standard library format in CL. ASDF fills a similar role to e.g. make. ASDF uses UIOP as its utility library, which means UIOP can be useful if you're dealing with files.
18:02:45
aeth
UIOP or CL-FAD should give you what you need, but since most people already have UIOP installed (because it's used by ASDF), the latter is probably more popular.
18:04:18
aeth
UIOP does a *ton* of extra stuff, but it's mostly used for its file/path/etc. functionality.
18:13:32
aeth
It's usually polite to stay within subdirectories of uiop:xdg-config-home or uiop:xdg-cache-home or uiop:xdg-data-home if reading/writing. If only reading, then asdf:system-source-directory will get you the directory of a system (i.e. library). I guess you start from cl:user-homedir-pathname if you want to read/write e.g. ~/Documents
18:37:42
aeth
ralt: yes, and then you can write something like this: (apply #'path-from-dir (funcall lookup-function) (append (if org-name (list org-name)) (list app-name)))
18:38:57
aeth
ralt: that should get you "professional" looking usage of ~/.local/share/ (or whatever the #'xdg-data-home happens to be configured as) where it's ~/.local/share/your-organization/your-app/ or ~/.local/share/your-app/
18:42:15
aeth
(In that case, #'path-from-dir is in turn just a trivial wrapper over uiop:merge-pathnames*)
19:05:37
aeth
ralt: doing (uiop:xdg-data-home #P"foo" #P"bar") I get ~/.local/share/bar rather than ~/.local/share/foo/bar
19:08:26
aeth
ralt: You also need to reverse the order, since the optional part (the parent directory) comes first.
19:09:19
aeth
What I mean is, you want to input "bar" "foo" or "bar" NIL and get #P"foo/" #P"bar/" or #P"bar/"
19:13:13
ralt
#p"foo" is a pathname that represents a file, so when you try to use it and don't get it as part of a folder... that's expected
19:14:05
aeth
ralt: This is slightly improved: (apply lookup-function (append (if org-name (list (uiop:make-pathname* :directory `(:relative ,org-name))) nil) (list (uiop:make-pathname* :directory `(:relative ,app-name)))))
19:18:50
aeth
i.e. (funcall lookup-function (make-pathname* :directory `(:relative ,@(if org-name (list org-name) nil) ,app-name)))
19:39:04
aeth
This should be simple enough... maybe I should move it to my utils: https://gitlab.com/zombie-raptor/zombie-raptor/-/blob/e50f8366e2ec24258a436fa8f4b2ec0f7627fc6e/data/data-path.lisp
1:05:18
charles`
Can someone help me understand ~/.cache/common-lisp/ ? Does that allow me to compile a system once, then next time I load it, asdf will just load the already compiled version?
1:20:32
charles`
So should I be able to use quicklisp to install a system, then restart lisp, then load using asdf without quicklisp or recompilation?
1:22:07
aeth
For the most part, Quicklisp is used because it will download something if it hasn't already been download it.
1:22:42
Xach
charles`: if you don't load quicklisp at all, it's possible that the directory it's found in is not known to asdf, and it won't necessarily load
1:26:54
charles`
Do I need to configure asdf to look at ~/.cache to find them? is ~/.cache an asdf thing or quicklisp thing. I can't find ~/.cache in asdf manual
1:29:45
aeth
It should be something along the lines of (uiop:merge-pathnames* #P"common-lisp/" (uiop:xdg-config-home))
1:31:51
charles`
If my compiled files are in cache, why does asdf still need quicklisp to find them? It can find the main project, but can't find the systems that were pulled in by quicklisp (but are still in cache)
1:32:39
aeth
charles`: My guess is Quicklisp adds some directories, like ~/quicklisp/local-projects/, that aren't default directories in ASDF.
1:33:57
Xach
Finding systems to load, and loading their cached compiled fasls, are very distinct operations.
1:35:31
Xach
charles`: yes, but there are exceptions there too, like monofasls. that gets into some territory i don't know much about.
1:37:09
Alfr
charles`, you'll likely also need to keep whole system around, e.g. sbcl will refuse to load fasls not output with the exact same build.
1:44:08
Alfr
charles`, you want monolithic-compile-bundle-op I think. You can also dump a (executable) image of a loaded system, if you prefer that.
2:21:03
dbotton
What is the term used in the Lisp world for an interface in lisp for a c api? In the Ada world we call it a binding for example a binding to the win32 api.
2:23:37
Alfr
dbotton, also called a foreign function interface, covering more than only functions though.
2:24:28
dbotton
Xach what is considered the appropriate level of stability for a project to be in quickslip?
2:25:11
Xach
i do not reject anything on quality or maturity or stability grounds. if you want it to be part of quicklisp, and it builds, it will very likely become part of quicklisp.
2:28:56
Xach
if it's really hard for me to install prerequisite foreign libraries that can be a stumbling block
2:30:23
dbotton
Since it is a "live" connection to a browser window (or a browser control say in an Xcode project on Mac etc)
2:32:46
dbotton
http://office.botton.com:8080 wrote a game demo I have up for the moment - all code is LISP not html or javascript
2:48:20
dbotton
A number of factors push Ada to just be a very very niche "product" so despite my love of the language that bought me here
3:14:38
dbotton
Working well in my tests so far, clog-connections is fairly decoupled, so should be easy to switch
3:30:27
dbotton
You should already with what is there in the CLOG project be able to write a Web App, use ecl to embedded in an Android app and iOS using a browser control, then use sbcl or another to take the same app and embed in an Xcode project, and MS new app whatever they call them this month, and a GTK app with a webkit window on Linux.
3:53:47
moon-child
if you just want everything in a vector: (with-open-file (fp fn :direction :input :if-does-not-exist :error :element-type '(unsigned-byte 8)) (let ((buf (make-array (file-length fp) :element-type '(unsigned-byte 8)))) (read-sequence buf fp) buf))
3:54:38
loke[m]
moon-child: What you said is correct, but the idea of using FILE-LENGTH to determine the amount of data to read is problematic.
4:00:43
moon-child
loke[m]: what's wrong with using file-length for that purpose? And what would be better?
4:02:25
loke[m]
You can use FILE-LENGTH to determine the initial size of the array, then make the array adjustable, and read until there is nothing else to read.
4:10:57
Oladon
In case anyone has lost the unlocking devices for their automobile, I just found them in my code. :)
5:07:15
asarch
I'm doing a small web server with Caveman2 in order to send files from my cellphone to my laptop, and in the POST request, the content of the file is a type of RAW-BODY: #<CIRCULAR-STREAMS:CIRCULAR-INPUT-STREAM {1007C409E3}>, how could I send it to a WRITE-SEQUENCE?
5:20:23
loke[m]
If you want to copy an input stream to an output stream, you can use UIOP:COPY-STREAM-TO-STREAM.