freenode/#lisp - IRC Chatlog
Search
13:59:51
pjb
minion: memo for smokeink: there still a difference writing (function (lambda …)) instead of (lambda …). In the later case, the lambda macro will have to be expanded, and therefore *macroexpand-hook* will be called. In the former case, no such thing occurs. So there may be different side effects.
14:02:27
pjb
minion: memo for smokeink: there may also be a big difference if function is not cl:function. I note in this source that they use cl:defun, perhaps function is shadowed too. Check the package definition!
14:02:34
boeg
Is there a function in sly (or slime) thats like sldb-show-frame-source/sldb-show-source, but where it jumps to the place in my local source code where the bug in *my* code is so I can fix it?
14:04:17
p_l
it's even not the case that hashtables are blocking it, but lack of standard serialization for things like classes - because hashtables can accept anything as key so long as sxhash works on it
14:05:02
boeg
pjb: well, right now I introduced a bug where I use the wrong keyword parameter with make-instance, so when I run sldb-show-frame-source it jumps into the sbcl codebase where the code is run (i'm guessing), not into the place in my source code where i typed ":accessor" wrong. Does that make sense?
14:05:11
p_l
so it's easy to serialize a hashtable that uses a primitive type as keys (as most people think of hashtables), except common lisp hashtables (and actually hashtables in many other languages) support arbitrary keys
14:05:52
pjb
boeg: yep. In the sldb window you get a stack of frames, so you need to look down the first user function and type v to jump on it.
14:07:42
pjb
boeg: I guess you could write an emacs command to lookup for each frame if the source is in or outside some specific directory.
14:09:39
pjb
Serializing hash-table requires serializing the hash-table attributes, and then to initialize the deserialized table with them. It's feasible. At least we don't have the difficulty as with displaced arrays.
14:09:56
Odin-
p_l: Couldn't you define a serialisation for a hash table which barfs if printing readably and the key is bad?
14:12:51
pjb
I guess it's because of those additionnal attributes that there is no default printer/reader for hash-tables. Note that for arrays, the reader won't create arrays of the same types, or with fill pointers, or displaced, etc. The printer writes a projection. For a hash-table you would need at least :test otherwise the new table would be useless.
14:14:12
jmercouris
so, circular structures are only an issue during traversal right? so the problem is that we have to traverse the structure to persist it to disk?
14:19:03
dnaeon
hey all, what would be the idiomatic way to access nested alist values as returned by cl-json when using some nested JSON object? is there a library I'm missing, or should I just write my own function instead? This seems something that should already be provided by a library, but I haven't seen such.
14:19:51
dnaeon
currently I'm using my own util function, which simply REDUCEs the alist with the given key-path, but I was wondering whether there's such thing already?
14:23:57
beach
jmercouris: There is no problem what so ever in serializing a hash table to disk. The circularity "problem" can be solved with another hash table. But there is no standard way of doing it.
14:24:02
beach
jmercouris: Also, seok seems to think that the object itself can be saved to disk, but there is always going to be some conversion to an external representation.
14:25:09
jmercouris
beach: oh I see, what if you took the contents into ram and literally piped them onto a disk
14:25:55
beach
jmercouris: Yes, and then the GC moves the objects so that their addresses no longer correspond to what you wrote on disk.
14:27:15
beach
jmercouris: You would need an operating system in which RAM is just a cache for secondary memory for it to work. Like CLOSOS for instance.
14:28:51
jmercouris
beach: what if we just dumped the lisp image, couldn't that be effectively persisting the hash table?
14:31:53
p_l
there was an extension to SBCL that allowed dumping partial images, so long as the image that loaded the resulting file was the same image that generated it
14:32:30
p_l
it essentially allowed you to do a dump of memory region and then reload it, but it did none of the stuff that FASLs do for relocation et al, so you had to use the same base image
14:41:42
flip214
I've got a (make-hash-table :test #'equalp); is there a way to get structures or class instances recognized as (equal) keys?
14:42:05
flip214
I guess that for structures :TYPE vector or :TYPE list might achieve that, but that has a few disadvantages...
14:45:06
pjb
flip214: all objects can be compares with eql equal or equalp, so there's no way to say this object can only be compared with equal.
14:47:05
Posterdati
please I'd like to submit some fixes for cffi and iolib for OpenBSD, is there anyone who can help me? Thanks
14:47:06
flip214
pjb: but "equality" (however defined) isn't recognized by default, unless they're EQ
14:49:55
flip214
perhaps the easiest way is to not use structures or classes but lists starting with some symbol
14:51:56
pjb
flip214: the point is that it may be meaningful to use either test function on whatever type of keys you have.
14:59:12
pjb
now, for symbols eql equal and equalp are the same, but for string keys it would be different.
15:01:53
pjb
For lists, it doesn't work: (defvar *lists* (make-hash-table :test 'equalp)) (defun intern-list (k) (or (gethash k *lists*) (setf (gethash k *lists*) k))) (setf *print-circle* t) (list (intern-list (list 'foo 'bar)) (intern-list (list 'foo 'bar)) (intern-list (list 'foo 'quux))) #| --> ((foo bar) (foo bar) (foo quux)) |#
15:03:36
pjb
(defparameter *lists* (make-hash-table :test 'equalp)) (defun intern-list (k) (or (gethash k *lists*) (setf (gethash k *lists*) k))) (setf *print-circle* t) (list (intern-list (list 'foo 'bar)) (intern-list (list 'foo 'bar)) (intern-list (list 'foo 'quux))) #| --> (#1=(foo bar) #1# (foo quux)) |#
15:26:02
_death
needs https://github.com/death/slime/commit/c2b03d67b2e8a53c2fe5acd594949d1755479829
15:51:17
_death
though it's aimed at repl use.. many times I want to call something and then go, oh, need to load that system first.. there could also be a slime repl shortcut I guess (i.e. something like ,load-system)
17:35:23
pfdietz
Hmm, that uses a restart that was only recently added to SBCL. Nice to see it has another use.
17:42:41
pfdietz
I was slurping in large amounts of lisp code to act as fodder for random input generation for testing the compiler, and didn't want to have to have all the packages defined.
17:43:08
pfdietz
So if I came across FOO::BAR and FOO wasn't a package I wanted an API to turn that into something else.
17:43:58
pfdietz
The reading did not have to be faithful, just mostly ok, because the forms were then shuffled and hacked up anyway.
17:52:08
_death
I see.. btw a coverage-guided fuzzer doesn't seem that far-fetched given the existence sb-cover, right?
17:55:49
pfdietz
Idea was to hack the point data structure to be more general, and provide a version that allows checkpointing and rollback. When an input is found that increases coverage, add it to the pot. The rollback is for test minimization.
17:56:54
pfdietz
What it did not do is use local structure of code to guide search, like some fuzzers now do. But one could imagine doing that too.
17:58:49
_death
not long ago I saw it mentioned in https://events19.linuxfoundation.org/wp-content/uploads/2017/11/Syzbot-and-the-Tale-of-Thousand-Kernel-Bugs-Dmitry-Vyukov-Google.pdf
19:11:08
|3b|
cl-opengl users please test https://github.com/3b/cl-opengl/tree/dev with your code, needs more feedback to decide if recent changes are safe enough to release to quicklisp
19:12:34
|3b|
in particular looking for errors like `:foo is not defined as a keyword for enum type #<...>.`, found a few in the examples already, so a bit wary of releasing it
21:40:01
LdBeth
Shinmera: save only the difference between the old and new image instead of a standalone new image
21:47:40
harovali
While trying, some aparent normal uses yielded some conditions, I wonder how to handle that
21:49:25
LdBeth
I see why SBCL can't do so "The system expects to be loaded into a fixed-at-compile-time location in virtual memory"
21:51:25
_death
LdBeth: you could easily do that.. I saved a core to file "one", then ran sbcl --core one and save a core to file "two".. ran bsdiff one two one-to-two ... this created a 900K diff file.. the only issue is that it takes a bit of time
22:07:43
phoe
LdBeth: it supports dumping incremental updates to heap image, except they are called FASLs
23:05:03
jmercouris
the designer of spicelisp apparently invented :-) and :-( https://en.wikipedia.org/wiki/Scott_Fahlman
1:46:58
no-defun-allowed
You can use a special variable: (defvar *a*) (defun abc () (setf *a* 10)) ... (let ((*a* 5)) ...)
1:48:40
no-defun-allowed
DEFVAR is required so that the function ABC knows it is going to modify a special variable, but you can also (declare (special *a*)) in every use of the special variable.
1:49:56
no-defun-allowed
Another option is to use a box (a small structure with one element, or a 0-dimensional array), but then you have to unbox the value to use it and have to setf the value of the box to modify it.
1:50:38
no-defun-allowed
eg (defun abc (b) (setf (box-value b) 10)) (let ((a (box 5))) (abc a) (print (box-value a)))
1:50:51
no-defun-allowed
(The implementations of BOX, (SETF BOX-VALUE) and BOX-VALUE are left to the reader)