freenode/#lisp - IRC Chatlog
Search
13:36:16
edgar-rft
theosvoitha: in case nobody has already mentioned it before, there is a Common Lisp Wiki with lots of useful information -> https://www.cliki.net/Getting%20Started
18:24:32
eta
is there a version of MACROLET that works like LABELS, i.e. you can reference variables in the lexical environment?
18:31:00
eta
> Declarations and macrolet and symbol-macrolet definitions affect the local macro definitions in a macrolet, but the consequences are undefined if the local macro definitions reference any local variable or function bindings that are visible in that lexical environment.
18:35:46
pjb
eta: notably, macros are expanded at compilation time, while lexical bindings are established at run-time. Like, in a 100 years, on a different computer (probably an emulator then).
18:36:03
eta
pjb, I want to write (let ((a 1)) (macrolet ((do-thing-with-a (b) `(+ ,a ,b))) (do-thing-with-a 2)))
18:36:57
pjb
eta: if you want to have variables that you can mutate in the macro (at macroexpansion time/compilation time) and then access it (or not) at run-time, you will need to write your own MACRO-LET macro.
18:37:55
pjb
(symbol-macrolet ((a 1)) (macrolet ((do-thing-with-a (b) `(+ ,a ,b))) (do-thing-with-a 2))) #| --> 3 |# seems conforming to me.
18:38:26
pjb
eta: if you changed ,a to a it would indeed work with let, since a would be referenced a run-time then.
18:39:03
eta
pjb, I hadn't seen that SYMBOL-MACROLET trick before (nice!), but I'll just go with a instead of ,a for this case :)
18:40:31
pjb
eta: just keep in mind of WHEN different expressions are evaluated. (macroexpansion time, compilation time, load time, run-time, when evaluated by a call to EVAL, when read (reader macros, #.) etc).
18:49:52
jcowan
My sense is that a construct for defining recursive local macros is not sufficiently useful.
18:50:40
jcowan
Indeed, I think it may be unnecessary, given that the result of a macro procedure is itself expanded again.
18:51:18
jcowan
So it would only come up if you want macro A and B, declared in the same scope, to invoke one another in their bodies
0:07:41
jcowan
Bike: In the R6RS standard it is possible to use macros before they are defined, except at the REPL (whose behavior R6RS does not specify). I argued against this (mis)feature in R7RS using a parable, "The Tale of Professor Simpleton and Dr. Hardcase" <https://www.mail-archive.com/r6rs-discuss@lists.r6rs.org/msg04199.html>
0:24:35
_death
if macro forms are expanded just before they are evaluated, then it is possible to have them stored before macro definition (but not in CL)
0:35:16
jcowan
(aeth: it's only possible within a library, the assumption being that you read in the whole library and process the syntax definitions before any variable definitions.)
0:37:21
LdBeth
is there any optimizations for a quite large array with only small integers as elements?
0:40:16
no-defun-allowed
Odds are the upgraded element type of (integer 1 12) would be (unsigned-byte 8)
0:41:28
no-defun-allowed
(Right, a number is an inclusive integer designator unless I wrap it in a list)
0:42:02
no-defun-allowed
In CCL: (upgraded-array-element-type '(integer 1 12)) ; ⇒ (UNSIGNED-BYTE 8)
0:46:16
no-defun-allowed
I...don't think many processors have instructions for manipulating 4-bit quantities, so it would probably only be better at saving memory.