libera/commonlisp - IRC Chatlog
Search
14:11:34
dnhester
is it possible to simply initialize a class based on a given object? Say I have an object of class A, and class A inherits from class B, and I want to initialize an object of class B with the same fields as A The reason is that I want to remove certain slot values from the object but I want to keep another instance with the values Without just doing (with-slots...)
14:18:38
dnhester
maybe this: I will try, sharing for confirmation https://lisp-docs.github.io/cl-language-reference/chap-7/h-h-dictionary/change-class_standard-generic-function
14:25:19
dnhester
beach: thanks for answering the question the other day on reinitialize-instance, it helped me find the right answer by reading the reference
14:58:52
beach
So "Say I have an instance a of class A, and an instance b of class B, and A is a subclass of class B, and I want to turn b into an instance of A. The reason is that I want to modify certain slots of a, but I want to keep the old slot values of a in b." Yes?
15:00:00
kenanb
Here is my latest CL related blog post that's hopefully interesting to some: https://blog.kenanb.com/code/lisp/2024/02/14/means-of-production.html
15:00:29
beach
dnhester: So my question is, why is b and instance of B and not of A in the first place?
19:57:06
skin
Out of curiosity: does anyone know which is faster on SBCL? `(setf (subseq a 0 (length b)) b)` or `(replace a b :start1 0 :end1 (length b))`?
19:58:32
pkal
(LET* ((#:SEQUENCE A) (#:END (LENGTH B)) (#:NEW1 B)) (REPLACE #:SEQUENCE #:NEW1 :START1 0 :END1 #:END) #:NEW1)
23:41:23
Kingsy
is it possible if I have a class to iterate over all slots on that class? I am trying to create a method that makes it easy to build a hashmap of the class without having to manually setf for each slot. its annoying with classes that have lots of slots.