libera/#commonlisp - IRC Chatlog
Search
2:01:33
yottabyte
In slime, the current directory is set to whatever buffer I started slime in. As I open new files in different directories, slime remains open and still pointed to that other directory, even if I close the original file. How do I change it to the current file's directory? Close and restart slime?
2:06:29
sveit_
in SBCL, would (labels ((f (x) (+ x 1)) (g (x) (+ (f x) 1))) (declare (inline f g)) (g x)) inline the definitions of /both/ g and f into the call?
2:06:49
sveit_
and if i instead put (declare (inline f)) (without g) would f be inlined into the definition of g?
2:33:11
sveit_
thanks! another question: is there a simple way to make macros "fall back", in the sense that (macrolet ((a (b) (if (eq b 'b) ''nice ''not-nice))) (macrolet ((a (b) (if (eq b 'a) 'nicest (SOMEHOW EXPAND A)))) (a 'b))) macroexpands to 'nice?
2:34:56
sveit_
well actually (a b) would work, but by accident. had i called the argument to a, c, it would not work
2:51:20
_death
not sure if there's a standard way.. a non-portable one is (macrolet ((a (b) (if (eq b 'b) ''nice ''not-nice))) (macrolet ((a (c &environment env) (if (eq c 'a) ''nicest (macroexpand `(a ,c) (sb-c::lexenv-parent env))))) (a b)))
12:59:14
bollu
Why do we have two types of quotations? '(1 2 3) and `(1 2 3)? From what I can tell, unquoting (,x) is only allowed within a backquote (`) and not within regular quotes ('). I Why does just backquotes not suffice?
13:01:27
jackdaniel
backquote is meant for templating and it is used by the reader; quote is a special form (quote foo) and it prevents evaluation
13:02:19
moon-child
jackdaniel: technically quote is a special _operator_, and it is (quote foo) that is a special form :)
13:03:53
jackdaniel
they should be treated as orthogonal features acting on a different level of abstraction
13:04:12
moon-child
there's a paper on the topic that iirc constructs something useful (though without nesting) in a page or so of code
13:05:41
jackdaniel
does the standard say that it creates such a thing? (putting aside cltl2 appendix that provides example implementation that does that)
13:06:17
moon-child
'An implementation is free to interpret a backquoted form F1 as any form F2 that, when evaluated, will produce a result that is the same under equal as the result implied by the above definition, provided that the side-effect behavior of the substitute form F2 is also consistent with the description given above'
13:08:20
beach
jackdaniel: It was a way of answering the question "Or are they both primitives?" by giving some better terminology.
13:08:34
jackdaniel
I had quite a headache persuading someone in the past that the implementation is not obligated to create an intermediate form
13:09:07
beach
jackdaniel: That I can understand. The reader macro would be fairly complicated then.
13:09:49
jackdaniel
the reader macro would be fairly complicated when it uses or when it doesn't use the intermediate macro form?
13:09:54
moon-child
https://3e8.org/pub/scheme/doc/Quasiquotation%20in%20Lisp%20(Bawden).pdf pp26-27 here
13:10:43
beach
jackdaniel: The latter. In the first case, it is straightforward. The complication is then in the macro definition of the macro call that it generates.
13:10:47
phantomics
Could someone remind me of the repository that has the suggested CL standard additions?
13:11:18
jackdaniel
I see. fwiw SBCL uses an intermediate form (after cltl2 appendix) while ECL doesn't
13:11:56
beach
phantomics: WSCL is not for additions to the standard. It is for specifying currently unspecified behavior in a way that is consistent with what major implementations already do.
13:14:20
pjb
bollu: you don't need quote either. Instead of writing (list 'a 'b 'c) you can write (list (intern "A") (intern "B") (intern "C")).
13:14:46
beach
phantomics: There is not much that the community would agree upon in terms of suggested additions, so WSCL is meant to be nearly completely uncontroversial.
13:15:53
_death
moon-child: nice, I should read it sometime.. however, even short papers (and code) can take nontrivial time and effort to implement
13:16:18
phantomics
beach: right, the addition I'm proposing will address the definition of an alphanumeric character, which is currently somewhat inconsistent
13:23:18
moon-child
so I do not find fault with that part, unless you limit yourself to _only_ symbols and lists
13:25:18
semz
but if you'd put the object into a form and evaled that, the object would self-evaluate
13:26:14
phoe
the question is whether this is a value that is already read or if it is text meant to be turned into a Lisp value by the Lisp reader
13:27:05
jackdaniel
since we're talking about "objects" not "source code text" there is no such a question, that's what I've confused.
13:27:13
semz
we clearly need LISPRC so we can pass objects to the channel instead of serializing them to text
13:40:17
_death
semz: your "only exceptions" question reminded me of sb-kernel:make-unbound-marker... (eval (sb-kernel:make-unbound-marker)) => #<unbound> hmm ok.. but then, (eval *) => ; Evaluation aborted :)
13:42:01
semz
_death: (eval (sb-kernel:make-unbound-marker)) works for me, as does (let ((x (sb-kernel:make-unbound-marker))) (eval x))