libera/#commonlisp - IRC Chatlog
Search
5:47:42
asarch
One stupid question: how would be better? Using flet (let (a b c) (flet ((foo (bar) …) (baz (spam) …)) …)) or with defun (let (a b c) (defun foo (bar) …) (defun baz (spam) …) …) and why?
5:49:22
asarch
I think it would better with defun because you could use foo immediately in baz, right?
5:49:23
beach
It is always best to limit the scope of your definitions as much as possible, so if the functions are used only locally, then FLET is better.
5:51:37
beach
You want to limit the scope, so that the person reading your code does not have too keep too much information in mind when reading your code. With limited scope, that person can quit thinking about FOO and BAZ whenever the scope of the FLET or LABELS ends.
5:52:08
beach
asarch: This is a general rule of programming, so if you know how to program in any other language, I am sure you have heard about it.
5:53:25
asarch
Is there a way to declare variables and also functions? I remember PROG could that (but I can't find my annotation)
5:53:58
jackdaniel
no, LET* is "nested LET", while LABELS is "shared scope for function names" for lack of a better description at hand
5:54:11
beach
asarch: What do you mean by "declare variables and also functions"? And why do you need to declare them?
5:56:32
jackdaniel
Inline: perhaps stating things that you are not sure about yourself is not that of a good idea, it may confuse others
5:57:02
edgar-rft
CLHS says that "defun is not required to perform any compile-time side effects" what means it can happen that the outer defun is not established when the inner code (calling the outer function) is compiled and you'll get a "funtion not found" error when compiling the code.
5:59:51
asarch
Is there a way to combine both "operations"?: E.g.: (some-exp (a b c ((foo (bar) …) (baz (spam) …))) …)?
6:02:49
jackdaniel
and no, common lisp standard does not propose any operator that would allow mixing binding variables and functions
6:05:30
beach
asarch: If you had answered my question, we would have understood that your terminology ("declare") was wrong (you apparently meant "bind"), and we would have been more efficient in the future. As it is, you will probably continue using the wrong terminology and waste time (mostly your own, but also ours).
6:05:30
Nilby
of course the spec says "let performs the bindings in parallel", so Inline was saying something reasonable, but mixing up let - parallel binding vs. let* - sequential binding
8:23:47
Mrtn[m]
<kaskal> "dbotton do not answer to..." <- How did you arrive at the conclusion that horroar is a troll?
8:34:03
Mrtn[m]
beach: I think I am missing some of the history, and it seems that @horroar:libera.chat already left (not sure if he got help).
8:42:41
Mrtn[m]
jackdaniel: That is very kind of you. I am guessing the "tl;dr" is that it turned out he wasn't really interested in CLOG after all, he just wanted to demonstrate how obnoxious he was.