logoalt Hacker News

vindarelyesterday at 9:56 PM2 repliesview on HN

Notes on CL:

- why nothing on the "compiler" line? Everytime you load a snippet or a file with SBCL, it compiles it (to machine code). There's also compile-file.

- interpreter: likewise, all code is compiled by default with SBCL, not interpreted, even in the REPL. To use the interpreter, we must do this: https://github.com/lisp-tips/lisp-tips/issues/52

- command line program: the racket cell shows the use of -e (eval), the same can be done with any CL implementation.

- since the string split line introduces cl-ppcre, one could mention cl-str :D (plug) (much terser join, trim, concat etc)

- ah ok, for dates and times, flattening a list, hash-table literals… we need more libraries.

- more files operations: https://lispcookbook.github.io/cl-cookbook/files.html

- emacs buffers: now compare with Lem buffers 8-)

- posix-getenv: I'd rather use uiop:getenv (comes in implementations).

- uiop:*command-line-arguments*

- exit: uiop:quit

- uiop:run-program (sync) / launch-program (async)

- java interop: with LispWorks or ABCL (or other libraries)

my 2c


Replies

aidenn0today at 4:32 AM

> - ah ok, for dates and times

local-time has its limits (e.g. Gregorian only), but it does everything listed in this chart

> flattening a list

What? Isn't this[1] just fine (<s>)

> hash-table literals…

Since the chart is sbcl specific, this ugly mess would technically count; a more portable (but longer) version could be made similarly using #.:

  #.(SB-IMPL::%STUFF-HASH-TABLE (MAKE-HASH-TABLE :TEST 'EQUAL) '((:X . :Y))) 
> java interop: with LispWorks or ABCL (or other libraries)

I've had good luck with .net/java interop using FOIL (written by Rich Hickey prior to Clojure).

1:

  CL-USER> (let* ((result (cons nil nil))
                 (tail result))
             (subst-if t
                       (constantly nil)
                       '(a ((b(c d)) e) f)
                       :key (lambda (x)
                              (when (and x (atom x)) (setf (cdr tail) (cons x   nil)
                                                           tail (cdr tail)))))
             (cdr result))
=> (A B C D E F)
sinsudoyesterday at 10:17 PM

Since you are also commenting libraries, I think that FSet (1) for inmutable memory,and perhaps a comparison with clojure, and the quick-lisp package manager could be mentioned.

(1) https://news.ycombinator.com/item?id=47779659