CIEL is an extended CL
Find a file
2020-10-09 14:02:56 +02:00
.github add FUNDING just because. We can put several names. 2020-10-09 13:48:01 +02:00
src match, local nickname for trivia 2020-10-09 13:33:40 +02:00
.gitignore init 2019-03-23 13:04:03 +01:00
after-plus.jpeg README: before/after 2020-10-09 14:02:56 +02:00
before.jpeg README: before/after 2020-10-09 14:02:56 +02:00
ciel.asd actually export symbols in ciel-user (wait for trivial-do, conflict with generic-cl) 2020-10-09 13:25:04 +02:00
README.org README: before/after 2020-10-09 14:02:56 +02:00

EARLY LOW QUALITY DRAFT

CIEL Is an Extended Lisp

Packages:

  • ciel-user
  • generic-ciel: uses generic-cl instead of cl (todo)

What is this ?

Common Lisp, batteries included.

TODOs

  • settle on libraries that help newcomers
  • automate the documentation
  • distribute (Quicklisp, Qlot, Quicklisp distribution, Ultralisp, Ultralisp distribution (upcoming)…)
  • ship a binary
  • optionnal: create a tool that, given a CIEL code base, explains what packages to import in order to switch to "plain CL".

How to procede ?

This is an experiment. I'd be happy to give push rights to more maintainers. We will send pull requests, discuss, and in case we don't find a consensus for what should be on by default, we can create other packages.

Rules

  • don't install libraries that need a Slime helper to work in the REPL (cl-annot).
  • reader syntax changes may not be enabled by default.

Install

Clone, load the .asd, (ql:quickload "ciel") and (in-package :ciel-user).

Libraries

Data structures

access, generic and nested access to all common datastructures

https://github.com/AccelerationNet/access/

It's always

(access my-structure :elt)

hash-table utilities

str, a string manipulation library

Available with the str prefix.

https://github.com/vindarel/cl-str/

Data formats

JSON

CSV

Pattern matching

Use Trivia, also available with the match local nickname.

Numbers

Parsing numbers, floats, decimals

cl-decimals: parse and format decimal numbers

https://github.com/tlikonen/cl-decimals

The main interface are the functions parse-decimal-number and format-decimal-number. The former is for parsing strings for decimal numbers and the latter for pretty-printing them as strings.

Reading:

DECIMALS> (parse-decimal-number "0.24")
6/25


DECIMALS> (parse-decimal-number "12,345"
                                :decimal-separator #\,
                                :negative-sign #\)
-2469/200

Parsing:

DECIMALS> (format-decimal-number -100/6 :round-magnitude -3)
"-16.667"
("-" "16" "." "667")

DECIMALS> (loop for e from -5 upto 5
                do (print (format-decimal-number
                           (expt 10 e) :round-magnitude -5
                           :decimal-separator ","
                           :integer-minimum-width 7
                           :integer-group-separator " "
                           :fractional-minimum-width 7
                           :fractional-group-separator " ")))

"      0,000 01"
"      0,000 1 "
"      0,001   "
"      0,01    "
"      0,1     "
"      1       "
"     10       "
"    100       "
"  1 000       "
" 10 000       "
"100 000       "
NIL

Regular expressions

Use ppcre.

Threads, monitoring, scheduling

Bordeaux-Threads (bt prefix)

Lparallel

Moira: https://github.com/ruricolist/moira (monitor and restart background threads)

http://quickdocs.org/trivial-monitored-thread/

Trivial Monitored Thread offers a very simple (aka trivial) way of spawning threads and being informed when one any of them crash and die.

cl-cron http://quickdocs.org/cl-cron/api

Web

Imported:

  • Hunchentoot
  • Easy-routes
  • Djula
  • Spinneret
  • Quri

https://lispcookbook.github.io/cl-cookbook/web.html

Syntax extensions

Pythonic triple quotes docstring

https://github.com/smithzvk/pythonic-string-reader

We can use triple quotes for docstrings, and double quotes within them.

(defun foo ()
  """foo "bar"."""
  t)

Lambda shortcuts

Would be available by enabling cl-punch's syntax: https://github.com/windymelt/cl-punch/ - Scala-like anonymous lambda literal.

;; ^() is converted into (lambda ...) .
;; Each underscore is converted into a lambda argument.

(mapcar ^(* 2 _) '(1 2 3 4 5))
;; => '(2 4 6 8 10)

;; One underscore corresponds one argument.

(^(* _ _) 2 3)
;; => 6

;; <_ reuses last argument.

(mapcar ^(if (oddp _) (* 2 <_) <_) '(1 2 3 4 5))
;; => '(2 2 6 4 10)

;; _! corresponds one argument but it is brought to top of the argument list.
;; It can be useful when you want to change argument order.

(^(cons _ _!) :a :b)
;; => (:b . :a)

(^(list _! _! _!) 1 2 3)
;; => '(3 2 1)

Other utilities

Logging (log4cl)

repl-utilities (readme, summary,…)

repl-utilities:

(repl-utilities:readme repl-utilities)

Getting a function's arguments list (trivial-arguments)

https://github.com/Shinmera/trivial-arguments

(defun foo (a b c &optional d) nil)
(arglist #'foo)
;; (a b c &optional d)

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: