sbcl

Cannot start slime with emacs + sbcl under windows

与世无争的帅哥 提交于 2019-12-11 00:59:25
问题 I want to configure my emacs to work with SLIME and SBCL. The .emacs file looks like this: (add-to-list 'load-path "D:/app/slime/") (setq inferior-lisp-program "sbcl") (require 'slime) (slime-setup) Now i'm able to start emacs, but if i type M-x slime, there would be an error complaining something like: "function SWANK-BACKEND: fd-stream-input-buffer-empty-p is undefined" so that the connection to swank fails. What problem could that be? Thanks The version of emacs is 23.3. The version of

SBCL: Gather output of run-program process while running

点点圈 提交于 2019-12-10 22:08:38
问题 Dear StackExchange members, I recently began toying around with Common Lisp and want to create a web interface for administrating a modded Minecraft server. I already tried out this solution but in this case the function just hangs and never returns. My code looks like this: (defvar *proc*) (defun create-minecraft-proc () (let* ((binary "/usr/bin/java") (jar "/home/user/temp/Vanilla 1.8/minecraft.jar") (dir "/home/user/temp/Vanilla 1.8") (args (list "-jar" jar "nogui"))) (setf *proc* (sb-ext

Is this an implementation-specific behavior for literal cons?

拟墨画扇 提交于 2019-12-10 21:38:28
问题 I'm testing out the code in this interesting answer. CL-USER> (defun literal-cons () (let ((cons '(1 . 2))) (incf (cdr cons)) cons)) ; in: DEFUN LITERAL-CONS ; (INCF (CDR CONS)) ; --> LET* ; ==> ; (SB-KERNEL:%RPLACD #:CONS1 #:NEW0) ; ; caught WARNING: ; Destructive function SB-KERNEL:%RPLACD called on constant data. ; See also: ; The ANSI Standard, Special Operator QUOTE ; The ANSI Standard, Section 3.2.2.3 ; ; compilation unit finished ; caught 1 WARNING condition LITERAL-CONS CL-USER>

SBCL Run Shell Command

♀尐吖头ヾ 提交于 2019-12-10 20:43:32
问题 I've seen Executing a shell command from Common Lisp and its answers, but I'm still not sure whether SBCL provides a way execute shell commands from code. The SBCL Manual does support POSIX, but I was hoping for something a bit more higher level. Specifically, I want to call a Python script and capture the return value. Is there any way to do this? 回答1: Given the file test.py : import sys sys.exit(42) You can run it with sb-ext:run-program and examine the exit code as follows: CL-USER> (sb

How to export slots and accessors from Lisp classes?

痴心易碎 提交于 2019-12-10 17:56:16
问题 This is my class's package: (in-package :cl-user) (defpackage foo (:use :cl) (:export :bar)) (in-package :foo) (defclass bar () (baz)) I can create an instance of bar in package cl-user . CL-USER> (defvar f) F CL-USER> (setf f (make-instance 'foo:bar)) #<FOO:BAR {10044340C3}> But I can't access the member baz . Calling slot-value like so ... CL-USER> (slot-value f 'baz) ... results in this error message: When attempting to read the slot's value (slot-value), the slot BAZ is missing from the

In LISP is it possible to access a function's form?

℡╲_俬逩灬. 提交于 2019-12-10 13:57:03
问题 Suppose I define a function globally: (defun x (y) (1+ y)) ;; Edit: my first example was too complicated Is it possible to "coerce" the function x into a list like: (x (y) (1+ y)) Thanks in advance! PS - @Danlei's example works in Clozure CL with a special flag, however does anyone know how to get FUNCTION-LAMBDA-EXPRESSION to work in SBCL? 回答1: You could try FUNCTION-LAMBDA-EXPRESSION: (function-lambda-expression #'foo) But it's not guaranteed to work ("… implementations are free to return `

CLOS make-instance is really slow and causes heap exhaustion in SBCL

こ雲淡風輕ζ 提交于 2019-12-10 12:57:10
问题 I'm writing an multiarchitecture assembler/disassembler in Common Lisp (SBCL 1.1.5 in 64-bit Debian GNU/Linux), currently the assembler produces correct code for a subset of x86-64. For assembling x86-64 assembly code I use a hash table in which assembly instruction mnemonics (strings) such as "jc-rel8" and "stosb" are keys that return a list of 1 or more encoding functions, like the ones below: (defparameter *emit-function-hash-table-x64* (make-hash-table :test 'equalp)) (setf (gethash "jc

This is a bug in sbcl?

孤街浪徒 提交于 2019-12-10 05:32:15
问题 Why happen this in sbcl? Maybe a bug? (defclass myclass () ((s1 :initform '((a . 1) (b . 2))) (s2 :initform '((a . 1) (b . 2))))) (defparameter ins (make-instance 'myclass)) (setf (cdr (assoc 'a (slot-value ins 's1))) 43) ;; change only slot s1 ;; here my problem (slot-value ins 's1) ;; => ((a . 44) (b . 2))) (slot-value ins 's2) ;; => ((a . 44) (b . 2))) But if change :initform to : (defclass myclass () ((s1 :initform '((a . 1) (b . 2))) (s2 :initform '((a . 1) (b . 3))))) The problem

Matrix-multiplication using BLAS from Common Lisp

我是研究僧i 提交于 2019-12-09 04:11:35
Let's say I have two matrices (in the form of a Common Lisp array) foo and bar such that: (defvar foo #2A((2 1 6) (7 3 4))) (defvar bar #2A((3 1) (6 5) (2 3))) I would like to perform a matrix multiplication using BLAS without using wrappers such as Matlisp, GSLL, LLA, & co. so that I get an array with the result: #2A((24 25) (47 34)) Which steps should I take to perform such operation? My understanding is that I should call the BLAS matrix multiplication function from the REPL and pass it my arguments foo and bar. In R, I can easily do it like this: foo %*% bar How can I do it in Common Lisp?

How can I determine the operating system and hostname using common lisp?

别来无恙 提交于 2019-12-08 17:36:12
问题 To get my .sbclrc file working on the two computers I use, I'd like a way to get the hostname and/or operating system from within sbcl. I know I could set and then look for an environment variable, but is there a more direct approach? Update I changed the question to refer to common lisp, since the answer from Ken is not specific to sbcl. 回答1: I'd use the 'environment' functions: * (machine-instance) "myhostname" * (machine-type) "X86-64" * (machine-version) "Intel(R) Core(TM)2 Quad CPU Q6600