标签: slime

READ 在 FORMAT 之前运行

read在 SLIME 中运行这个并想知道为什么它在输出之前等待输入format

(defun wage ()
  (format t "~&Enter wage: ")
  (let ((wage (read)))
    (format t "~&Enter hours: ")
    (let ((hours (read)))
      (format t "~&Earned ~S dollars." (* wage hours)))))

* (wage)

2
Enter wage: 
3
Enter hours: 
Earned 6 dollars.
NIL
Run Code Online (Sandbox Code Playgroud)

lisp sbcl common-lisp slime

1
推荐指数
1
解决办法
154
查看次数

常见的lisp错误,不是绑定变量

我正在关注Practical Common Lisp.我跟着这个例子来到了发球台.当我在Emacs中编译时,C-c C-c我得到以下错误与此代码.

(defun make-cd (title artist rating ripped)
  (list :title title :artist artist :rating rating :ripped ripped))

(defvar *db* nil)
(defun add-record (cd)(push cd db))
Run Code Online (Sandbox Code Playgroud)

警告:在ADD-RECORD中:DB既未声明也未绑定,它将被视为已声明为SPECIAL.

我无法理解出了什么问题.它不能是代码因为我在clisp和sbcl中都试过,两者都得到类似的错误.为什么会这样?我的设置可能有问题吗?

common-lisp slime

1
推荐指数
1
解决办法
160
查看次数

adoc模式的含义是什么?

每当我打开Common Lisp扩展文件*.lsp时,adoc次要模式就会自动出现.

我已经在Google上进行了搜索,以及Emacs帮助自己,但无法找到我想要的信息.感谢任何帮助;)

在此输入图像描述

lisp emacs common-lisp slime minor-mode

1
推荐指数
1
解决办法
313
查看次数

有没有办法找出原始函数(内置)在 SBCL 中是如何准确定义的?

我正在使用 Emacs、SBCL 和 Slime 学习 Common Lisp。

我想确切地知道内置函数的代码定义是什么

我知道如何使用(documentation ...)(describe ...)。但是,它们仅提供高级别的信息。我想看看代码细节。

nth内置函数为例。

Documentation 给我们:

CL-USER> (documentation 'nth 'function)
"Return the nth object in a list where the car is the zero-th element."
Run Code Online (Sandbox Code Playgroud)

Describe 给我:

CL-USER> (describe 'nth)
COMMON-LISP:NTH
  [symbol]

NTH names a compiled function:
  Lambda-list: (SB-IMPL::N LIST)
  Declared type: (FUNCTION (UNSIGNED-BYTE LIST) (VALUES T &OPTIONAL))
  Derived type: (FUNCTION (T T) (VALUES T &OPTIONAL))
  Documentation:
    Return the nth object in a list where …
Run Code Online (Sandbox Code Playgroud)

sbcl common-lisp slime built-in code-documentation

1
推荐指数
1
解决办法
87
查看次数

Aquamacs + slime:在启动时加载lisp文件

我正在运行Aquamacs + Slime,当我启动Aquamacs时,我可以自动启动Slime.但是,当我尝试加载lisp文件后,我会不断收到各种错误,具体取决于我是如何尝试加载文件的.这是我的偏好.el

(setq inferior-lisp-program "~/ccl/dx86cl64"
  slime-startup-animation nil)
(require 'slime)
(split-window-horizontally)
(other-window 1)
(slime)
(eval-after-load "slime"
   '(progn 
       (slime-compile-and-load-file "/Users/xxxxx/xxxxx/load-seq.lisp")
 )) 
Run Code Online (Sandbox Code Playgroud)

我收到以下错误

error: Buffer *inferior-lisp* is not associated with a file.
Run Code Online (Sandbox Code Playgroud)

我尝试了其他功能,包括load compile-and-loadslime-load-file分别得到以下错误......

Invalid read syntax: #
Symbol's function definition is void: compile-and-load
error: Not connected.
Run Code Online (Sandbox Code Playgroud)

当我(load "/Users/xxxxx/xxxxx/load-seq.lisp")使用粘液REPL 时,lisp文件加载(并编译)很好.看起来当我把它放在Preferences.el中时,即使我正在使用它也不会等待粘液加载eval-after-load.

emacs aquamacs slime

0
推荐指数
1
解决办法
876
查看次数

slime仅在被调用函数结束时打印my(format ...)调用

我安装了emacs + sbcl + slime.我定义了这个功能

(defun jugar ()
  (let* ((nodoActual *nodo-inicial*)
         (estadoActual (nodo-estado nodoActual))
         (timeStart nil)
         (timeEnd nil)
         )
    (loop while (not (es-estado-final estadoActual)) do
          (setf *hojas* 0)
          (setf timeStart (get-universal-time))
          (setf nodoActual (decision-minimax nodoActual *profundidad* timeStart))
          (setf timeEnd (get-universal-time))
          (setf estadoActual (nodo-estado nodoActual))
          (imprime-en-fichero estadoActual)
          (format t "Hojas analizadas:     ~a  ~%" *hojas*)
          (format t "Tiempo empleado:     ~a  ~%~%" time))   
    ))
Run Code Online (Sandbox Code Playgroud)

进行一系列调用并在循环中打印一些变量.

问题是当我(jugar)*slime-repl sbcl*缓冲区调用时,提示等待直到(jugar)执行结束以显示所有(format …)在一起.我从一个终端(运行sbcl)尝试了同样的方法并且运行良好,所以我猜这是与emacs或slime相关的东西.我该如何解决?

emacs sbcl flush common-lisp slime

0
推荐指数
1
解决办法
203
查看次数

我怎样才能让 Sly 的回溯变得合理?

每当我遇到错误时,Sly 都会显示重新启动和回溯。我在互联网上看到有人拥有可读的回溯,这些回溯是合理的函数调用。当我进入(fun duf)repl 时,我最终会得到这样的结果:

Backtrace:
 0: ((LAMBDA ()))
 1: (SB-INT:SIMPLE-EVAL-IN-LEXENV (FUN DUF) #<NULL-LEXENV>)
 2: (EVAL (FUN DUF))
 3: ((LAMBDA NIL :IN SLYNK-MREPL::MREPL-EVAL-1))
 4: (SLYNK::CALL-WITH-RETRY-RESTART "Retry SLY mREPL evaluation request." #<CLOSURE (LAMBDA NIL :IN SLYNK-MREPL::MREPL-EVAL-1) {100308AA1B}>)
 5: ((LAMBDA NIL :IN SLYNK-MREPL::MREPL-EVAL-1))
 6: ((LAMBDA NIL :IN SLYNK::CALL-WITH-LISTENER))
 7: (SLYNK::CALL-WITH-BINDINGS ((*PACKAGE* . #<PACKAGE "COMMON-LISP-USER">) (* . 13) (** . 10) (***) (/ 13) (// 10) ...) #<CLOSURE (LAMBDA NIL :IN SLYNK::CALL-WITH-LISTENER) {100308A68B}>)
 8: (SLYNK-MREPL::MREPL-EVAL-1 #<SLYNK-MREPL::MREPL mrepl-2-2> "(fun duf)")
 9: (SLYNK-MREPL::MREPL-EVAL #<SLYNK-MREPL::MREPL …
Run Code Online (Sandbox Code Playgroud)

debugging emacs common-lisp slime

0
推荐指数
1
解决办法
124
查看次数