Elisp:使用let *和(lambda),符号的变量值为void

时间:2016-03-30 16:40:31

标签: emacs elisp

免责声明:我今天开始使用elisp进行攻击。

我真的很想知道我得到了以下错误:

Symbol's value as variable is void: response

使用以下代码:

(let* ((response (cons 'dict nil)))
  (nrepl-request:eval
   code 
   (lambda (resp) 
      (print resp (get-buffer "*sub-process*"))
      (nrepl--merge response resp))
   (cider-current-connection) 
   (cider-current-session)))

我的理解是response在从lambda函数调用时属于let*子句的范围......但显然它不是。

This also seem to be working in this code

所以我有点迷失为什么我会收到这个错误以及我应该怎么做。

1 个答案:

答案 0 :(得分:6)

您需要通过将全局变量@echo off echo. echo Target architecture for all exes and dlls: echo. REM For each exe and dll in this directory and all subdirectories... for %%a in (.exe, .dll) do forfiles /s /m *%%a /c "cmd /c echo @relpath" > testfiles.txt for /f %%b in (testfiles.txt) do ( REM Dump corflags results to a text file corflags /nologo %%b > corflagsdeets.txt REM Parse the corflags results to look for key markers findstr /C:"PE32+">nul .\corflagsdeets.txt && ( REM `PE32+` indicates x64 echo %%~b = x64 ) || ( REM pre-v8 Windows SDK listed only "32BIT" line item, REM newer versions list "32BITREQ" and "32BITPREF" line items findstr /C:"32BITREQ : 0">nul /C:"32BIT : 0" .\corflagsdeets.txt && ( REM `PE32` and NOT 32bit required indicates Any CPU echo %%~b = Any CPU ) || ( REM `PE32` and 32bit required indicates x86 echo %%~b = x86 ) ) del corflagsdeets.txt ) del testfiles.txt echo. 设置为源文件中的文件局部变量来指定词法绑定。把这样的一行作为文件的第一行:

lexical-binding

要么这样做,要么使用;;; -*- lexical-binding: t -*- 而不是lexical-let*

或者,如果在调用匿名函数时不需要变量let* 作为变量,也就是说,如果在定义函数时只需要其值,然后你可以用这个:

response

使用词法变量,在对文件进行字节编译时会编译lambda表单。如果没有变量(即只有它的值),则不会编译lambda表单 - 它只是一个列表(带有汽车(let* ((response (cons 'dict nil))) (nrepl-request:eval code `(lambda (resp) (print resp (get-buffer "*sub-process*")) (nrepl--merge ',response resp)) ; <===== Substitute value for variable (cider-current-connection) (cider-current-session))) 等)。