libera/#commonlisp - IRC Chatlog
Search
23:30:22
Catie
Adjusting a displaced array is something they actually put a decent bit of thought into, there's an issue writeup about it
23:34:36
Bike
no, i mean instead of having displaced arrays like they exist, having a more limited construct that can't get recursive
23:47:35
aeth
there's no incentive to optimize displaced arrays because nobody uses displaced arrays... because they're not optimized
23:48:10
aeth
the idiomatic way of thinking is start/end indices and almost everything in the standard library has it, as well as any well-written third-party library
23:55:02
Bike
given that, in general, you have this indefinite-length chain of displacements to navigate
23:56:13
aeth
if the problem is the function ARRAY-DISPLACEMENT, and someone really wanted to optimize displaced arrays, couldn't they just optimize them if ARRAY-DISPLACEMENT cannot possibly show up in the program?
23:57:53
_death
Bike: what about keeping both the immediate displacement and the farthest one possible, and recomputing the latter when needed
23:58:13
Bike
yeah i guess you could have each array maintain weak backpointers to every array that's displaced to it
0:01:11
Bike
aeth: and for the record, it's more or less impossible (in general, actually impossible, for computability reasons) for a compiler to determine that some function will never be called, in a world where any function could be redefined to do (eval (read))
0:02:41
aeth
Bike: you do something like what JITs do... you are prepared to deoptimize if necessary. Easier task than JITs because you'd only need to do it on the equivalent of C-c C-c or C-c C-k
0:49:52
nij-
Hello! Is it possible to define setf-expander that does file reading and writing on the file?: https://bpa.st/LMUA
1:54:42
nij-
I might try another way. Instead of defsetf, is there a way to monitor the value cell of a symbol, so that whenever the value cell is changed, we invoke a certain function?
1:58:52
Catie
You could define a :before method on the (setf ...) function, but that only handles the case where it's mutated via setf
2:00:09
moon-child
(define-symbol-macro x '(get-x)) (let (x) (defun (get-x) x) (defun (setf get-x) (nx) (notify-about nx)))
2:09:19
nij-
moon-child: Oh I see I think you mean: (let (x) (defun get-x () x) (defun (setf get-x) (nx) (setf x nx)))
2:11:08
moon-child
tired, and I was thinking about wrapping the parentheses around (setf get-x), my fingers got ahead of me
9:35:35
nij-
Those who have used accesses - while it is great to access a place given by a variable, it doesn't seem to be working for a general place form like this
9:36:51
nij-
If I want to extend the behavior, I need to hack the function accesses to expand the inner forms, right? Is it possible in principle?
9:43:59
nij-
Ok.. without stupid mistake (hopefully), here's a case that's expected to work but not:
9:56:52
phoe
first, (setf (access:accesses (nth 0 *X*) '(:a :type :plist)) nil) because it is 1 at the moment
9:57:10
phoe
then, (setf (access:accesses (nth 0 *X*) '(:a :type :plist) '(:b :type :plist)) 10) to push into the new plist
9:59:49
phoe
either that, or implement type errors in access itself - it should tell you that it cannot treat 1 as a plist