libera/#commonlisp - IRC Chatlog
Search
11:17:28
mfiano
What is a good way to transform a string repeatedly given a list of cons of translation characters. For example given the list ((#\, . #\-) (#\; . #\:)) and the string "foo,bar;baz", it should produce "foo-bar:baz"
11:20:58
semz
Although this may run into issues if one character is replaced with another character that is to be replaced later
11:33:14
lisp123
this week going to have about 5000 people using my CL app (for a few minutes each at a conf)
11:35:30
mfiano
Something like this maybe is sufficient: https://gist.github.com/mfiano/5616e646ad101334ff4c4938872caaa7
11:39:14
mfiano
I do not want subsequent passes to mutate previous passes. I want to do it all in one pass to avoid that
11:40:32
jackdaniel
what is a testimony that replace is perhaps not the best name for that particular function
11:41:42
rotateq
I always see what I didn't use yet so often. Or today, that NTH-VALUE is actually a macro.
11:44:37
mfiano
Maybe I should be looping over STRING instead of NEW-STRING. I have to read to iteration restrictions in the CLHS again
12:01:00
jackdaniel
clisp payed a dear price for rlwrap integration - it had to change its own license
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.