04.08.2020»»вторник

Best Common Lisp For Os X

04.08.2020
Best Common Lisp For Os X Average ratng: 8,8/10 1687 votes

Macro WITH-SLOTS. Syntax: with-slots (slot-entry.) instance-form declaration. form. = result. slot-entry::= slot-name (variable-name slot-name) Arguments. MCL is a freeware command-line-only version of Macintosh Common Lisp, which runs under MacOS X nicely. It is much faster than CLISP on the Mac, but its debugging facilities are primitive. It is much faster than CLISP on the Mac, but its debugging facilities are primitive.

I am writing a lisp function and I keep getting EVAL - undefined function x when I try to return the value of x from the function.

I believe the error is caused by the x at the end of the function but I cant see why, as far as I can tell my brackets are correctly paired up and I cant see why it is trying to evaluate x as a function.

The problem is in isinlist which is called recursively as (isinlist(x (cdr y))). (x ..) is interpreted as a function call of function x. You probably want (isinlist x (cdr y)) instead.

Incidentally, you can replace isinlist with member (with :key #'cdr :test #'equal).

If strings are vectors, why are they immutable?

lisp,common-lisp

Strings are not immutable in Common Lisp, they are mutable: * is the last result from the Lisp listener CL-USER 5 > (make-string 10 :initial-element #-) '----------' CL-USER 6 > (setf (aref * 5) # ) # CL-USER 7 > ** '----- ----' CL-USER 8 > (concatenate 'string 'aa' '(#b #b)) 'aabb'..

Dynamic 2d array in lisp

common-lisp,clisp

Arrays in Common Lisp can have fill pointers, which provides a way to treat an array as something which can grow and extend its length. Your 2-D array could be realized as an array of arrays with fill pointers. E.g.: (defun make-row-resizeable-array (rows max-columns) 'Returns an array of length ROWS..

How to use a parameter in a macro call?

macros,lisp,common-lisp,sbcl

I would use something like this: CL-USER 86 > (defmacro define-class (class-name) `(defclass ,class-name ()())) DEFINE-CLASS CL-USER 87 > (defun create-data (mode) (funcall (compile nil `(lambda () (define-class ,mode))))) CREATE-DATA CL-USER 88 > (create-data 'bar) #<STANDARD-CLASS BAR 402016CC73> Above uses code generation and the built-in compiler..

where is the text printed by C printf

io,common-lisp,cffi

The problem is that C's stdio library has its own buffering that has nothing to do with Lisp's. Flushing the output requires you to have a pointer to C's FILE *stdout variable. You can get this pointer like this: (cffi:defcvar ('stdout' stdout) :pointer) Then, after using printf: (cffi:foreign-funcall 'fflush' :pointer..

Creating A Process Queue in Common Lisp

You could set up a single worker thread which receives instructions from a message queue. I have used chanl in the past for similar things, but there are several other options.

how to change the value of sp-navigate-reindent-after-up in smartparens

emacs,lisp,elisp,parentheses

I am not a smartparens user but I found the answer from its wiki: You can bind ) to sp-up-sexp command: (define-key smartparens-mode-map ')' #'sp-up-sexp) ..

Exceed evaluation depth when forward function in Emacs Lisp

emacs,lisp,elisp

How about using lexical-let to penetrate the lambda? Is the correct answer 100? (defun enumerate-indicies (func) (let ((index 0)) (while (< index 5) (funcall func index) (setq index (1+ index))))) (defun enumerate-multiplied-indicies (func) (lexical-let ((func func)) (enumerate-indicies #'(lambda (index) (funcall func (* 10 index)))))) (defun test/enumerate-multiplied-indicies () (lexical-let ((sum 0))..

How to move a file in Lisp using rename-file

lisp,common-lisp,pathname

I'm usually using: (make-pathname :defaults old-path :directory (butlast (pathname-directory oldpath))) The :defaults argument makes sure that all relevant parts of the old pathname are being copied over..

Printing ith row jth column value in lisp

arrays,multidimensional-array,lisp,clisp

Because you are using an array of lists how about: (defun element-of-matrix (matrix i j) (nth j (aref matrix i))) ..

Weird non-lisp errors with capturing labels with a lambda and `reduce`

lambda,crash,closures,common-lisp,allegro-cl

This is a compiler bug. Please contact Franz. CG-USER(8): (disassemble (lambda-producer)) ;; disassembly of #<Closure Template Function (:INTERNAL LAMBDA-PRODUCER 0)> ;; formals: X ;; closure vectors: ;; 0: #<Closure (LABELS LAMBDA-PRODUCER PRODUCER-LABEL2) @ #xdfdda7a> ;; 1: #<Function (LABELS LAMBDA-PRODUCER PRODUCER-LABEL)> ;; constant vector: 0: #<Closure Template Function (:INTERNAL (:INTERNAL LAMBDA-PRODUCER..

How do I best save/read data structures?

common-lisp,clos

If I understand correctly, you could store the values and associated symbols as pairs in the file, so something like this: (x . (1 2 3 4)) (y . (6 7 8 1)) And when you parse it out, use something like this: (let ((pair (read)) (set (car pair) (cdr..

What does the non-terminating-p argument of set-macro-character do?

macros,common-lisp

If you set non-terminating-p to t the macro character can appear unescaped within a symbol name (like # in the symbol foo#baz). If you leave it nil and the reader encounters the macro character while accumulating a symbol it terminates the collection of the symbol (like ' in foo'bar, which..

Insertion into a list doesn't reflect outside function whereas deletion does?

list,lisp,common-lisp

Append isn't supposed to modify anything Why doesn't append affect list y? The first sentence of the documentation on append is (emphasis added): append returns a new list that is the concatenation of the copies. No one ever said that append is supposed to modify a list. You can't change..

May 25, 2020  How to Format WD My Passport in macOS/OS X Platform. Repartition and format a hard drive. Once the process begins, all the data on the drive will be lost! Connect WD My Passport to your Mac. Once that's done, double left-click on the Mac HD, the internal Mac hard drive visible on the top-right corner of the desktop screen. Aug 16, 2019  Hello all, Today I bought the 4tb “My Passport” from Best Buy. I came home to set it up and backup my computer (a 2015 MacBook Pro running El Capitan 10.11.6) Before I did anything to it, I read through the user’s guide and saw that I needed to format it to use with my MacBook. So, I followed the steps- I went into Disk Utility, selected “My Passport,” clicked “erase,” selected. Formatting my passport for mac os x. Oct 20, 2019  And there you have it, you’ve formatted your WD My Passport for Mac in 10 quick steps. YouTube Video Showing the Format of WD My Passport for Mac. This video from Acquevara shows you the formatting on a Mac using Mac OS Sierra. You can watch the video along side using my. In the next 5 minutes read, you will master yourself in formatting a WD My Passport safely and in a manner best suited for sharing your digital files between a macOS and Windows OS. To format a Western Digital My Passport external hard drive in ex-FAT or FAT32 format, you can bank on built-in applications of Mac.

SBCL: Deploying Hunchentoot application as executable

common-lisp,executable,sbcl,hunchentoot

(ql:quickload :hunchentoot) (use-package :hunchentoot) (defun main () (hunchentoot:start-server :port 8082) (sb-thread:join-thread (find-if (lambda (th) (string= (sb-thread:thread-name th) 'hunchentoot-listener-1')) (sb-thread:list-all-threads)))) No explicit code is required to give you access to a REPL if you keep a terminal open (perhaps via GNU Screen). Send Ctrl+C to the terminal to break into the..

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

macros,common-lisp,symbols,sbcl

That's a usual problem: what gets passed to a Macro? Compare calls like this: (symb 'book '-p) and (symb 'book '-p) Your macro form is this: (gen-predicate 'book) GEN-PREDICATE is a macro. classname is a parameter for this macro. Now what is the value of classname inside the macro during..

Get element from list of list in lisp

lisp,elisp,common-lisp

(defun get-element (list name) (cadr (assoc name list :test #'string=))) ..

No-argument (and) returns t

clojure,scheme,lisp,common-lisp

The empty product is 1. The reason is that 1 is a neutral element for *. If you have the product of 2 and 3 and then multiply by the product of nothing, you will get 2*3*1 = 6. We can write (product (product 2 3) (product)) = (product 6..

How to use FFI:def-call-in in clisp

lisp,common-lisp,ffi,clisp

Example 32.7. Calling Lisp from C: To sort an array of double-floats using the Lisp function SORT instead of the C library function qsort, one can use the following interface code sort1.c. The main problem is to pass a variable-sized array. extern void lispsort_begin (int); void* lispsort_function; void lispsort_double (int..

Best Common Lisp For Os X 8

Is there a way to insert raw javascript in parenscript code?

common-lisp,parenscript

Added this to parenscript's non-cl.lisp file: (define-expression-operator lisp-raw (lisp-form) `(ps-js:escape ,lisp-form)) (defun lisp-raw (x) x) Result: (ps (let ((x (ps::lisp-raw (json:encode-json-alist-to-string '((:a . 1) (:b . 2)))))))) '(function () { var x = {'a':1,'b':2}; return null; })();' ..

Local dynamic binding in common lisp

closures,common-lisp,dynamic-binding

First, a dynamic variable only takes its value from dynamic bindings, not lexical: (defun f () (declare (special x)) x) (let ((x 1)) ;; without this declaration, we would get an unbound variable error (declare (special x)) (f)) ;; => 1 You can achieve a default value for a local..

Read input into string in Lisp reader macro

macros,common-lisp,reader-macro

You can try to use read and then look at what it returns: (defun string-reader (stream char) (declare (ignore char)) (let ((this (let ((*readtable* (copy-readtable))) (setf (readtable-case *readtable*) :preserve) (read stream t nil t)))) (etypecase this (string this) (symbol (symbol-name this))))) (set-macro-character #@ #'string-reader) Above would allow @This and @'This',..

Updating the window in response to CLIM frame commands

common-lisp,clim,mcclim

Common Lisp Book

Drawing the maze in the command is not the right approach. Putting a maze-stream into a global variable is also bad. ;-) The display pane has a :display-function. The idea is that after a command the whole application frame gets updated automagically. For example for :display-time :command-loop, the display pane..

Modify list and return it inside a function in lisp

lisp,elisp,common-lisp

You can use setf and the nth accessor: (defun replace-index (node index new-value) (setf (nth index node) new-value) node) (defparameter *orig* (list 1 2 3 4)) (defparameter *mod* (replace-index *orig* 2 99)) (list *orig* *mod*) ; > ((1 2 99 4) (1 2 99 4)) ..

Trying to multiply all elements in a list of sublists with elements in another list in lisp

list,common-lisp

It's a lot easier than that. Remember that mapcar can take more than one list. Thus: (defun kmult-matrix (m k) (mapcar (lambda (list k) ;; inside here you get a list and ;; it's corresponding multiplier k ..) m k)) The result from the outer map would be a list..

Best Common Lisp For Os X 11

Value from binding in LFE interpreter using Erlang

erlang,lisp,lfe

Common

I won't attempt to answer completely your broader question about the 'best practices' of adding scripting. It seems to me that choosing between 'hook-based' solution (in which you define hook implementations by name convention and they are automatically recognized) and 'explicit api' solution (in which you use functions predefinied in..

EMACS-Live + Slime error at startup

emacs,common-lisp,slime,kubuntu

CHAMPAGNE !!! Reinstalled my VM, done all steps one by one and that wasn't ok. I had to launch twice the 'bash <(curl -fksSL https://raw.github.com/overton..' command line once all other steps was executed and say 'No' to the question asking if I want to create a personnal folder. Don't know..

Best Common Lisp For Windows

Structuring large Lisp applications

lisp,common-lisp,quicklisp,asdf

System For structuring large system use a system management tool. A 'free' one is ASDF. You would need a system declaration, which lists the parts of you library or application. Typically it goes into an own file. Then you load a system or compile a system. There should be tutorials..

Return items of a list in Lisp

You can get the length of a list with length. (length '(a b c)) ;; 3 You can then go and check that number against the predicate function evenp, which returns T or NIL depending on if the argument is even or not. (evenp 1) ;; NIL (evenp 2) ;;..

What is a common-lisp analogue of python's argparse?

python,common-lisp,argparse

There are a few including: command-line-arguments -- http://cliki.net/command-line-arguments getopt -- https://github.com/keithj/getopt unix-options -- https://github.com/astine/unix-options I haven't actually tried any of them but hopefully one of them fits your needs..

Common Lisp Object System method execution order

lisp,common-lisp,clos

When you don't have any around methods, the order of method application is: all before methods from most specific to least specific, then the most specific primary method, and then the after methods from least specific to most specific. In your case you have two primary methods (methods without :before..

Best Common Lisp For Os X 1

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

common-lisp,hang,sbcl

I also think that could be some buffer problem. However, if you read from :stream line by line, that works fine: (let ((process (run-program '/bin/bash' (list '-c' 'cat test.out') :output :stream :wait nil))) (loop for line = (read-line (process-output process) nil :eof) until (eq line :eof) do (print line))) ..

lisp: dynamic scope vs explicit parameter passing

design-patterns,coding-style,common-lisp,anti-patterns,dynamic-scope

Actually you can bind *standard-output* directly: (defun test-im-vs-ex-plicit () (values (with-output-to-string (*standard-output*) ; here (implicit)) (with-output-to-string (stream) (explicit stream)))) There is no real simple answer. My advice: Use stream variables, this makes debugging easier. They appear on the argument lists and are easier to spot in the backtrace. Otherwise you..

Invalid specialized parameter in method lambda list

lisp,common-lisp

For defun without parameters, there should be an empty parameter list, like the following: (defun yn () (let ((ht (random 2))) (if (eq ht 1) (princ heads) (princ tails)))) ..

Running compiled lisp program with clisp-2.49 on OS X

common-lisp,clisp

This is a bug in clisp. Please report it on SF. Note that this works as it should on Ubuntu with the vanilla distribution.

in clojure, function argument type mismatch

clojure,functional-programming,lisp

You are misunderstanding the format of a function definition. In your function, the single argument 'colors' is untyped and can be anything. The square brackets are used to denote the beginning and end of the arguments list (i.e. the symbols for the arguments are wrapped in a vector to distinguish..

Backquote String Interpolation

macros,lisp,common-lisp

Lisp macros operate on arguments that have already been read by lisp's reader. Because of that a macro can't change how it's arguments are read, and if you pass an argument that will signal an error when you try to read it, e.g. 9:00 in (test 9:00), the reader signals..

SBCL: Gather output of run-program process while running

subprocess,common-lisp,sbcl

Under Configuration Properties VC Directories, I edited Include Directories, adding the path to the directory in which the CL directory resides (note that I did not specify the path to CL itself). Opencl ati dev c++.

Experimenting with /bin/cat, I found some things that might help you. First, of all, always use finish-output after writing to the process's input: (format (process-input *cat*) 'Hello~%') (finish-output (process-input *cat*)) Otherwise, the input may not reach the subprocess until you close the input stream. If Minecraft requires input before it'll..

EVAL/APPLY: too many arguments given to F

lisp,common-lisp,clisp

This better formatting should make it easy to spot the error: (defun f (l) (cond ((null l) nil) ((listp (car l)) (append (f (car l))) (f (cdr l) (car (f (car l))))) (t (list (car l))))) If that does not help, use SBCL to compile the function. It will give..

LispWorks IDE

The LispWorks IDE provides a smooth and comfortable workflow, allowing you to incrementally write, test, and extend your software while it is running. It is included in LispWorks on all supported platforms. The LispWorks IDE is written using the CAPI portable GUI toolkit and therefore it runs natively on Mac OS X, Windows®, GTK+ and Motif®.

Debugger

The Debugger tool offers an intuitive graphical view of the stack, allows modification of variables and offers all the restarts. You can jump directly from a stack frame to point reached within the function's definition in an Editor tool displaying the source code.

Click image to enlarge.
The Debugger tool on Windows.
Click image to enlarge.
The Debugger tool on GTK+.
The Debugger tool on Mac OS X.

Listener

The Listener tool allows you to interact with the Lisp interpreter. You can easily transfer Lisp objects to other tools such as the Inspector, or invoke the graphical Debugger tool .

Click image to enlarge.
The Listener tool on Windows.
Click image to enlarge.
The Listener tool on GTK+.
The Listener tool on Mac OS X.

Editor

This is a powerful Lisp-aware code editor with built-in source location and syntax coloring. Commonly-used commands are accessible by menus and a wide range of commands is accessible either by Emacs keys or familiar platform-standard keys, all of which are customizable.

Click image to enlarge.
The Editor tool text view on Windows.
Click image to enlarge.
The Editor tool text view on GTK+.
The Editor tool text view on Mac OS X. Click image to enlarge.

Inspector

The Inspector tool is a graphical interface for the Common Lisp function inspect. It is used for speedy exploration of Lisp objects - just double click on a slot to inspect the value in the slot - and can also modify the values. Further, the Inspector can be configured with new views on your own data structures.

Click image to enlarge.
The Inspector tool on Windows.
Click image to enlarge.
The Inspector tool on GTK+.
The Inspector tool on Mac OS X.

The LispWorks IDE tools all work together smoothly. For example, a frequent operation is to transfer the inspected object to the Listener tool, achieved by the command Object > Listen.

Other Features

Other features of the LispWorks IDE include:

  • Stepper and tracer.
  • Browsers for classes, generic functions, and compilation errors.
  • Execution time profiler.
  • Supports an external EMACS editor via SLIME.
  • System tool supporting LispWorks defsystem and ASDF.
  • Incremental compiler and dynamic loader.
  • Source code location and cross-referencing tool.
  • On-line documentation in hypertext format.