r/Common_Lisp

Anti-aliasing with McClim ?

Hi, judging from some examples on the McClim webpage, it should be possible to draw things with anti-aliasing in a McClim application frame. There is a "X rendering extension" that is maybe just doing that. But I can't find a documentation or code example.

Is there someone familiar with the subject that could point me in the right direction ?

Maybe it is easier this way. I have this minimalist example that draws a circle. How can I draw the same circle with anti-aliasing ?

(define-application-frame circle-app ()
  ()
  (:panes
   (canvas :application
           :background +white+
           :display-time :command-loop
           :display-function 'display-my-circle
           :width 400 :height 400))
  (:layouts (default canvas)))

(defun display-my-circle (frame pane)
  (declare (ignore frame))
  (draw-circle* pane 200 200 100
                :ink +red+
                :filled nil
                :line-thickness 2))

(define-circle-app-command (com-quit :name t :menu t :keystroke (#\q)) ()
  (frame-exit *application-frame*))

(defun run-circle-app ()
  (run-frame-top-level (make-application-frame 'circle-app)))

Maybe related: I am also interested in pointers that show how to draw text using TTF fonts (zpb-ttf).

BTW, i am using SBCL on Linux (archlinux).

reddit.com
u/tlreddit — 2 days ago
▲ 12 r/Common_Lisp+1 crossposts

GitHub - ageldama/doqumen: Yet another Lisp documentation generator, but it's way more dumber than others

Wrote this tool to documenting my other Lisp projects. (tclish...)

github.com
u/ageldama — 4 days ago

clim-modern - A theming library for McCLIM that replaces stock '90s Motif-style widgets with flat, modern-looking equivalents.

git.sr.ht
u/dzecniv — 4 days ago
▲ 19 r/Common_Lisp+1 crossposts

Py4ABCL: communicate Python with ABCL

Hey Lispers! 👋

I recently gave a lightning talk at the European Lisp Symposium about two libraries:

Quick note: I actually shared the abcl-memory-compiler here on Reddit some time ago – you can find that original post here:
👉 Previous announcement of abcl-memory-compiler

Now both libraries have been presented together at ELS making ABCL a multi-language development environment.

Hopefully this can be helpful to someone else

u/alejandrozf — 3 days ago

strange SBCL output when printing symbol-names for keyword symbols

I'm seeing this on Linux ARM64 and a current macOS with SBCL.

% sbcl
This is SBCL 2.6.2, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
* (let ((*print-readably* t)) (write (symbol-name :symbolfoo) :stream *standard-output*))
#A((9) BASE-CHAR . "SYMBOLFOO")
"SYMBOLFOO"
* 

#A((9) BASE-CHAR . "SYMBOLFOO") looks strange. Why doesn't it print a keyword symbol?

reddit.com
u/lispm — 5 days ago
▲ 46 r/Common_Lisp+2 crossposts

stube: a Seaside-style component framework on top of Datastar (personal research project)

I just put the docs on a small Clojure framework I've been hacking on, **stube**. It's a personal research project, not a product — somewhere I'm working out an idea about web apps that has pulled at me for twenty years.

Short version: components are plain maps of pure functions, the conversation is a value, handlers return effects, and one component can *call* another and read its *answer* like a return value (Seaside / UCW lineage). The wire is Datastar (SSE + morph by id); the implementation is a small effect kernel over plain Clojure data.

(s/defcomponent :demo/save-or-cancel
  :render (fn [self]
            [:div (s/root-attrs self)
             [:button (s/on self :click :as :save)   "Save"]
             [:button (s/on self :click :as :cancel) "Cancel"]])
  :handle (fn [self {:keys [event]}]
            (case event
              :save   [(s/call :ui/confirm {:question "Save changes?"} :on-confirmed)]
              :cancel [(s/answer :cancelled)]))
  :on-confirmed
  (fn [self yes?]
    [(s/answer (if yes? :saved :cancelled))]))

Built heavily with LLM assistants — wouldn't have shipped it this fast otherwise — but the shape, the namespace layout, and the choice of what to include and what to leave out is mine and reflects how I think about systems.

If you're a re-frame person and the conversation map feels familiar: yes, deliberately. The conversation here is closer in spirit to a re-frame app-db than to a Smalltalk image.

- Repo: https://github.com/zekzekus/stube

- Rationale (why this exists at all): https://github.com/zekzekus/stube/blob/master/docs/rationale.md

- Tutorial: https://github.com/zekzekus/stube/blob/master/docs/tutorial.md

Happy for feedback, war stories, "have you seen X" pointers.

github.com
u/zekzekus — 6 days ago

Looking for a post on CL setup hierarchy: hardware/OS/Lisp/Package Manger/API/Config

I am looking for a recent post (2-3 months back) that very nicely broke down a CL installation into a hierarchy of specifications. It went something like

  • Hardware/CPU
  • OS, Shell, environment variables
  • Lisp implementation
  • Lisp package manager
  • Editor & API

I asked CoPilot to help me find it, and it was not able to. It generated its guess on the hierarchy which seemed reasonable. I will not post it because I don't want to pollute Reddit.

I will be very grateful if someone points me to the post (& the author).

Thank you very much,

Mirko

reddit.com
u/mirkov19 — 5 days ago

File compilation without a file

Greetings!

I know one can use COMPILE to compile a function for later use in the current image, and COMPILE-FILE to read a file, compile the code in it, and save a loadable version of the code (FASL).

I'm working on a system that generates Lisp forms programmatically, however it does so outside of the usual read-compile-load cycle. You can imagine a DSL with its own syntax, that is mapped to Lisp forms.

Now, at some point I would like to compile the generated code "as if" it was normal Lisp code, and save it into a FASL. I know I can PRINT it to a temporary file and call COMPILE-FILE on that, however, it feels like a suboptimal solution.

Perhaps there's no portable way of doing that, but I would be happy with implementation-specific code, and the temporary file hack as a fallback.

reddit.com
u/Suitable_Click_3967 — 7 days ago

CL-CODEGRAPH - a live Knowledge Graph of your Common Lisp code, built from the running SBCL image.

cl-codegraph: https://sr.ht/~hajovonta/cl-codegraph/

> Given a package loaded in the SBCL image, builds and maintains a graph of its symbols, class hierarchies, method specializations, call relationships, and metadata — all without parsing source code. Includes a live Emacs integration that shows code intelligence as you navigate.

Screencast: https://drive.proton.me/urls/JE5EQ6KNMR#tN7CcgN96YL7

Seen on: https://mastodon.online/@hajovonta/116501259663689389

reddit.com
u/dzecniv — 8 days ago

How to improve this terribly slow reading?

I was reading TaDa and want to read the lineitem.csv example in Common Lisp, so I wrote:

(with-open-file (stream file)
  (loop :for line := (read-line stream nil) :while line
        :summing (parse-integer (nth 4 (str:split "|" line)))))

However, on my computer, it took about 17sec to run!

Maybe it was my fault, so I change to cl-csv:

(let ((sum 0))
  (cl-csv:do-csv (row #P"lineitem.csv" :separator #\|)
    (incf sum (parse-integer (nth 4 row))))
  sum)

and it is even worse...

Profiling shows that

           Self        Total        Cumul
  Nr  Count     %  Count     %  Count     %    Calls  Function
------------------------------------------------------------------------
   1   9903  80.0   9903  80.0   9903  80.0        -  foreign function read
   2    414   3.3    414   3.3  10317  83.3        -  foreign function __semwait_signal
   3    218   1.8   1878  15.2  10535  85.1        -  cl-ppcre:split
   4    182   1.5    404   3.3  10717  86.5        -  (lambda (string cl-ppcre::start cl-ppcre::end) :in cl-ppcre::create-scanner-aux)
   5    147   1.2    820   6.6  10864  87.7        -  (sb-pcl::emf cl-ppcre:scan)
   6    131   1.1    159   1.3  10995  88.8        -  sb-pcl::check-applicable-keywords
   7    122   1.0    122   1.0  11117  89.8        -  (lambda (cl-ppcre::start-pos) :in cl-ppcre::create-char-searcher)
   8     98   0.8    509   4.1  11215  90.6        -  (sb-pcl::fast-method cl-ppcre:scan (function t))
   9     88   0.7    103   0.8  11303  91.3        -  (lambda (sb-pcl::.arg0. sb-pcl::.arg1. &rest sb-pcl::.rest.) :in "SYS:SRC;PCL;DLISP3.LISP")
  10     83   0.7    121   1.0  11386  91.9        -  sb-kernel:ub32-bash-copy

This is really wired.

Notes: I was running SBCL 2.6.3 on macOS 26 (MacBook Air M2). The lineitem.csv (~=750MB) is generated via (duckdb):

.bail on

ATTACH IF NOT EXISTS ':memory:';
USE memory;

INSTALL tpch;
LOAD tpch;
CALL dbgen(sf = 1);

.shell rm -f lineitem.csv

COPY (SELECT * REPLACE (l_quantity :: bigint AS l_quantity)
      FROM lineitem)
TO 'lineitem.csv' (delimiter '|', header false);
u/lucky_magick — 13 days ago

Notes missing in my copy of Lisp Metaprogramming?

I just got a copy of LISP Metaprogramming: A Hands-On Guide to Macros, Syntax Transformation, and DSLs by James C. Shepherd. It's a softcover book with 179 pages and cover art of a train made of a colorful collection of circuit board wires.

For the life of me, I can't find where the endnotes are. They aren't footnotes, nor at the end of the chapters, nor end of the book (either before or after the appendixes).

Anyone have a copy of the book that has the notes?

reddit.com
u/thebhgg — 13 days ago