ciel/docs
2020-12-07 13:28:54 +01:00
..
assets (minor) add assets/ 2020-12-02 14:20:48 +01:00
.nojekyll doc: setup docsify 2020-11-06 15:00:12 +01:00
_coverpage.md doc: setup docsify 2020-11-06 15:00:12 +01:00
_sidebar.md docs: each section its page and sub-sidebar 2020-12-07 13:28:54 +01:00
after-plus.jpeg doc: copy README to docs 2020-11-06 15:00:11 +01:00
alexandria.md auto-document the exported symbols for: alexandria, trivial-types 2020-12-02 00:04:26 +01:00
before.jpeg doc: copy README to docs 2020-11-06 15:00:11 +01:00
dependencies.md auto-document the exported symbols for: alexandria, trivial-types 2020-12-02 00:04:26 +01:00
FAQ.md doc: FAQ.org to md 2020-11-06 15:00:11 +01:00
index.html docs: mv libraries section into its own page 2020-12-07 13:28:54 +01:00
install.md docs: each section its page and sub-sidebar 2020-12-07 13:28:54 +01:00
language-extensions.md add bind from metabang-bind 2020-12-07 11:57:40 +01:00
libraries.md docs: mv libraries section into its own page 2020-12-07 13:28:54 +01:00
README.md docs: mv libraries section into its own page 2020-12-07 13:28:54 +01:00
serapeum.md doc: generate documentation of imported symbols into their own page (serapeum) 2020-11-06 15:00:11 +01:00
trivial-types.md auto-document the exported symbols for: alexandria, trivial-types 2020-12-02 00:04:26 +01:00

CIEL

CIEL is a collection of useful libraries.

It's Common Lisp, batteries included.

Questions, doubts? See the FAQ.

Install

See the installation instructions.

CIEL's custom REPL

This REPL is more user friendly than the default SBCL one:

  • it has readline capabilities, meaning that the arrow keys work by default (wouhou!) and there is a persistent history, like in any shell.

  • it has multiline input.

  • it has TAB completion.

  • it handles errors gracefully: you are not dropped into the debugger and its sub-REPL, you simply see the error message.

  • it has optional syntax highlighting.

  • it defines short helper commands:

:help => Prints this general help message
:doc => Prints the available documentation for this symbol
:? => Gets help on a symbol <sym>: :? str
:w => Writes the current session to a file <filename>
:d => Dumps the disassembly of a symbol <sym>
:t => Prints the type of a expression <expr>
:lisp-critic => Toggles the lisp-critic
:q => Ends the session.
  • it has a shell pass-through: try !ls.

Our REPL is adapted from sbcli. See also cl-repl, that has an interactive debugger.

Quick documentation lookup

The documentation for a symbol is available with :doc and also by appending a "?" after a function name:

ciel-user> :doc dict
;; or:
ciel-user> (dict ?

Shell pass-through

Use ! to send a shell command:

!ls
Makefile
README.org
repl.lisp
repl-utils.lisp
src
...

!pwd
/home/vindarel/projets/ciel

Use square brackets [...] to write a shell script, and use $ inside it to escape to lisp:

(dotimes (i 7) (princ [echo ?i]))

The result is concatenated into a string and printed on stdout.

This feature is only available in CIEL's REPL, not on the CIEL-USER package.

We use the Clesh library.

See also SHCL for a more unholy union of posix-shell and Common Lisp.

Syntax highlighting

Syntax highlighting is off by default. To enable it, install pygments and add this in your ~/.cielrc:

(in-package :sbcli)
(setf *syntax-highlighting* t)

;; and, optionally:
;; (setf *pygmentize* "/path/to/pygmentize")
;; (setf *pygmentize-options* (list "-s" "-l" "lisp"))

You can also switch it on and off from the REPL:

(setf sbcli:*syntax-highlighting* t)

Friendly lisp-critic

The :lisp-critic helper command toggles on and off the lisp-critic. The Lisp Critic scans your code for instances of bad Lisp programming practice. For example, when it sees the following function:

(critique
   (defun count-a (lst)
     (setq n 0)
     (dolist (x lst)
       (if (equal x 'a)
         (setq n (+ n 1))))
     n))

the lisp-critic gives you these advices:

----------------------------------------------------------------------

SETS-GLOBALS: GLOBALS!! Don't use global variables, i.e., N
----------------------------------------------------------------------

DOLIST-SETF: Don't use SETQ inside DOLIST to accumulate values for N.
Use DO. Make N a DO variable and don't use SETQ etc at all.
----------------------------------------------------------------------

USE-EQL: Unless something special is going on, use EQL, not EQUAL.
----------------------------------------------------------------------

X-PLUS-1: Don't use (+ N 1), use (1+ N) for its value or (INCF N) to
change N, whichever is appropriate here.
----------------------------------------------------------------------
; in: DEFUN COUNT-A
;     (SETQ CIEL-USER::N 0)
;
; caught WARNING:
;   undefined variable: N
;
; compilation unit finished
;   Undefined variable:
;     N
;   caught 1 WARNING condition
=> COUNT-A

generic-cl

https://github.com/alex-gutev/generic-cl/

todo:

generic-ciel

Example:

;; with a struct or class "point":
(defmethod equalp ((p1 point) (p2 point))
   ())

Final words

That was your life in CL:

and now: