freenode/#lisp - IRC Chatlog
Search
18:21:27
jasom
does SBCL have operations for efficiently calculating leading zeros or leading ones of a machine word?
18:27:16
jasom
(integer-length most-positive-fixnum) => 62, so given that there are negative fixnums, looks like 63
18:29:21
jasom
1 bit tag, 63 bits encode the number in twos complement; (integer-length #xff) => 8, but clearly if you can go up to 255 with signed values it's 9 bits twos complement
18:29:24
flip214
phoe: no, you were right first time... 1 tag, 1 sign, 62 significant for both positive and negative
18:30:26
flip214
the ol' compression trick - just remember where the 1 bits are, the 0 bits take care of themselves. applied recursively you end up with "1", which encompasses every possible meaning at once!
19:04:09
Shinmera
Heh, *exaggerated smug face* check this out: UAX-9 Total: 1'815'582 Passed: 1'815'582 (100%) Failed: 0 ( 0%)
19:05:43
_death
for proper TDD brag you need to show that each failed first, and that the previous ones succeeded
19:09:43
Shinmera
Anyway, in case it wasn't obvious, there are 2 million tests for UAX9, but they're all auto-generated from unicod conformance data. :)
19:11:07
aeth
put this in a macro and win the test war... (defun generate-tests (number-of-tests) (list* '5am:test 'lots-of-tests "Win the war of having the most tests" (loop :for i :from 0 :below number-of-tests :collect `(5am:is (= ,i ,i)))))
19:12:21
aeth
(generate-tests 2000000) ; oops, ran out of memory in SBCL... looks like it needs to be optimized more
19:15:13
mfiano
Hey Lispers, gamedevs, and the uninitiated -- it's almost time: https://itch.io/jam/spring-lisp-game-jam-2021
19:15:50
Shinmera
Hmm. If my current jam project wasn't aimed to be commercial I'd actually join for once.
19:17:14
contrapunctus
I've been looking into making a game for the last three days, but I'm new to both game dev and Common Lisp :\ (and not a very experienced programmer either)
19:22:45
Shinmera
I made games in Fortran when I was 5, it's not hard to make /a/ game. It's hard to make a game with high production values and comparable to commercial games you might be envisioning.
19:22:49
mfiano
The idea is to practice. Even if you don't finish something, it is still desirable to submit it, as it gives you something to look back on to get a sense of your progression, and it also gives other people a base on which to work on, or ideas for their own future submissions.
19:24:33
Xach
I think like many endeavors it can be daunting to understand how to break down into completable individual pieces that, if you complete enough, results in a complete product/project
19:24:56
mfiano
So, you could just take an existing game, from past jams or GitHub etc, modify it, study it to learn how it works, and perhaps get a better idea of gamedev in general and some ideas you'd like to execute in the future.
19:25:16
Xach
(Which is part of the magic - when you see something and can instantly figure out how it's done, it is hard to be very delighted...)
19:25:52
mfiano
It's quite intimidating to try to make a game as a beginner in a public jam with a time limit. That is not the point at all though...the point is to learn and have fun :)
19:28:37
Xach
The desire to make games led to my interest in computers, but I don't enjoy games nearly as much as I used to :~(
19:28:47
mfiano
_death said he might too. I'd like to see longtime lispers that never participated try.
19:29:08
mfiano
Xach: Same here, I don't like playing games, but it is incredibly interesting to code them.
19:29:21
Shinmera
I can offer more assistance with Trial than usual this and next week if someone wants to give it a shot using it.
19:30:13
aeth
The games I liked the most (especially as a teenager) tended to be massive time sinks, so I just stay away from them entirely. And I don't try games that have patterns like that, especially if you have to log in daily/weekly (quite a few AAA games now), if you have things you need to constantly defend from raids (most survival games), etc.
19:31:02
aeth
So for me personally, it's not that I don't like games anymore, it's that I try not to like games too much anymore.
19:32:21
mfiano
_death: I see. 2010 was before my time as a host, when I was just a few years into Lisp at that point, and not sure I was doing games.
19:32:37
_death
mfiano: but, right now I'm compiling aseprite.. so it's one step closer to participation
19:34:49
mfiano
I'd just like to see more COmmon Lispers participate. Too many Lua/Fennel Lisp games :)
19:35:21
mfiano
I've thought about making the first of the bi-annual jams CL only, but then I don't think we'd get anyone but borodust :)
19:40:16
Nilby
I already have 7 unfinished lisp games, and the 3 that I finished were very un-fun, so I'm not sure working on games as an anti-burnout tactic has worked.
19:44:10
Nilby
Presumably results would be better with intrinsic motivation, rather than boredom with other things.
19:50:36
_death
mfiano: I also have some tic-80 w/ ecl thing.. it was some years ago, but maybe someone wants to pick it up
19:53:30
Bike
quick question - i was looking at tic-80 before - it's not an actual virtual machine is it? like it doesn't have a bytecode ISA or something, you can write code in whatever
19:54:24
Bike
ok yeah, that's what it looked like. i think i had it in my head that it was an actual VM
19:56:51
_death
mfiano: I've not kept up with tic-80.. it was just when it was made public (hence only 60 commits in that repo).. it seemed pretty functional back then though
20:07:32
luis
Hmm, although the site only lists CMUCL, ECL, SBCL, ABCL and CCL, https://gitlab.common-lisp.net/asdf/asdf/-/blob/master/gitlab-ci.yml suggests there's a CLISP image too.
20:13:02
nij
Weird.. in my stumpwm config, I have (when (ignore-errors (ql:quickload :some-package)) (progn (defcommand ..)))
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