libera/#commonlisp - IRC Chatlog
Search
23:27:25
gin
is there a shortcut for (lambda () t). I need a function that always returns true? Something like #'always-true. Is it there?
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" |# ;-)