FAQ Database Discussion Community


Emacs + SLIME + SBCL (Windows)

windows,emacs,lisp,sbcl,slime
I'm attempting to get Emacs, Slime and SBCL to work together on a Windows 7 machine. I use Linux typically, so I'm not experienced with the process. The problem is that I get this error when I attempt to start SLIME: Searching for program: permission denied, sbcl Here's my Emacs...

How to read sbcl deterministic profiler output?

profiling,common-lisp,profiler,sbcl
How is the output of the deterministic profiler of sbcl to be interpreted? seconds | gc | consed | calls | sec/call | name ------------------------------------------------------- seconds (total execution time),calls (amount overall calls),sec/call (average time per call), and name (well the name of the function) are quite straight forward. What does...

How to get the POST as parameter of a function in Hunchentoot?

post,common-lisp,sbcl,hunchentoot
I want to use a web formular to filter records stored in mongo-db. My query function uses a filter as followed: (defun models (filter) (docs (db.find *model-collection* filter :limit 1))) And when I use it in SBCL, it can retrieve the record {"NAME" :"a1"}, with one of the following command:...

How to use grid:slice in LISP?

common-lisp,sbcl
When I do : (grid:subgrid #( 1 2 3 4) '(1) '(2)) , i get 3. But when I do: (grid:subgrid #( 1 2 3 4) '(1) '(* 2 1)) ,i get the following error: #<TYPE-ERROR expected-type: LIST datum: 2>. Does anyone have a hint?...

How to read, write, and compute with binary numbers?

common-lisp,sbcl
I am developing a calculator with SBCL and want to accept and display numbers in binary. Common Lisp's default reading and writing uses base 10 (i.e., decimal). Is there a way to easily read and write numbers in binary? If so, do I need to use different arithmetic functions to...

SBCL: Deploying Hunchentoot application as executable

common-lisp,executable,sbcl,hunchentoot
Dear StackOverflow community, I started playing with SBCL Common Lisp and want to develop a small web application using Hunchentoot. For easy deployment I planned to save everything in a binary using sb-ext:save-lisp-and-die as I can live with the big output size. For the executable you need to supply a...

Long integer to string and vice versa, operation with digits

common-lisp,sbcl
Solving the Euler project problems I get that I need to make operations with the digits of a long number normally as a string. I work in linux, emacs, slime with sbcl. For example, to get the sum of the digits of this power 2¹⁰⁰⁰, I work this way, 1)...

How to use a parameter in a macro call?

macros,lisp,common-lisp,sbcl
I have defined the following simple macro: (defmacro define-class (class-name) `(defclass ,class-name ()())) And now I want to use it in the following function: (defun create-data (mode) (define-class mode)) After compiling the last function I get the following message, the variable MODE is defined but never used. And when I...

sbcl run-program hang when there is large amount of output from program

common-lisp,hang,sbcl
Recently I find a run-program hang issue of sbcl 1.2.7 (32bits, linux). The code as following (progn (with-open-file (s "test.out" :direction :output :if-exists :supersede) (loop repeat 900 do (write-line (make-string 76 :initial-element #\x) s))) (run-program "/bin/bash" (list "-c" "cat test.out") :output :stream)) That is when the "cat test.out" produce many...

What's the simplest Common Lisp idiom for queued execution of function calls?

common-lisp,sbcl
For instance, if I have a database, and the client code queries the database in a rather uniform fashion (through a wrapper macro), how would I go about putting the queries in a queue so that the queries are executed in order, the next running after the last has completed....

SBCL: Gather output of run-program process while running

subprocess,common-lisp,sbcl
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...

Common Lisp: How to quote parenthese in SBCL

lisp,common-lisp,sbcl,quote
In Common Lisp, the special operator quote makes whatever followed by un-evaluated, like (quote a) -> a (quote {}) -> {} But why the form (quote ()) gives me nil? I'm using SBCL 1.2.6 and this is what I got in REPL: CL-USER> (quote ()) NIL More about this problem:...

Common Lisp - Giving &rest Lists as Arguments

arguments,lisp,common-lisp,sbcl
As a result of musings around an exercism problem, I am trying to write a function that takes an input number and an arbitrary length list of divisors to test, along with the expected divisibility (i.e. remainder 0) as a boolean, returning true if all expectations are met (defaulting to...

Macro that defines functions whose names are based on the macro's arguments

macros,common-lisp,symbols,sbcl
*Note: Despite having frequented StackOverflow for a long time, this is the first question that I have posted myself. Apologies if it's a bit verbose. Constructive criticism appreciated. When I define a struct in Common Lisp using defstruct, a predicate function is automatically generated that tests whether its argument is...

Get Thread ID in SBCL

common-lisp,sbcl
I am working with Lisp sb-thread package. When I use *current-thread* to get the thread id, the result of the last evaluated expression is also returned with the thread id. I only need the thread id for my program.

cffi function call hangs

common-lisp,sbcl,cffi
I want to use stat(2) from Common Lisp. I've defined the structs used by the stat function: (cffi:defctype mode_t :unsigned-int) (cffi:defctype ino_t :unsigned-int) (cffi:defctype dev_t :int) (cffi:defctype nlink_t :int) (cffi:defctype uid_t :unsigned-int) (cffi:defctype gid_t :unsigned-int) (cffi:defctype off_t :int) (cffi:defctype time_t :long) (cffi:defctype blksize_t :unsigned-int) (cffi:defctype blkcnt_t :int) (cffi:defcstruct stat (st_dev...

SBCL Run Shell Command

python,shell,lisp,common-lisp,sbcl
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...

SBCL REPL use up arrow keys to show history

read-eval-print-loop,sbcl
I have installed SBCL onto OSX through Macports. When inside the REPL, it would be very convenient to be able to use ↑ and ↓ to iterate through the previous commands (similar to the behavior in bash or Python's REPL). Is there a way to enable this functionality?...

Create an array of single-float from double-float in lisp?

lisp,common-lisp,sbcl
When I try to create a single-float array like this, i get: (make-array 2 :element-type 'single-float :initial-contents #(3.0 4.0)) , i get the following error: The value 3.0 is not of type SINGLE-FLOAT Is there a way to create a single-float array from a simple vector of double-float?...