freenode/lisp - IRC Chatlog
Search
20:23:39
_death
you could do something yucky like (format t "~A~3,'0D" (if (minusp x) "-" "") (abs x))
20:24:50
jasom
_death: that gives the behavior like C's "%.3d" but still not like C's "%03d" (the former prints 3 digits, the later 3 characters)
20:31:13
Krystof
do you have a compiler macro to turn constant-printf-string printfs into constant-format-string format controls?
21:00:57
lotuseater
i learned today for what SYMBOL-MACROLET not to use :) had often something like (aref e k) in a function with even SETF and thought, oh hm, so use (symbol-macrolet ((e_k '(aref e k))) ...)
21:12:55
lotuseater
but hm, the other thing was, translating an algorithm with three closures and that use same parameter names as declared for lexical scope in the main algorithm ^^ how does FLET handle that?
21:14:05
lotuseater
being more concrete, it was this: https://en.wikipedia.org/wiki/Jacobi_eigenvalue_algorithm#Algorithm
21:17:01
_death
not sure what you're asking.. this pseudocode looks like it could use some factoring.. I'd start by pulling those functions out
21:20:54
Shinmera
Or just use one of a bunch of matrix libraries that can already compute eigenvalues
22:08:41
ioa
Hi everyone, if you're interested in talking about the ELS, SAL9000 made a room for it: #elsconf
22:09:37
ioa
Especially the presence of marco heisig (no bouncer? I forgot his nick), easye and phoe would be very much appreciated, as they have all the info. :)
22:11:04
ioa
phoe, oh, I didn't know about #els2021, there was a discussion about this years els in the old room els2020, and SAL9000 made elsconf so we don't create a room every year.
22:12:02
phoe
sure, sounds good! let's discuss the channel setup when everyone (including me) is awake tomorrow
0:38:25
nij
>> Weird.. in my stumpwm config, I have (when (ignore-errors (ql:quickload :some-package)) (progn (defcommand ..)))
0:39:01
nij
When :some-package is not presented, (defcommand) was still evaluated, leading to an error.
0:41:18
nij
The package :some-package was not presented, so (progn..) shouldn't be evaluated (indeed, TEST wasn't set to 123). However, (defcommand..) was evaluated and led to another error.
1:03:37
jasom
is it possible to sign-extend a number, given a desired bitwidth? i.e. treat a positive number as being the unsigned representation of a twos-complement value?
1:09:34
jasom
moon-child: or just < without the 1-, but then you'd have a bignum at machine-word sizes
1:10:09
moon-child
there's nothing as far as I know. Txr has it apparently https://www.nongnu.org/txr/txr-manpage.html#N-026F9F46
1:23:17
jasom
Here's what I had, FWIW: (defun foo (x width) (if (logbitp (1- width) x) (- x (ash 1 width)) x))
1:26:04
jasom
though on reflection, this is probably clearer: (defun foo (x width) (if (logbitp (1- width) x) (dpb x (byte width 0) -1) x))
1:26:50
mfiano
I'd be impressed if you can do this more efficiently. stassats helped me write that years ago
1:27:40
jasom
ah, uses a multiply to avoid a branch. Probably a good call on any processor made in the last 20 years or so
1:29:18
moon-child
(maybe a couple extra if you want to avoid a branch, but predictable branches are übercheap)
1:36:11
jasom
mfiano: yours is about 2x as fast on a quick benchmark despite being more instructions; not too surprising since the sign bit branch is completly random on my test-case
1:36:37
jasom
mfiano: I suspect mine would be faster if the test corpus was entirely positive or entirely negative
2:03:35
pagnol
Has anyone here used Postmodern a lot? I only recently found out about it and it seems like the ideal way to interface with a relational db to me, but I'm wondering if there are downsides that only become apparent after a while.
2:09:40
nij
Hello! I'm trying out qlot. In its official github repo, it says I can get it by (ql:quickload :qlot). But that doesn't seem to generate the binary `qlot` (for cli usage) directly. Did I miss any step? https://github.com/fukamachi/qlot
2:10:41
Bike
well, in the readme it mentions that the roswell install, introduces the shell command unlike the quicklisp install
2:11:14
Bike
i don't see any obvious explanation of how you get the shell command if installed via quicklisp
2:47:13
mfiano
If that works for you, fair enoguh. As for me, I wrote Common Lisp code, else I'd be using blub if I wrote code for one implementation
2:49:43
jasom
hmm, it looks much better in the assembly but is testing out as 50% slower. That's quite odd.
2:50:25
mfiano
the statistical profiler will likely be showing the foreign syscalls that slow it down.
2:57:22
jasom
the mask-signed-field version is too fast for me to measure with this benchmark (summing a list of integers vs summing it sign-extended differ by less than the noise)
3:11:28
remby
I was reading practical common lisp and it gave me the impression you could do this, but I misunderstood the example.
3:12:03
remby
right near the assignment header, what do you think they meant to say? http://www.gigamonkeys.com/book/variables.html
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.