freenode/#lisp - IRC Chatlog
Search
0:58:39
frodef
w-s-restart often does the trick, but sometimes restart-case or even restart-bind is the way to go.
0:59:52
charles`
and what if I want to use my custom ones with the default continue, should I nest them?
1:06:31
frodef
The function CONTINUE will go to the innermost restart called continue. But any decent interactive debugger will let you chose which exact restart (inner or outer) you want.
1:07:53
frodef
programmatically, see COMPUTE-RESTARTS. You can invoke any one of them, regardless of what they are named.
1:12:43
frodef
The magic is just in the framework, or the ideas behind it. Having proper restarts available can make or a beautiful system.
1:14:19
frodef
Usually RESTART-CASE, but RESTART-BIND if your restart would benefit from the dynamic context of the error.
1:16:30
frodef
These are really some of the most profoundly and uniquely beautiful corners of CL, IHMO.
4:00:05
sauvin
Ubuntu installed a pile of cl-* files when I installed Common Lisp but I have no idea how to load or use them. Figuring out how to use them is my problem, but could anybody help me with using them and/or with a package manager? Quicklisp doesn't seem to like gcl.
4:03:00
no-defun-allowed
I don't know how to use the Ubuntu (or Debian) packages (though you could always try locate to find them), but you probably don't want to use GCL these days.
4:03:14
contrapunctus
sauvin: by 'installed Common Lisp' do you mean installed gcl? What did gcl say that makes you think that Quicklisp doesn't like it?
4:03:42
aeth
I'm not an Ubuntu expert, but you generally don't use the distro packages for languages that have their own package manager. They're mostly for dependencies of things that the distro ships, like e.g. Maxima.
4:04:13
no-defun-allowed
Oh, looking at the file listings, they are stored in /usr/share/common-lisp/source/ but I don't know what you do with them. If you installed ASDF from the package manager, it might know to search there for systems, or it might not.
4:04:15
aeth
If GCL isn't complete enough to run Quicklisp, it probably can't run any of the libraries, either. e.g. I think its CLOS is incomplete.
4:05:44
sauvin
contrapunctus, it won't load the quicklisp.quicklisp in /usr/share/..../quicklisp, complaining about ASDF.
4:06:52
sauvin
aeth, what you're saying is familiar to a perl person. I'll take the risk, but I'd really like to check out this pile of cl-* files that Ubuntu put on the hard drive but I'm at a loss for loading.
4:08:53
sauvin
If this stupid thing vexes me much longer, I'm gonna say "screw you" and start using sbcl.
4:09:34
sauvin
I _usually_ like gnu stuff and don't know enough about lisp - ANY recent implimentation - to make anything like an informed choice.
4:09:46
aeth
I'm under the impression, perhaps mistaken, that GCL was never completed. Even CLISP is a more mature GNU CL, but CLISP hasn't had a release in 10 years.
4:10:14
aeth
But generally people use SBCL, CCL, or ECL, I think. A bit of ABCL (on the JVM) in here.
4:10:49
contrapunctus
sauvin: this guided me in my choices as a newcomer to the CL world, hope it helps you too - https://github.com/emacs-tw/awesome-emacs
4:12:10
benjamindc
does anyone know why the asdf package-inferred-system class doesn't work with pathname?
4:12:23
aeth
GNU has two CLs (CLISP and GCL) and maybe 3-4 Schemes (Guile, Kawa, MIT/GNU, and I'm sure they have another one or two hiding because Schemes are common)...
4:13:04
aeth
but unfortunately, neither of the CLs are that active. CLISP's last release was 10 years ago. GCL's was 6. Meanwhile, SBCL's on a monthly release cycle.
4:14:09
sauvin
Everything you're telling me, though, suggests I oughta spend a few minutes rethinking my cathexis to gcl.
4:14:43
no-defun-allowed
How fast can you say "Eh, maybe not then?" You need about that long to make a decision.
4:16:27
beach
sauvin: I don't know what it means to be a "Perl guy" or any "<tool> guy". You should learn the tools that will make you the most productive. It is not personal.
4:17:16
sauvin
I didn't take it as a personal affront, but one also uses what one knows, especially since this is strictly armchair stuff. My day job is "forklift driver".
4:18:14
aeth
sauvin: I don't remember where I saw the original, but I made a few modifications iirc...
4:18:34
beach
sauvin: That is the wrong attitude. If one always uses what one knows, then one will never learn anything new.
4:18:53
aeth
sauvin: But I just use the rlwrapped SBCL as a fallback. It's no replacement for SLIME.
4:19:25
sauvin
Probably not, but I think I'll learn a few things about the language itself before simultaneously wrestling with an unfamiliar editor.
4:20:13
aeth
sauvin: but if you absolutely need built-in readline, then CLISP will probably be a bit less painful than GCL, although it's increasingly common not to support it with libraries
4:20:15
sauvin
On the subject of which, is there a way to use emacs lisp without also having to use emacs itself? O:)
4:21:04
aeth
sauvin: Common Lisp is close enough to Emacs Lisp that there's not much of a need to use it outside of Emacs, although there is an implementation of it in CL iirc.
4:21:30
beach
sauvin: Stepping out of one's comfort zone is part of the learning experience. The more uncomfortable one feels, the faster the learning.
4:21:56
beach
sauvin: GCL is lagging because nobody is working on it. Nobody is paid to do this stuff.
4:22:02
sauvin
Oh, I know this, but I'm an older fella; sometimes, learning too fast isn't very wise.
4:23:06
beach
sauvin: Volunteers. Convinced by the argument of what's-his-name-again who forked it off of CMUCL.
4:23:21
aeth
At least 24 financial contributors, too. https://fundrazr.com/61kPgb?ref=ab_44p9NqQUZKv44p9NqQUZKv
4:24:09
beach
sauvin: CMUCL used to be the fastest free Common Lisp implementation, but it was a mess to build. So this guy forked the code and turned it into SBCL. And some smart and knowledgeable people were convinced.
4:24:53
sauvin
Then maybe the stuff I'd been reading is dated. I didn't pay attention. A couple of online books roasted sbcl as being sub-par and strongly preferred gcl. Didn't understand all the arguments and don't remember most of them.
4:25:44
aeth
circa 2008-2010, a lot of people preferred CLISP to SBCL, but then... CLISP didn't get a release in 10 years and started bitrotting. It's also a slow interpreter rather than a fast compiler.
4:26:01
aeth
the good thing about CL is that if you write portable-enough code, it's not too hard to move to whatever's trendy
4:30:54
sauvin
Right there with ya, pal. I'm a boomer who can't get used to the idea of not being 17 anymore.
4:32:06
sauvin
Oh, wait, I might be misreading. The version field from the dpkg listing is 2:2.0.1-3
4:32:18
aeth
CMUCL, which SBCL forked from, started in "the early 1980s". https://www.cons.org/cmucl/credits.html
4:32:36
aeth
I wouldn't be surprised if there's a 1970s (or older?) CL if it started as some other Lisp first.
4:33:02
aeth
The first copyright in ECL is 1984... https://gitlab.com/embeddable-common-lisp/ecl/-/blob/develop/LICENSE
4:33:14
sauvin
I can't remember, seems like there was a Kyoto Lisp when I was still swearing at a 286.
4:33:51
aeth
Looks like GCL, ECL, and MKCL are all descended from it. https://en.wikipedia.org/wiki/Kyoto_Common_Lisp
4:37:06
benjamindc
Does anyone have experience with ASDF package-inferred-system and the :pathname option for defsystem? I'm having an issue where my test system isn't finding packages defined in "test/" even though I've got pathname set.
4:38:24
oni-on-ion
not sure why this is redacted: https://www.infoq.com/news/2009/04/Lisp-Guy-Steele-Richard-Gabriel/
4:39:14
aeth
benjamindc: if you have a foo/test, then make a test.lisp at the top level that contains a package
4:39:21
aeth
benjamindc: https://gitlab.com/zombie-raptor/zombie-raptor/-/blob/2316d43b3a9f9a98325e45fa891b1845e055a5da/tests.lisp
4:39:39
aeth
benjamindc: https://gitlab.com/zombie-raptor/zombie-raptor/-/blob/2316d43b3a9f9a98325e45fa891b1845e055a5da/zombie-raptor.asd#L31
4:40:53
beach
I still don't know what problem package-inferred systems are supposed to solve. They seem to make everything harder.
4:41:27
aeth
jackdaniel: hmm, that history diagram in beach's link doesn't look that good to me... I think it might just be me. I have a dark UI, so it's probably automatically putting it in dark mode in Firefox.
4:41:54
aeth
I switched browsers to Chromium (which doesn't use the host's UI, and so uses a light UI, and so doesn't request dark mode CSS) and it's a white background and looks fine
4:43:00
aeth
yeah, it's because the image has a transparent background which doesn't go with dark mode, which is automatically selected
4:43:40
sauvin
OK, well, dudes, thank you very much for your time. We'll find out if sbcl gives me any less grief than gcl does.
4:44:36
aeth
beach: Whether or not package inferred systems are useful really depends on the problem. I definitely wouldn't use it for every repository, but it seems more useful than not in my game engine.
4:45:01
oni-on-ion
with FIrefox i've got to often switch on/off dark mode for sites that break with it on
4:45:39
beach
I still don't know what problem they are supposed to solve. But we have been through this before, and all you could come up with to solve the problems they introduce were more unnecessary complications.
4:47:11
beach
benjamindc: Each "module" is in one directory, has one (or two) .asdf file(s), and one (or two) packages.lisp file(s).
4:47:18
Nilby
beach: But would you say that automatic dependencies that worked well, would not be desirable?
4:47:23
aeth
beach: It makes every file into a system, which means that any file with the same name of a directory also becomes a system, so as a whole it does reduce boilerplate for certain kinds of projects, but it only really works with some of them, not all of them.
4:47:46
aeth
Something similar, but with directories instead of files (and the more idiomatic package.lisp in each directory) would probably work more generally.
4:48:53
aeth
beach: it parses the defpackage. If you use prefixes, you have it in an IMPORT-FROM with nothing other than the package name iirc. Otherwise, USE (not recommended in most cases) or manually IMPORT-FROM various symbols.
4:48:58
beach
aeth: Yes, as I said, we have been through this before, and all it would do for me would be to have each file be huge. And you came up with various fixes for that problem that made everything even more complicated.
4:49:24
aeth
Nilby: No, I think it's literally just (:import-from #:alexandria) and now it knows you're using (alexandria:foo)
4:50:08
aeth
beach: it's definitely not for every project, I don't use it in my Scheme-in-CL project
4:50:51
benjamindc
beach, do you have an example of what you mean that I can check out on gitlab or github?
4:51:37
aeth
benjamindc: Idiomatic CL is structured so that there's either a top level package.lisp or a bunch of subdirectories, each with one package.lisp
4:53:04
benjamindc
I'm coming to CL from Clojure and I like the one package per file style as it somewhat maps to clojure's namespaces. But if that's not idiomatic, when I should reasses.
4:53:19
beach
I think it's a silly idea. I mean, setting up a "module" is (or should be) a tiny fraction of the total amount of work on the real code of the module. And if instead package-inferred systems make the code for the module huge and unmanageable, then what's the point?
4:56:28
no-defun-allowed
I have files that average 40LOC or so; should I make a package for each of them?
4:56:59
Nilby
aeth: Some very useful things are impossible in the general case. I don't see it as a problem.
4:57:01
no-defun-allowed
And how do I export symbols from each file, in a way that lets me use symbols inside my "modules", but without the user being able to use them?
4:57:37
no-defun-allowed
There are a fair few things that I need to use between files, which a user could easily use to break the state of the system.
4:58:31
aeth
no-defun-allowed: Well, I mean, for one, I have a file with 5 lines of code, 4 being the defpackage, in one of my projects that doesn't use package-inferred-system. https://gitlab.com/mbabich/airship-scheme/-/blob/master/scheme-boolean.lisp
4:58:33
beach
no-defun-allowed: And I think the answer is that one has to put all the code of the module in one huge file.
4:59:25
aeth
no-defun-allowed: Another thing is, you have no real privacy that's not privacy-by-convention in Common Lisp outside of lexical closures. So you change the expectations of certain packages. That is, you have to have "internal" packages that if the user uses directly, you don't guarantee a stable interface.
4:59:42
no-defun-allowed
beach: It reminds me of when the Java teacher at university told us how having a class Class being in a file Class.java was a good idea. Sure, I know that the definition of stuff in that Class is in that file, but now I just have to find the method I want in a 3kLOC file.
5:00:46
no-defun-allowed
aeth: If you use internal symbols, you're on your own. There are only a few ways you can break my system from exported symbols, which are mutating sequences I can only tell you that you shouldn't mutate.
5:01:11
aeth
no-defun-allowed: And if you use a package in package-inferred-system that's clearly for use by other packages rather than the user, then you're also on your own.
5:01:29
no-defun-allowed
At one point, I wished you could pass out immutable "mirrors" of objects somehow, but it would have to be transitive, and it got too messy in my head.
5:01:40
aeth
Package-inferred-system encourages "internal" packages more than other styles, but that's an issue that can come up in other places.
5:02:41
no-defun-allowed
On the other hand, I have one package with like 100 symbols, and that feels a bit big (here we go again with the disbelief that I wrote 10,000 lines of code and all). But then I remember CLIM defines about a magnitude more symbols, and I don't feel so bad.
5:03:59
aeth
no-defun-allowed: It really depends on the domain you're doing. Java treats everything like it's a big, important project that's full of complexity and importance. Most projects aren't like that. trivial-left-pad doesn't need package-inferred-system.
5:04:32
aeth
But sometimes, you do a project where that sort of organization makes sense. Where there are a *ton* of files, and they all really need their own package because they do their own thing. E.g. I have a file that deals with SDL2. A file. Nothing else needs to know that SDL2 even exists.
5:05:26
no-defun-allowed
I try to do "one file per concept", which leads to a somewhat pleasing LOC distribution.
5:06:12
no-defun-allowed
Yeah, the damned filesystem makes organising code a fair bit harder than it should be.
5:06:56
aeth
Well, files are somewhat useful. If you write a bunch of macros with their own functions, and those functions are elaborate, then you probably want those functions to be in another file so you don't have to wrap them in a gigantic, hundreds-of-lines-long EVAL-WHEN.
5:07:40
jeosol
aeth: I had a conversion with Fare when I was trying to understand the use of :package-inferred-system for a code base. His article seems to suggested it helps compilation for large code bases but I never did a test to verify
5:08:17
aeth
jeosol: It definitely helps CI for very large systems because not everything needs to be tested in the CI. e.g. all of the FFI stuff, if cleanly separated, doesn't need to be loaded.
5:08:18
no-defun-allowed
ACTION uploaded an image: loc-distribution-function.png (41KiB) < https://matrix.org/_matrix/media/r0/download/matrix.org/LxrkPifVjClIzILMEKUPbWgl/loc-distribution-function.png >
5:08:23
jeosol
I remember I used it in my code base, but like beach said, it can be difficult to work with sometimes, as in some cases, you'd then define another package.lisp file to aggregate everything later on
5:08:31
no-defun-allowed
For reference, I graphed the cumulative distribution functions of my largest two codebases.
5:10:34
aeth
no-defun-allowed: I tend to prefer 300-1000 lines, but I also have a lot of extremely tiny files, too. Lots of special cases exist as real outliers, too, e.g. tests, which can be 7 lines or infinite.
5:11:16
pyc
Follow up question on our discussion on the importance of backward compatibility in the CL community. How did this breakage happen? "Doesn't work with the current version of Hunchentoot anymore!"
5:12:29
jeosol
aeth: I do have some 1000 loc files. Sometimes I want to break them but it will be more of a hassle as related functions are not together then.
5:14:20
jeosol
ok, let me see if I can pull it up. For context, I had a large system and I was running into issues where I wanted things to load faster and Fare suggested to look into that, and also some and to look at the dependency graph
5:16:02
jeosol
benjamindc: http://fare.tunes.org/files/asdf3/asdf3-2014.html#%28part._asdf-package-system%29
5:16:55
jeosol
The second to last paragraph is the statement about "scaling" but I never verified this
5:20:24
aeth
I do notice that zombie-raptor loads faster than airship-scheme when it's not a from scratch load (so not e.g. a new version of SBCL)
5:24:19
jeosol
I looked at your zombie-raptor link I realized I did something similar, have the separate files, then aggregate with a common package and use-reexport later.
5:25:26
aeth
The only reason I spun off zr-utils is because it would be strange for airship-scheme to either (1) depend on a game engine or (2) actually be hosted in a game engine monorepo
5:26:26
aeth
I'm taking a bit of a break from it now that the reader, which took longer than I had expected, is done
5:26:43
benjamindc
I just keep getting this error when trying to run (asdf:test-system "ramsay") even though the file lexer.lisp is in the test dir. Component "ramsay/test/lexer" not found, required by #<PACKAGE-INFERRED-SYSTEM "ramsay/test">
5:27:04
aeth
I do multiple projects so I can cycle between them when there's a good breaking point so I don't burn out of them
5:27:23
no-defun-allowed
Most of the time, I reload with C-c C-c; only reloading when I replace a macro or something more invasive.
5:28:21
aeth
no-defun-allowed: I'm talking about QL:QUICKLOAD, though. When you have a large project, you could go months without touching 80% of it, and unless you touched the core stuff that everything else depends on, that means you can go months without compiling almost 80% of it... unless you update SBCL monthly.
5:29:45
no-defun-allowed
If I had said "system" or "module" or something, and it was true, then I'd wonder how long (ql:register-local-projects) would take, when scanning SICL takes a good 20 seconds.
5:30:43
jeosol
aeth: 1024 lines is not bad. I once had a component, 3d graphical ray tracing, took me a month to complete for a challenge (circa 2017) - early days. The guys over at comp.lang.lisp helped a lot
5:32:05
jeosol
aeth: I have to work on something with python pandas last few days, dealing with python version hell drove me mad. I wished I could have used some CL library for the data manipulation piece
5:37:23
aeth
jeosol: for me what bothers me with that sort of thing is Jupyter... Everything will be fine until I need to run it again because of the implicit state in the out-of-order evaluation of the cells that I did while programming it.
5:37:38
aeth
That and it's frustratingly missing certain features like a spellchecker or an integrated linter (and you need a linter when you run Python)
5:38:22
no-defun-allowed
Hypothetically, you could use the reads and writes each cell makes to topologically sort them, but that requires hooks in places no real Common Lisp implementation gives you.
5:39:29
aeth
Something based in CL probably could implement a similar literate-programming thing in a smarter way than Jupyter (since CL already expects things to be redefined constantly), where it would make sure that running it from start-to-finish still produces the current results or something.
5:40:33
jeosol
i guess the cl-jupyter is the same issue right? I followed a clml tutorial. It's probably just to show things I suppose, I also tried to use VS code for it. The workflow is certainly not easy
5:40:57
jeosol
The problem with the project if implemented in CL, is that client may complain that they don't understand it if they need to take it over
6:50:07
solideogloria[m]
Why does `cl-json` parse the string "!BFYazLCNOAsYDPxIDn:matrix.org" as the symbol !+BF+-YAZ-+LCNO+-AS-+YD+-PX-I-DN:MATRIX.ORG
6:51:50
no-defun-allowed
cl-json only interns keys, from memory. But if you're using it to parse Matrix events, then the number of keys isn't finite, so you probably want to use another library, like jsown.
6:52:13
no-defun-allowed
But some parsers treat a key a:b as the symbol printed as a:b; I think there was also another XML parser that did that.
6:55:43
saturn2
you can override that by binding json:*json-identifier-name-to-lisp* and json:*identifier-name-to-key* to #'identity
7:01:13
loke[m]
It uses strings as keys, which is better (no risk of intern attacks with untrusted data).
7:07:44
jackdaniel
beach: this image is more complete https://common-lisp.net/project/ecl/static/quarterly/img/vol4/all-hierarchy.png
8:55:14
beach
And if you are not restricted to SBCL, in SICL, I store the entire source text of all the code that has been loaded into the image.
8:56:07
oni-on-ion
no-defun-allowed, i wonder what an 'empty' session would have as live objects? aside from classes, packages, symbols etc.
8:56:07
beach
oni-on-ion: I use the source text for reporting errors and warnings, and for backtraces.
8:57:20
beach
oni-on-ion: Methods and generic functions are objects, and there may be data structures involved for organizing those. Most certainly, you have hash tables in your package objects and such.
8:58:13
oni-on-ion
beach, hmm yes i see. have you played around with Squeak at all? having the source in the image allows for some very useful things. like ChangeSet
8:59:12
beach
I have not used Squeak, but my experience from staring at compiler output from SBCL and trying to match it to source code made me think about other ways of doing it.
8:59:41
oni-on-ion
beach, ahh, never had thought of CLOS. i mistakenly think it is bare knuckles, i had been accustomed to the seperation of FoundationKit and AppKit from other lands
9:00:37
beach
Common Lisp being a dynamic language, lots of stuff must be kept track of to allow for incremental updates to the image.
9:02:22
no-defun-allowed
100 megabits? After compression, a SBCL image is about 100 megabits on disk.
9:03:12
no-defun-allowed
(save-lisp-and-die "foo" :executable t :compression 9) gives me a 96 megabit image.
9:04:19
no-defun-allowed
oni-on-ion: After making sure not to load Quicklisp, (room) tells me I'm using about 25MB of dynamic space, and 12.8MB of immobile space. The rest is negligible.
9:09:39
Nilby
When you compare the size of a CL image to most other program binaries, make sure to add the size of most shared libraries, the compiler tool chain, and the debugger.
9:10:38
no-defun-allowed
No need - appimages and Electron programs blow most CL images out of the water in terms of size.
9:35:28
sauvin
I poked around the nets for a while looking at all kinds of different things regarding lisp, then remembered I wanted quicklisp, so, I fired up sbcl, loaded the quicklisp.lisp file and it just took right off. Slicker than CPAN.
9:37:38
sauvin
I think so. A beginner doesn't need to have to try to wrestle with the language implimentation while he's still trying to figure out how to say "sub stuff { 3.14159 * 2**$_[0]}" or "sub chunk { [ split ] }"
9:40:25
sauvin
I've been perling (strictly on an armchair basis, mind) for about twenty years. Lisp gonna be a new way to think.
9:41:31
saturn2
(defun stuff (x) (* 3.14159 (expt 2 x)) the other one doesn't quite have a direct equivalent
9:42:04
no-defun-allowed
"a new way to think" is the wrong way to approach it, in my opinion. Writing in Lisp is frequently "the way I wanted to think about it", except for the times in which it isn't, but those times are much less frequent.
9:42:06
sauvin
Direct, maybe not, but it's what got me wanting libraries to begin with. I didn't want to have to come up with a BASIC-like equivalent.
9:44:53
VincentVega
so far i just do (... &key (w nil) (width nil)) and check for mutual exclusivity but it's a runtime check
9:48:08
saturn2
you could write your own object making function with a compiler macro for the compile time check
9:50:21
Nilby
Probably emacs w/SLY/SIME, vim w/VLIME or something, vs code with some lisp extension, etc. but I don't know since I use my own thing.
9:50:35
no-defun-allowed
For geometric objects, w, h, x and y can be assumed to be width, height, X and Y positions, but it's usually nicer to use full names when someone else is supposed to look at a lambda-list and guess what they can call your functions with.
9:52:00
no-defun-allowed
That was a recurring theme in a funny Usenet thread I read, in which the verbosity of many Common Lisp libraries is supposed to be a problem (as it apparently is bad for "scripting").
9:53:22
no-defun-allowed
If you write (make-instance 'some-class, then SLIME will pop up with a lambda list like (&key this-initarg that-initarg ...) ;; and because unbalanced parens tick me off )
9:58:04
no-defun-allowed
Here, I have to press C-M-i (or ESC TAB or M-TAB, whatever floats your boat) to complete, unless I'm in the REPL, as TAB indents.
9:58:48
Nilby
Alfr_: I just tried it with no configuration on emacs 25.2 and slime 2.26 from melpa. But I'm probably not the person to ask, since I don't use it. SLIME doesn't come close to working on my real configuration.
10:04:04
Alfr_
Nilby, after removing slime-fuzzy-complete-symbol from slime-completion-at-point-functions it works here as well. Thank you. :)
10:09:58
Nilby
Alfr_: Nice! I've saved myself many hours of pointless work by always trying stuff in a clean setup first.
10:13:14
Alfr_
For that one has to know how it's supposed to work in the first place and until you mentioned it, I didn't.
10:15:36
Nilby
I usually just think what I want it to do, and figure somebody must have already done it.
10:19:51
Nilby
When I used to work on emacs the philosophy was, most of your code that isn't docstring should be written by <tab> completion. Snippets really help with that too.