Post #4404267
2026-08-05 05:26 UTC
@ramin_hal9001@fe.disroot.org A lisp struct:
CLIM-USER> (defstruct (words (:conc-name wr-))
(words-seen () :type t))
WORDS
CLIM-USER> (defun add-word
(words word)
(values
words
(setf (wr-words-seen words)
(append
(wr-words-seen words)
(list word)))))
ADD-WORD
CLIM-USER> #S(words)
#S(WORDS :WORDS-SEEN NIL)
CLIM-USER> (add-word * 'hello)
#S(WORDS :WORDS-SEEN (HELLO))
(HELLO)
CLIM-USER> (add-word * 'world)
#S(WORDS :WORDS-SEEN (HELLO WORLD))
(HELLO WORLD)
Replies (1)
-
@screwlisp@gamerplus.org 2026-08-05 05:28
@ramin_hal9001@fe.disroot.org Clearly common lisp does not enforce singlethreadedness in the way acl2 does; however if you use the acl2 code, this will happen incidentally. Translating stobjs to setf and structs, and loop to loop$, lambda to lambda$, apply to apply$, [] format to fmt aren't broad-spectrum automatable because there are differences, but can generally be macroed in a particular project I think.