freenode/#lisp - IRC Chatlog
Search
20:01:06
Ober
no-defun-allowed: yeah probably user issue on my part. restarting slime seems to not hang now.
21:04:02
semz
Question about iterate: A (for VAR initially ... then ...) clause can't use PVAR from a (for PVAR previous VAR) clause in the THEN part because the clauses expand to (PROGN (SETQ PVAR VAR) (SETQ VAR ...)). Is this an undocumented gotcha or does it follow from some principle I have missed and I should have expected it?
0:22:12
aeth
Oh wow, that was involved. It took quite a bit to get variable support in my HTML macro. https://gitlab.com/mbabich/cl-documents/blob/ab3551f26a4bcfd1ec47532efccc45693cc247b2/generate-html.lisp#L9-47
0:22:27
aeth
I have to manually iterate the lists so it terminates one after the list end instead of at the list end.
0:25:01
aeth
Basically I assume that (code-char 0) is invalid, so when I come across a symbol that's not a keyword (i.e. a variable) then I write (code-char 0) and I push the variable-name to an internal list in write-html, which is returned at the end (in reverse order). Then I write the string, split on (code-char 0)s with calls to (write-html ,variable ...) in between the splits.
0:26:34
aeth
So, effectively, what the macro generates is: if it's not (code-char 0) then it writes the string range up until that point and if it is, then it writes the original symbol it encountered, which is assumed to be a variable.
0:28:00
aeth
If no variables are used, then it just writes a constant string, which is going to be the most efficient. The next most efficient will be to precalculate as much as possible.
3:20:35
aeth
I generally prefer suffixes to prefixes because then they don't affect an alphabetical sort