On Sun, Dec 10, 2023, 10:14 AM Richard Stallman wrote: > [[[ To any NSA and FBI agents reading my email: please consider ]]] > [[[ whether defending the US Constitution against all enemies, ]]] > [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > > I am trying to rewrite `byte-optimize-letX' with cond*, > but I cannot understand its current definition. > > Specifically, I can't understand this pcase clause: > > ;; Body is last variable. > (`(,head ,(and bindings > (let last-var (caar (last bindings)))) > ,(and last-var ; non-linear pattern > (pred symbolp) (pred (not keywordp)) (pred (not > booleanp)))) > (if (eq head 'let) > `(progn ,@(mapcar #'cadr bindings)) > `(,head ,(butlast bindings) ,(cadar (last bindings))))) > > What case is it meant to handle? What does that case look like? > The pattern would match a let or let* form that has bindings but no body. If it's a let form, the bindings are unused since only code in the body would see the bound variables. So the optimization is to transform the value expressions of the bindings into a progn. If it's a let* form, then the last bound variables would only be visible in the body, but there is none. Therefore, the last variable binding is eliminated and its value expression is made into the body. Lynn