libera/#commonlisp - IRC Chatlog
Search
12:17:40
Mrtn[m]
<lisp123> "one day I will learn C" <- What will you do in the afternoon of that day?
12:45:58
rotateq
trev: It's really one of the most impressive talks I know, due to the idea of translating the metaprogramming for chemistry.
12:56:09
mfiano
jackdaniel: How would you modify your example such that if the cdr is nil, it means trim the original character without replacing (shorter string)?
13:07:38
jackdaniel
I'd probably have a string with a fill pointer along with the index closed over (map nil …)
13:10:37
jackdaniel
(let ((string (make-it size :fill-pointer 0))) (map nil (lambda (c) (when-let ((val (assoc-value …))) (vector-push-extend val string))) *the-other-string*)
14:46:26
trev
i should also say that it made me feel like a total loser after watching, and now i am contemplating my entire purpose in life!
14:51:41
trev
beach, cause it was awesome stuff and when you are just working a mildly interesting day job just for money, it is easy to envy academia
14:54:18
jackdaniel
you should start putting easter eggs in the day job, then it will be for money *and* for easter eggs :)
15:14:03
Bike
relatedly, what de/serialization libraries are good. i tried marshal first, and that works okay, but i'd have to devise my own efficient output format and the code is a bit ugly in parts
15:25:09
mfiano
I am not sure. I used it quite a bit, but not for multi-dimensional arrays. Relatedly, the conspack author left Lisp some years ago, but I am still in contact with him. If you want to hack in support for that, I can see about transferring the repo to sharplispers etc.
15:33:49
Bike
indeed it does. i'm more concerned with compactness than speed here, but that's still nice
15:36:34
mfiano
I never used anything but conspack and cl-store, and elephant...i experienced corruption with the latter two.
15:37:11
Bike
it looks like i might be able to hack in md arrays through tmaps without actually altering the encoding... that would be convenient
15:46:16
Guest74
I've been thinking of how to provide game/character saves in a format that isn't trivially hacked to cheat. Seems like this conspack could provide at least one layer of obscurity.
15:53:32
semz
If it's a singleplayer game, it doesn't matter - let them ruin their own fun if they want. If it's a multiplayer game, you shouldn't be doing that kind of security client-side in the first place.
15:53:34
Guest74
for the determined person sure, but i think it would deter some people that see the save file is just a struct.
15:55:48
dlowe
I think if you're making a game, then until you have a game, this save file encryption is a complete distraction :)
15:57:22
dlowe
People think the hard part of programming is the math, or the problem solving, or learning the technologies. But the actual hard part is managing your enthusiasm, your focus, and other people
15:57:45
Guest74
well, mainly writing the engine and not a specific game. The example is already a 'game' and I already handle saving of character by just writing out their slots.
16:00:09
Guest74
I've already got simple saving in since if you develop within the system instead of using an editor you don't want to lose your work.
16:01:11
mfiano
Bike: Well this project deserves to be moved to a publicly writable community repository in any case. I'll see what the dev says. He transferred some of the gamedev libs to me in the past.
16:01:39
Bike
i was thinking of rolling my own serialization based on my experience staring at make-load-form, but it's probably better to at least start with what already exists
16:04:31
Guest74
I've been thinking about the possibility of using irc to build a multiuser whiteboard. Anybody know of anything like that being done before?
16:05:23
Bike
dunno about irc, but i've used a couple collaborative editors before, if that's what you mean
16:06:37
jackdaniel
sometimes I wonder whether we have more common lisp implementations or game engines in common lisp
16:09:17
Guest74
Ibf, most of it is really simple. Understanding the user and generating novel character responses is another thing entirely.
16:10:28
jackdaniel
I'm waiting eagerly for when you publish it, until then I'll hold of my enthusiasm :) if you want to obfuscate saved game state, then put it in parenthesis, I've heard that they make code unreadable
16:11:03
Guest74
I'm taking a bit of a break to play Zork. I want to implement it in my engine but I haven't finished it yet. reading the source is one big spoiler.
16:11:41
mfiano
Does local-time have anything that just outputs the date/time. I'm not sure what the number after the "." is in rfc3339: (lt:format-rfc3339-timestring t (lt:now)) ;; => "2022-05-16T12:10:12.739015-04:00"
16:15:57
mfiano
Aha, this does what I want: (lt:format-timestring t (lt:now) :format '(:year #\- :month #\- :day #\_ :hour #\: :min #\: :sec))
16:20:05
mfiano
Hmm, but I also need to parse it, and parse-timestring doesn't seem to take a format argument
16:31:05
Guest74
There should be parsers for the formats it produces from what I recall. The format I mentionned is a standard.
16:38:42
Guest74
and this is why I wrote my own, I couldn't figure a simple way to do what I wanted with local-time.
16:41:33
jackdaniel
while having parse accept the string format the same as the format- function does, is there really a problem? maintain the timestamp in native format, and when you need to serialize/deserialize it use rfc-whatever while for user printing use +custom-format+
16:43:16
mfiano
There is no user printing. I am creating filesystem snapshots named as timestamps, and then later during retention cleanup, I need to delete the last N days etc, so I need to map the custom timestamp format I created back to the same local time.
16:45:32
mfiano
I need to convert a custom timestamp filename back to the local-time object it refers to, with the same offset it was created with.
16:47:00
mfiano
This is for local use, so I shouldn't have to deal with global timezone offsets, not that I can figure out how to parse it as such anyway
16:54:04
Bike
i am apparently not understanding how to use conspack's circularity detection in relation to standard objects. if i have foo1 containing a foo2 in a slot, and foo2 contains that foo1, i can encode, but if i decode i get objects with cpk::forward-refs in them
16:57:56
mfiano
I had to specify a utc timezone in the formatting of the parsed timestring, which doesn't make a whole lot of sense to me, but ok
17:01:13
mfiano
Which I realize is not going to work with DST, nor is using the :offset argument of parse-timestring
17:09:32
mfiano
parse-timestring gets very confused and reaches the end of string too early when using :timezone
17:09:51
mfiano
That might be a bug, or just my blind trial and error doing things I'm not supposed to
17:12:55
Guest74
I've been thinking of dropping human readable date/time formats and just going with universal time for things like logs.
17:24:20
jackdaniel
no no, declare it as a fixnum, so it breaks in interesting ways on 32bit systems ,)
17:36:22
cl-arthur
I'd like to run some code when starting up slime. I've found https://slime.common-lisp.dev/doc/html/Multiple-Lisps.html, and thought to use that to set up an "env", but the function supplied to init-function is an elisp/emacs one. Does someone know how to call common lisp code (over slime) from the elisp/emacs code? My google-fu's failing me.
17:47:59
cl-arthur
alfr: that looks like it'd solve 'run some code when starting up slime' but not 'conditionally run some code when starting up slime'
17:58:06
Guest74
dlowe: i personally think crawling through a filesystem reading dates on files is pretty inhumane way to read your logs. Just write an interface that displays the information in any user customizable way.
19:08:02
Guest74
thanks Bike: that looks like it might do the right thing, I don't have any buffers need saving though.
19:14:26
Guest74
I've made the, perhaps unwise, decision to allow my lisp to control emacs and I quite abuse the desktop thing.
20:03:58
Bike
conspack cannot handle circularity within objects, even though the actual data format does. that's unfortunate, but maybe not too bad to fix
20:19:37
Shinmera
::notify Guest74 No, you're thinking of C-x C-s. C-x s ! does save all buffers with changes.
20:59:26
mfiano
What is the most idiomatic way to handle an external package's error condition being signalled, and signal a custom error condition in its place?
21:09:49
Bike
mfiano: you should use handler-bind so as to preserve the backtrace. here is the perhaps-overkill way i do it in cleavir https://github.com/s-expressionists/Cleavir/blob/main/CST-to-AST/conditions.lisp#L328-L372
21:10:26
Bike
(here i'm just encapsulating all kinds of errors, but you can obviously do this more specifically
21:12:27
mfiano
In my case, I'm writing a program that is expected to be run as an executable image with the debugger disabled, and I just handler-case my USER-ERROR condition that is a subtype of SIMPLE-ERROR: https://gist.github.com/mfiano/ae565e7710d3fcc41115d78164989de6
21:13:00
mfiano
But I want to treat external dependent library errors as user-error's to give a more meaningful message.
21:16:45
Bike
i mean, if all you're going to do with the error is dump it, encapsulating it in a new condition doesn't seem necessary
21:34:55
mfiano
Bike: The error comes from UIOP:RUN-PROGRAM, with no meaningful report, but for each process I call, I know what the user wants to see as a report. In this particular one I want to handle, the only possible error according to the exit status code, would be that ZFS filesystem permissions weren't delegated to the user running the program.
21:36:55
mfiano
I don't see how, considering uiop:run-program is used for all sorts of process calls, and I only know the context to produce the correct report at that call site.
21:42:38
Bike
yeah, no, if you control the call site just the handler-case you described makes sense to me
21:43:23
Bike
the cleavir code i linked is for a different situation, where we call some function that we don't control and which can do literally anything
21:44:27
mfiano
Yeah, I'm breaking my Lisp tradition here, of writing a program designed to be run from cron. Any error should exit the program, optionally u-w-p'ing a cleanup form, and writing the message to the job's log file.
21:46:12
mfiano
ACTION is rewriting a few thousand line shell script he wrote 6 months ago that outgrew its host language by...a few thousand lines.
22:07:00
dbotton
Do those of you deploying CL webservers do you tend to have each site in a different lisp image or all in one?
22:50:01
mfiano
I also try to avoid as much GPL-licensed software as I can. But this is all largely off-topic here.