I use quicklisp to install linedit, http://www.cliki.net/Linedit say "Should work on Lispworks and OpenMCL/CCL." how to write $HOME/.ccl-init.lisp?
In the meantime, linedit has been made to work with ccl (linedit 0.17.5 with ccl 1.8).
I added this to .ccl-init.lisp:
(when (interactive-stream-p *standard-input*)
(ql:quickload "linedit")
(funcall (intern "INSTALL-REPL" :linedit)))
I just installed Linedit through Quicklisp on CCL 1.7 on Linux and I don't think it works. Observe:
? (ql:quickload "linedit")
; Fetching #<URL "http://beta.quicklisp.org/dist/quicklisp/2011-07-30/systems.txt">
[...]
[package linedit]...........................
("linedit")
? (linedit:install-repl)
> Error: LINEDIT:INSTALL-REPL is unsupported on Clozure Common Lisp.
> While executing: LINEDIT:INSTALL-REPL, in process listener(1).
> Type :POP to abort, :R for a list of available restarts.
> Type :? for other options.
1 >
I also do not see "Should work on Lispworks and OpenMCL/CCL." mentioned on the page you linked to. It appears to be mostly SBCL specific.
rlwrap does work but that only gives you history, not completion.
Related
I'm a beginner in lisp and I'm unable to find out how to correctly use defpackage to load qtools (on arch linux).
For simplicity if I run this example project in sbcl with loaded quicklisp
https://github.com/Shinmera/qtools/tree/master/examples/helloworld
this error appears
While evaluating the form starting at line 8, column 0
of #P"/home/william/code/upol/lisp/helloworld/helloworld.lisp":
debugger invoked on a PACKAGE-DOES-NOT-EXIST in thread
#<THREAD "main thread" RUNNING {1000508083}>:
The name "CL+QT" does not designate any package.
Why "cl+qt" is not provided by any of installed packages with quickload?
Here is a list of installed packages
$ ls ~/.quicklisp/dists/quicklisp/software
Thanks for help
My resources:
https://github.com/Shinmera/qtools
https://lispcookbook.github.io/cl-cookbook/getting-started.html
Let's look at the example. The order of actions is:
compile the .asd file (for example, with C-c C-k). This creates the qtools-helloworld system.
load "qtools-helloworld" and its dependencies with Quicklisp: (ql:quickload :qtools-helloworld).
compile helloworld.lisp (again, with C-c C-k), and call its functions.
Also, look at Qtools readme: https://github.com/Shinmera/qtools#qtools-1 It says to install these 3 libraries:
(ql:quickload '(qtools qtcore qtgui))
The cl+qt package is provided by one of these systems.
update: the steps required to run the helloworld from the command line are:
load the asd definition: rlwrap sbcl --load qtools-helloworld.asd. (rlwrap is just a readline utility)
you are dropped into the Lisp REPL. Now we install the dependencies with Quicklisp, that you must have installed first. You type this into the Lisp REPL: (ql:quickload :qtools-helloworld). That is the name defined in the asd.
now you can compile the .lisp file: (load "helloworld.lisp):
* (ql:quickload :qtools-helloworld)
To load "qtools-helloworld":
Load 1 ASDF system:
qtools-helloworld
; Loading "qtools-helloworld"
[package qtools-helloworld]....
(:QTOOLS-HELLOWORLD)
it didn't show a GUI. We'll call the main function:
(qtools-helloworld::main)
and you should see the example. If you make changes to the lisp file you can load it again. This use of the REPL in the terminal works but is not as interactive as Lisp can be (far from it). You want your editor to be connected to the REPL and send changes automatically, with a keystroke.
Check out the Cookbook, editors section, Atom support is very good with SLIMA.
ps: I find Qtools a little bit difficult, passed running the provided examples. It is not as easily discoverable as other GUIs (like Ltk or IUP). Hope you'll prove me wrong though.
pps: also https://lispcookbook.github.io/cl-cookbook/gui.html#qt4
You need to install the qtools system.
A system is a way to organize software libraries
A package is a namespace
The two are theoretically unrelated. But often, when you load a system X, it defines a package named X.
In some cases (like qtools) there are many packages for one system, for example because the system wants to define different levels of API.
Another way to define multiple packages when loading one system comes from the fact that ASDF version 3.1 supports an extension copied from other build systems named package-inferred-systems, where each source file is implicitly mapped to one system and one package.
Here is a snippet of what Quicklisp shows when installing qtools:
* (ql:quickload :qtools)
To load "qtools":
Load 14 ASDF systems:
array-utils asdf bordeaux-threads cffi cl-ppcre
closer-mop dissect documentation-utils form-fiddle
named-readtables qt+libs trivial-features
trivial-garbage trivial-indent
... ... ...
To load "qtools":
Load 1 ASDF system:
qtools
; Loading "qtools"
[package uiop/package]............................
..................................................
[package cffi-sys]................................
[package cffi]....................................
..................................................
[package cffi-features]...........................
[package qt-libs].................................
[package qt]......................................
..................................................
[package deploy]..................................
[package dissect].................................
[package simple-tasks]............................
[package trivial-main-thread].....................
[package qtools]..................................
[package cl+qt]...................................
.............................
(:QTOOLS)
Quicklisp is able to intercept and print new packages when they are defined. Here above we can see that there are multiple packages defined while loading quicklisp, either (1) packages defined by the dependencies of qtools, or (2) packages defined by qtools itself. Here both qtools and cl+qt are packages defined by the qtools system.
Packages are not declared in systems, so you need to rely on documentation to know what packages a system defines.
Here's how to simulate it.
$ cat t1.rkt
#lang racket/base
(require gregor)
(display "hello")
I'm running Racket 6.12. But the same happens to Racket 7.2.
$ racket t1.rkt
explode-path: contract violation
expected: (or/c path-for-some-system? path-string?)
given: #f
context...:
/usr/share/racket/collects/racket/path.rkt:116:0: do-explode-path
/usr/share/racket/collects/racket/path.rkt:126:0: find-relative-path7
/home/me/.racket/6.12/pkgs/tzinfo/tzinfo/private/zoneinfo.rkt:118:2: for-loop
/home/me/.racket/6.12/pkgs/tzinfo/tzinfo/private/zoneinfo.rkt:108:0: read-tzids
/home/me/.racket/6.12/pkgs/tzinfo/tzinfo/private/zoneinfo.rkt:71:0: make-zoneinfo-source
/usr/share/racket/collects/racket/contract/private/arrow-val-first.rkt:388:18
/home/me/.racket/6.12/pkgs/tzinfo/tzinfo/main.rkt:63:0: system-tzid
/usr/share/racket/collects/racket/contract/private/arrow-val-first.rkt:388:18
/home/me/.racket/6.12/pkgs/gregor-lib/gregor/private/moment.rkt: [running body]
/home/me/.racket/6.12/pkgs/gregor-lib/gregor/private/generics.rkt: [traversing imports]
/home/me/.racket/6.12/pkgs/gregor-lib/gregor/private/clock.rkt: [traversing imports]
/home/me/.racket/6.12/pkgs/gregor-lib/gregor/main.rkt: [traversing imports]
/home/me/issue-gregor/t1.rkt: [traversing imports]
$ racket --version
Welcome to Racket v6.12.
How could I go back to an older version of gregor? I installed it this one with raco pkg install gregor and installed all its dependencies.
I'm the author of Gregor. (I don't normally post on Stack Overflow, or even use it much, but John Clements brought this to my attention.)
There's a bit of an unfortunate naming issue here, since tzdata appears to be the name of an Ubuntu package that provides the normal zoneinfo files, as well as being the name of a Racket package that also provides those files.
gregor depends on a package called tzinfo. tzinfo, in turn, conditionally depends on tzdata (the Racket one, not the Ubuntu one). Specifically, it only depends on tzdata on Windows systems. This is because I assumed that all Unix systems would have the zoneinfo files. (It never occurred to be that anyone would run a Unix without them these days.) But it is certainly the case that tzinfo (and thus gregor) will not work unless it can find zoneinfo files.
Maybe I should update the documentation with a conspicuous warning. I'd rather not make tzinfo unconditionally depend on tzdata (again, the Racket one), because most Unix systems will already have the necessary files, and it could be unduly confusing for gregor to use a version of them different from the one the system is using.
I tried to install Lisplab with asdf and quicklisp but they all turned out to fail.
I use sbcl and slime.
Anyone can help me with installation. And I just want to manipulate matrix within lisp:)
Thanks, lisper!
The first thing to do about installing a lisp library using quicklisp, is see if it is available via quicklisp:
(Note for this answer I'm using the configuration roswell slime sbcl on antergos)
CL-USER> (ql:system-apropos "lisplab")
; No value
In this case the project it is not included, you can update your quicklisp, but in this case it is not necessary. this project is not in quicklisp and maybe will not be in the future. then you can choose to continue installing it or search for an atertnative for this thake a look a quickdocs this is a search about math
Let's try to install this quicklisp says this:
Can I load a local project that isn't part of Quicklisp? Yes. The
easiest way is to put the project's directory in Quicklisp's
local-projects directory. For example:
$ cd ~/quicklisp/local-projects/
$ git clone git://github.com/xach/format-time.git
The project will then be loadable via (ql:quickload "format-time")
Also, any system file that can be found via ASDF's source registry
system can be loaded with ql:quickload.
For example, if you have a system file my-project.asd in
/projects/my-project/, you can do something like this:
(push #p"/projects/my-project/" asdf:*central-registry*)
(ql:quickload "my-project")
If my-project depends on systems that are available via Quicklisp that
are not already installed, they will be automatically installed.
so for this project I will download the tarball and extract or download the repository in the local-projects folder, like it is suggested in a comment. In my case is ./roswell/local-projects but in your case should be cd ~/quicklisp/local-projects/
After that you "can" load with quicklisp, but I believe that since this library is not maintained, it will have errors,
If you want to manipulate matrix with lisp I recommend you to use lisp-matrix be sure to have installed lapack in your computer and read the documentaaion carefully especcilay the code at the end of the readme and also the tests.
CL-USER> (ql:quickload :lisp-matrix)
To load "lisp-matrix":
Load 1 ASDF system:
lisp-matrix
; Loading "lisp-matrix"
(:LISP-MATRIX)
CL-USER> (in-package :lisp-matrix-user)
#<PACKAGE "LISP-MATRIX-USER">
LISP-MATRIX-USER> (M* (ones 2 2 :implementation :lisp-array)
(ones 2 2 :implementation :lisp-array))
#<LA-SIMPLE-MATRIX-DOUBLE 2 x 2
2.0d0 2.0d0
2.0d0 2.0d0>
(be aware that foreign-array doesn't work for integers)
$ecl
;;; Loading "/home/***/quicklisp/setup.lisp"
;;; Loading #P"/usr/local/lib/ecl-12.7.1/cmp.fas"
;;; Loading #P"/usr/local/lib/ecl-12.7.1/asdf.fas"
ASDF could not load sockets because
An error occurred during initialization:
Error while trying to load definition for system sockets from pathname
/usr/local/lib/ecl-12.7.1/sockets.asd:
No applicable method for SOURCE-FILE-TYPE with arguments of types COMPILED-FILE PREBUILT-SYSTEM.
$cat ~/.eclrc
;;; The following lines added by ql:add-to-init-file:
#-quicklisp
(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp"
(user-homedir-pathname))))
(when (probe-file quicklisp-init)
(load quicklisp-init)))
Regards!
You do not provide any information about the version of quicklisp or the version of ECL you are using, what makes it hard to answer your question.
I presume you are using ECL 12.7.1, which is too old to work with recent versions of ASDF+quicklisp. Moreover, there was a problem with a recent quicklisp that shipped a version of ASDF that was incomplete: it did not load ASDF-bundle and support loading precompiled libraries.
All these problems have been solved in the CVS/git sources and I will produce a new release any time soon.
Juanjo
I'm just starting with Clojure and can't access to the doc function.
I'm using clojure 1.3 with emacs24 and swank-clojure.
user> *clojure-version*
{:major 1, :minor 3, :incremental 0, :qualifier nil}
But when I try:
(doc doc)
I get:
Unable to resolve symbol: doc in this context
[Thrown class java.lang.RuntimeException]
I've read Why does REPL treat clojure.core/doc as a var? and as suggested:
(clojure.repl/doc doc)
But then, I receive:
clojure.repl
[Thrown class java.lang.ClassNotFoundException]
It seems I am not "importing" the usual namespaces, but really doesn't know how to do it.
Thanks.
UPDATE
Using clojure from java (java -jar ...) it works well, so it's a problem with the emacs setup.
You need to grab the clojure.repl namespace one way or another:
From the REPL
user> (use 'clojure.repl)
user> (doc doc)
or in your program
(ns foobar
(:use [clojure.repl]))
Add the following to your Leiningen user.clj file (on Mac / Linux, it's ~/.lein/user.clj):
;; ~/.lein/user.clj
(if (>= (.compareTo (clojure-version) "1.3.0") 0)
(do (use 'clojure.repl)
(use 'clojure.java.javadoc)))
This will cause Leiningen to automatically import those two namespaces at startup for projects using Clojure 1.3.0 and later (but not for projects using Clojure 1.2.1 or earlier - where doc and source were always available).
Credit goes to Matthew Boston for this. Note also Phil Hagelberg's reply which points out most of the REPL-specific functionality is accessible directly in Emacs / Slime without needing the functions directly in the REPL.
As of Lein 2, namespaces can be automatically imported at startup using :injections, e.g:
;; ~/.lein/profiles.clj
{:user {:plugins [[lein-swank "1.4.4"]
[lein-noir "1.2.1"]
[lein-pprint "1.1.1"]]
:injections [(use 'clojure.repl)
(use 'clojure.java.javadoc)
(use 'clojure.pprint)] }}
But see other responses for SLIME equivalents.
I'm unsure of when this became the case, but as of lein 2.2 doc is available at the repl by default.