libera/#commonlisp - IRC Chatlog
Search
6:08:18
flip214
How can I check whether some symbol exists in a package? Do I need to check (eq (find-symbol (symbol-name foo) (find-package :bar)) foo), or is there something like (package-contains (find-package :bar) foo)?
6:11:52
flip214
I'm also not entirely sure whether a symbol always has to have the same name in another package...
6:13:25
flip214
Can I intern eg. a GENSYM into a package later on? (SETF (symbol-package foo) ...) won't work, I guess)
6:16:04
flip214
WITH-PACKAGE-ITERATOR might be a way to find a symbol in a package, but it might be a bit slow for my purposes...
10:54:21
pjb
gin: instead of (lambda () t) which is a new function, or worse, (constantly t) which builds a new closure each time you call it, you could use a function such as (lisp-implementation-type) which will return a generalized boolean true value always, and which already exists in the image, and (eq (lisp-implementation-type) (lisp-implementation-type)) #| --> t |# so it doesn't even cons.
10:54:56
pjb
gin: (setf (fdefinition 'always-true) (fdefinition 'lisp-implementation-type)) (always-true) #| --> "Clozure Common Lisp" |# ;-)
10:56:53
pjb
flip214: you can set the home package of an uninterned symbol, by importing it in the package.
11:00:08
flip214
pjb: doesn't work for me. Value of SYM1 in (INTERN SYM1 :CL-USER) is #:X, not a STRING.
11:00:18
Alfr
pjb, also I'd expect an always-true to take arbitrarily many (up to call-arguments-limit) arguments.
11:13:33
pjb
Alfr: well, there are requirements that gin left unspecified, so (constantly t) is the best solution so far, despite its consing.
11:14:17
gin
thanks pjb for the messages. gave me a lot more to think about and learnt more lisp too
13:15:23
atgreen
I just updated sbcl (2.2.7) and quicklisp (latest), and now my app is generating "CORRUPTION WARNING in SBCL pid 16 tid 16:
13:15:23
atgreen
Memory fault at (nil) (pc=0x54100a44 [code 0x54100750+0x2F4 ID 0xc530], fp=0x7f94219ef4d0, sp=0x7f94219ef4a0) tid 16