freenode/#lisp - IRC Chatlog
Search
3:12:40
mfiano
"Once you've created a binding, you can do two things with it: get the current value and set it to a new value."
3:15:19
mfiano
I would advise against skimming. That book only really has value if you read it linearly and perform all of the practicals
3:19:30
nij
Here's the example what I meant by that the stumpwm macro "defcommand" might be leaking.. dunno why it's the case - https://bpa.st/JOXQ . It stays in the second argument of #'when, and it should not be evaluated. But it is...
3:23:23
Bike
are you sure you have the situation right? like, for example, could something else have defined the record! command?
3:23:44
nij
no.. it's pointing to that exact file. and when i add something, the indicating line changes accordingly.
3:24:49
Bike
well i don't know what to tell you. that is not how lisp works. the defcommand is not actually being evaluated.
3:25:00
Bike
also, the reason you're getting this error is that lisp tries to read the entire form before evaluating it
3:27:44
Bike
and yes, you could just say "the macro WHEN". to get the macro function you would do (macro-function 'when)
3:27:54
nij
Bike: if it's just READing.. then it should read RECORDING:PROMPT-RECORDING as a symbol, without issue, no?
3:28:28
Bike
because packages can use other packages, it is not clear what package a qualified symbol actually belongs to until the package is defined
3:28:53
nij
CL-USER> (when nil h:hiiii); Debugger entered on #<SB-INT:SIMPLE-READER-PACKAGE-ERROR "Package ~A does not exist." {1001A9BBD3}>
3:29:25
Bike
i don't know what's going on with the defcommand thing though. all i can guess is you have persistent state between trials messing things up.
3:30:24
Bike
you could do some annoying things with find-symbol, like (funcall (find-symbol "PROMPT-RECORDING" "RECORDING"))
3:30:40
Bike
then the symbol won't actually be looked up until the form is evaluated, so the reader won't complain
3:31:29
Bike
so i mean if you do the find-symbol thing, it will do what you're trying to do here, i think
3:32:54
Bike
so, if the quickload fails, the find-symbol will not be evaluated, so the symbol is not looked up, so there's no problem
3:34:04
nij
and if it succeeds, the find-symbol will return the right symbol, which will in turn be evaluated?
4:14:10
contrapunctus
I'm writing something dealing with vCard data, and it seems the only result for the only Lisp library for it is here. The link is dead and I can't find the project anywhere else :\ https://old.reddit.com/r/lisp/comments/qk3ag/clvcard_parsing_vcard_with_common_lisp/
4:57:43
fiddlerwoaroof
contrapunctus: I've recently used soiree ( https://github.com/slyrus/soiree ) for this sort of thing
4:58:41
fiddlerwoaroof
I ended up writing my own ics parser, though, because I wanted a streaming-style parser, rather than instantiating objects for the whole calendar in memory
5:01:20
fiddlerwoaroof
If you need to handle ics files only, I have this: https://github.com/fiddlerwoaroof/lisp-sandbox/blob/master/ical-parser.lisp
5:02:47
fiddlerwoaroof
I might actually have something more "production quality": this is in my experiments repo
5:05:53
fiddlerwoaroof
No docs yet (sorry), but this is an example of the protocol I've designed to process the stream of data from an iCalendar format file
5:06:52
fiddlerwoaroof
I also have a version that generates an sqlite db because I really like https://datasette.io for data exploration
6:40:37
contrapunctus
Shinmera: I figured I'd at least update the licenses for your projects on awesome-cl - and there are so many! Talk about prolific 🤯
7:03:49
fiddlerwoaroof
Although, I think your library is the inverse of mine: I only support parsing ics, you only seem to support generating it
7:05:27
fiddlerwoaroof
I consulted the RFC for mine, but I didn't implement everything: I implemented what was necessary to parse my work calendar and a couple random calendars I found online
7:07:04
Shinmera
iclendar has the advantage that it actually defines all types and relations in code already, so it could become a strict parser at some point.
7:07:12
contrapunctus
Shinmera: some clarification - `deploy` still seems to be Artistic License - is this deliberate? Also, qtools is zlib, correct? For some reason GitHub doesn't seem to recognize it in that specific case.
7:41:04
lukego
I was just starting to spell out my current problem but I think I arrived at the solution - or at least a next step - in mid-sorrow :)
7:41:31
fiddlerwoaroof
Although, I sort of think I prefer my old way of manually building sbcl and putting it in ~/sbcl
7:42:08
lukego
I made an overlay to tweak the flags that sbcl is built with and I'm going nuts trying to understand why this new sbcl isn't being used. but now I realize that the one that is being used is from my user environment. so I know where to look for a problem now
7:42:55
fiddlerwoaroof
Yeah, on my work laptop I use home-manager to manage all that, and just install from my overlay to the user environment
7:44:17
lukego
Nix has a lot of new features and workflows but I somehow keep using the ones from way back when I first installed it, when "nix pills" was the state of the art
7:45:39
fiddlerwoaroof
home-manager is pretty cool, you have a home.nix and it generates a lot of the dotfiles I used to manage in my dotfiles github repo. It also lets me pick which packages get installed in the user environment
7:46:31
lukego
I'm in a bit of a "lone hacker" mode. The nix expression for my Lisp program actually installs a lot of related stuff e.g. Emacs with a bunch of packages and their configurations.
7:47:28
fiddlerwoaroof
I find that I want all my dependency management to be initiated from the REPL, though
7:47:57
lukego
yeah interesting, having Lisp wear the pants and dump out nix expressions could be a nice style
7:48:13
fiddlerwoaroof
So, I only install sbcl through nix: when I absolutely need to pin versions, I use legit to clone the relevant repos and configure ASDF
7:50:10
lukego
I have a Nix expression with a list [ "1am" "alexandria" ... ] of all quicklisp packages that I want installed and then it arranges for them all to be built and ready when I start sbcl
7:52:10
fiddlerwoaroof
I'd rather be forced to fix my code when the deps update rather than slowly dig myself into a huge pit as the world moves away from me
7:54:19
splittist
What's my best bet for a quick something I can display (possibly elaborately) styled text on from lisp, on Windows 10?
7:54:59
lukego
fiddlerwoaroof: yeah. I regularly update to the latest of everything, i.e. refresh my nix distro from the latest quicklisp, but at least I decide when to do that and I can easily rollback if there's a problem that I'm not in the mood to debug.
7:58:31
fiddlerwoaroof
lukego: I've sort of been radicalized with the way I can just load and run 40 year old code in CL
7:58:37
splittist
Good point. And now I change the requirements: And interact with the text with keyboard and (probably) mouse.
7:59:19
fiddlerwoaroof
I think doing that from the browser is the goal of this: https://github.com/rabbibotton/clog
7:59:28
lukego
fiddlerwoaroof: I'm likewise radicalized by the old days when a "weekend of lisp hacking" would just mean getting a compatible set of dependencies from cvs :)
8:00:13
lukego
(but more genreally I basically stopped using dependencies of any kind many years ago, and then started again when I found nix and could police them. but I digress.)
8:05:24
lukego
Speaking of errors when rebuilding dependencies, I'm getting an error on compiling screamer now that I didn't have before, with two warnings and one error. I /think/ that the error is a -Werror kind of situation i.e. the compiler didn't find an error but asdf errored when it noticed the warnings (with a backtrace instead of an explanation.) plausible?
8:06:06
fiddlerwoaroof
lukego: line 75ff here is sort of my sketch of an in-cl way to do something nix-like: https://git.fiddlerwoaroof.com/u/edwlan/git-systems.git/blob/master/git-systems.lisp#L75
8:07:04
lukego
(and for all my talk of rolling back inconvenient breakages I can't actually do that because I didn't check-in my previous nix snapshots of quicklisp packages. so um a valuable learning experience about missed steps in my workflow)
8:07:45
Nilby
splittist: Unfortunately the bar for such a thing is very high now that it's expected to handle all the worlds languages and render super fast in a GPU.
8:08:22
fiddlerwoaroof
sbcl 2.1.3.71-f98bf1148 on arm64, http://beta.quicklisp.org/archive/screamer/2019-07-10/screamer-20190710-git.tgz
8:08:36
lukego
seems like asdf:*compile-file-failure-behaviour* default behavior on SBCL will error from ASDF if the compiler warns
8:09:29
fiddlerwoaroof
lukego: *compile-file-warnings-behaviour* I think is the equivalent to -Werror
8:09:44
lukego
hey it is actually kind of nice that -Werror is the default. that motivates me to actually dig into problems knowing that other people aren't just leaving them :). here's the screamer warning, I'll dig into it now https://gist.github.com/lukego/1da425f16384bb53f2c416c49d5b6ecd
8:09:47
splittist
Shinmera: I get "debugger invoked on a SB-KERNEL::UNDEFINED-ALIEN-FUNCTION-ERROR ... The alien function "sw_find_class" is undefined."
8:10:20
lukego
(though if I need to patch screamer that's a problem because my current nix workflow doesn't really support anything but upstream projects from quicklisp..)
8:12:43
fiddlerwoaroof
Is there a good library for extracting only interesting content from an HTML page
8:14:05
jackdaniel
it is written for a special-purpose implementations that represent vectors as lists :)
8:14:37
asarch
One stupid question: if I had this (:id 30 :username "asarch" :password "xxx-yyy") I could easily get the username with (getf user :username)
8:15:36
asarch
But what if I would have a list of lists with n elements ((:id 1 :username "foo" :password "...") (:id 2 :username "bar" :password "...") ... (:id n :username "baz" :password "...")), how could I easily get the username of the n element?
8:17:36
jackdaniel
if you store users on the list and you are not caching results (or add other optimizations) then yes, you traverse the list
8:18:43
splittist
Shinmera: doesn't qtools already :depends-on qt-libs? The error arises when trying to load the examples.
8:19:26
lukego
(I have to say, reading through the Screamer source once from top to bottom has not really enhanced my enthusiasm for using it)
8:20:37
White_Flame
since the FIND will return NIL on not found, it should all safely collapse to NIL even through the subsequent GETFs
8:21:15
jackdaniel
another solution (loop for user = (nth (random (length users)) users) when (eq (getf user :id) <your-id>) do (return (getf user :username))) ;-]
8:21:27
Shinmera
splittist: https://www.reddit.com/r/lisp/comments/b3a27e/qtools_the_alien_function_sw_find_class_is/
8:24:20
phoe
I had this qtools issue when installing/compiling from scratch; I usually install and compile it, close my image, quickload it again, and then it works
8:24:42
phoe
but this only manifests during the very very first installation so I rarely ever reproduce it
8:25:40
fiddlerwoaroof
Hmm, the USE-VALUE restart in slime seems to break everything when it's selected for a PACKAGE-DOES-NOT-EXIST error
8:27:16
fiddlerwoaroof
But, I put https://github.com/ruricolist/cl-boilerpipe into my local projects and then tried to load it
8:27:30
phoe
(handler-bind ((sb-ext:package-does-not-exist (lambda (c) (declare (ignore c)) (invoke-restart 'use-value :cl-user)))) (in-package :cl-ooser))
8:27:42
fiddlerwoaroof
it complained that the package OPTIMA wasn't found, so I hit 2 to attempt to trick it into using TRIVIA
8:31:17
lukego
dammit looks like I'll just disable -Werror in asdf because I don't really understand how to apply a patch to Screamer in my current setup
8:31:55
fiddlerwoaroof
lukego: you can always add a file to your project that does IN-PACKAGE and then redefines
8:32:27
fiddlerwoaroof
Here's the backtrace I'm seeing: https://fwoar.co/pastebin/8da8b90c5df10c1116aefccfe888fa7548ef79ce.nil.html
8:33:42
lukego
maybe the lowest hanging fruit here would be to somehow get quicklisp to apply patches during installation
8:35:00
fiddlerwoaroof
lukego: it's sort of a hack, but you could add a component that's like (:file "patches")
8:35:09
Shinmera
you can build your own quicklisp dist that has different versions of the libraries you want to patch.
8:35:27
lukego
fiddlerwoaroof: but I don't have a private copy of the source tree where the asd file is defined
8:36:01
lukego
I have a few local git checkouts too but I don't like that because it undermines my pinning and upgrading discpline. but okay that would be an acceptable workaround especially for screamer that's not updating rapidly
8:36:24
lukego
fiddlerwoaroof: my project's asd doesn't get loaded because its dependencies have failed to compile
8:37:19
lukego
I think that patches make sense to me. I'll be meaning to make a series of small temporary changes sparsely spread across various dependencies
8:38:09
fiddlerwoaroof
lukego: https://fwoar.co/pastebin/21e29c594ecc6cb4b7bd2cd57d6b31677c72c511.asd.html
8:38:43
lukego
fiddlerwoaroof: that looks neat but you still needed to patch the .asd file defining example
8:39:40
fiddlerwoaroof
Because it's a defsystem-depends-on, it'll be loaded before processing your project's dependencies
8:49:28
phoe
maybe it would be worth to fork screamers to sharplispers and apply the fix there, since it's trivial
8:54:29
scymtym
phoe: sounds good to me. for other projects he created or was involved in (esrap, alexandria), ownership has already been transferred. for esrap, he explicitly blessed the transfer
9:31:11
lukego
Maybe should also hack ASDF to print a user-facing message about upgrading errors to warnings, I found that very confusing
9:46:05
lukego
I know you all think I'm a bad person for using Serapeum's -> macro to declare function types in design-by-contract style, but I'm finding it really useful in practice, I do a bunch more type checking than I usually would and it catches sloppiness like carelessly returning multiple values
9:53:12
flip214
sbcl can infer return types by itself (at least sometimes), so declaring argument types already helps quite a lot
10:01:55
lukego
I'm declaring return types now and appreciating the compiler often telling me that I'm carelessly returning multiple values when I only mean to return one
10:04:31
White_Flame
(the fixnum (case foo (:a 1) (:b 2) (otherwise (call-error ...)))) will cause SBCL to scream, even though (otherwise (error ...)) is fine
10:07:24
Nilby
You never know when error could return: "the kinds of sweeping effects hinted at by this example"
10:09:10
phoe
(declaim (ftype (function () nil) foo)) (defun foo () (error "foo")) (defun bar (x) (the fixnum (case x (:a 1) (:b 2) (otherwise (foo)))))
10:11:59
phoe
(defun bar (x) (labels ((foo () (error "foo"))) (declare (ftype (function () nil) foo)) (the fixnum (case x (:a 1) (:b 2) (otherwise (foo))))))
10:14:07
White_Flame
it tells me that my (syntax-error (&rest rest) ..build error string... (error ...)) function has some wrong derived type, not my declared type
10:16:39
White_Flame
"Result is a (VALUES (OR NUMBER (MEMBER :TRUE :NULL :FALSE NIL)) &OPTIONAL), not a CHARACTER."
10:22:43
White_Flame
and of course a simple extraction of just syntax-error and a single use doesn't trip the error
10:24:13
flip214
If I move the (ERROR ...) out into another function (not even a LABELS) and use it in OTHERWISE, the result is the same
10:27:56
White_Flame
so the :true return value is leaking into the syntax-error derivation for some reason
10:30:04
flip214
White_Flame: the :TRUE is for (eq key :foo) - the error path doesn't return any value
10:30:49
White_Flame
the complaint is for get-num's usage, when read-something's definition is present
10:32:20
phoe
yes, that's invalid, SYNTAX-ERROR neither returns (member :true) nor is supposed to return a fixnum
10:54:00
edgar-rft
where (the fixnum ... (error ...)) IMO is a buggy type declaration, because (error ...) is defined to return *no* values and therefore cannot be a fixnum
10:55:38
flip214
edgar-rft: if it can't ever return, there cannot be a type conflict with the return value (because there is none)
10:58:19
ebrasca
What are Deprecated Functions? ( http://www.lispworks.com/documentation/HyperSpec/Body/01_ha.htm )
11:01:18
edgar-rft
ebrasca: functions that were marked as deprecated in 1994 but still exist in 2021
11:03:20
phoe
these two are highly distinct because a return type of (values) implies that the function is allowed to return at all in the general case
11:03:55
phoe
and you don't ever want #'ERROR (or #'INVOKE-DEBUGGER for the matter) to return at all
11:05:37
edgar-rft
ebrasca: don't worry too much, in a hypothetical CL 2.0 standard (that is unlikely to happen) there might be a dicussion about that :-)
11:23:18
no-defun-allowed
Lisp was so good they never made Lisp 2: <https://en.wikipedia.org/wiki/LISP_2>
11:31:47
no-defun-allowed
"Lisp 2" there refers to a hypothetical successor to the original Lisp (which never happened). Usually Lisp-n refers to the number of namespaces of things that the language manipulates.
11:32:22
no-defun-allowed
edgar-rft probably lost count of how many of such namespaces there are in Common Lisp, so wrote Lisp-n with a free variable.
11:32:47
phoe
there's also the fact that namespaces are user-definable, so n must be a free variable
11:35:52
no-defun-allowed
A crucial part of design-by-contract, where they are legally bound to certain terms and conditions of course.
11:41:41
phoe
but this works, (let ((x '())) (asdf:map-systems (lambda (y) (push (asdf:component-name y) x))) x)
11:48:21
phoe
Lycurgus: I am absolutely unaware of them and I cannot provide any reasoning beacuse of that
11:49:10
phoe
from what I last checked, used likely cost more because they are sold by shops that are not in Amazon's direct shipping reach
11:49:36
phoe
which is weird because apress ships worldwide, but on the other hand resellers still exist and make money
11:49:40
minion
ebrasca: tclcs: The Common Lisp Condition System, https://www.apress.com/us/book/9781484261330
11:52:46
Lycurgus
generally the kindle version is substantially less often less than half the hardcopy
12:19:49
nij
Good morning! I have a lisp file to be run automatically. However, on some machine I don't have certain package, so the symbol PACKAGE:FUN1 may cause an error even at READ time. A workaround is to use (funcall (find-symbol "fun1" "PACKAGE")) instead.. but that means I have to change all of PACKAGE:FUN1 to that long stuff.. is there any better workaround?
12:20:57
phoe
wait a second, if you don't have package named PACKAGE then FIND-SYMBOL will signal an error anyway
12:23:34
phoe
quick and dirty workaround: at the top of your file, (eval-always (ql:quickload :package))
12:26:15
nij
I have lots of package:fun1 in that file.. and changing them all to (find-symbol "fun1" "PACKAGE") seems a little bit dirty and ugly.
12:26:38
phoe
can you extract that into another file and only load it when the system in question is found?
12:28:12
nij
or should i write a macro that replaces any (package:fun1 body..) into (funcall (package:fun1 body..))?
12:29:10
daphnis
what is a way to avoid repetition in cond, when all tests are, say, whether the same value is a member of various lists?
12:34:15
phoe
try to replace the lambda with (alexandria:rcurry #'member :test #'equal) and watch the world burn.
12:39:39
phoe
https://gitlab.common-lisp.net/alexandria/alexandria/-/blob/master/alexandria-1/control-flow.lisp#L3-9
12:40:08
phoe
why would it do that instead of doing an explicit ONCE-ONLY on the test and then FUNCALLing it though?
12:42:05
phoe
in this case, alexandria:switch could be smart and only resolve to FUNCALL if the test is a list whose CAR is neither QUOTE nor FUNCTION
12:42:06
jackdaniel
that said this probably should be smarter, like: atom - return spec, cons and (quite function) - extract, just cons - evaluate
13:09:37
nij
Normally we have to go to emacs and `M-x sly-connect`.. but sometimes I want to hop into a server in a living repl.
13:13:28
Bike
i mean, it woudl be weird conceptually, right? it's not like an sbcl repl is a text editor
13:14:33
Alfr
nij, as a work around, you could securely forward the port swank/slynk listens on to a machine where you have emacs.
13:16:35
_death
in fact looks like someone already did some work https://github.com/lem-project/lem/blob/master/modes/lisp-mode/swank-protocol.lisp
13:16:36
Bike
you could set up your own socket code to do so, though i'm not immediately sure of the point
13:17:56
Bike
but the slime/swank protocol is set up for editors so a lot of it won't make sense where you have a repl instead of an editor
13:25:08
Bike
using an editor protocol for rpc seems like overkill to me. i guess it's easier than developing a smaller protocol and convincing people to implement it
13:26:03
phoe
it avoids the NIH syndrome - there is already a battle-tested protocol and a battle-tested server, so why not
13:27:14
jackdaniel
there was a clim implementation of this protocol (for climacs) - afair its name was "SWINE" ^_^
13:29:24
no-defun-allowed
Does it run in Wine? Then can I debug that combination from a lispm on EINE?
13:32:16
phoe
https://github.com/joaotavora/sly/blob/master/CONTRIBUTING.md#swank-is-now-called-slynk
14:26:47
attila_lendvai
any ASDF experts? i'd like to avoid perform'ing an operation if the output file exists (i.e. regardless of the modification time). any hints? overriding operation-done-p seems to be not enough.
14:33:04
flip214
sorry, I can only offer an opposite hint - if you want to rebuild always, (on linux) you can use a dependency like /proc/stat which is always "current"
14:34:25
attila_lendvai
flip214, my issue is that i don't know what part of ASDF i should hook into. op-done-p is not even called if the input file's mod time is earlier