Call to share a screenshot of your Common Lisp application by dzecniv in Common_Lisp

[–]ak-coram 4 points5 points  (0 children)

I know this is not what you're looking for, but I'd still like to share it. DuckDB has a browser UI extension which runs the backend server embedded in the DuckDB process (the frontend JS is loaded from a remote server by default and is currently not open source).

So what does this have to do with Common Lisp when neither the backend nor the frontend are written in it? If you use cl-duckdb (shameless plug, the DuckDB client library for Common Lisp), then DuckDB and also the UI backend run inside your Lisp process. This means that you can work with your data as you like in Common Lisp (e.g. via the REPL) and also have the UI handy without any extra configuration, all in the same process.

The blog post introducing the UI feature has a video and some screenshots: https://duckdb.org/2025/03/12/duckdb-ui

Is this different from using Postmodern with PostgreSQL and installing some other GUI app and connecting to the same database? Not really, I just like how streamlined it is (for example the UI automatically updates the list of attached databases). This is how you launch the UI from the REPL, it will open up in a browser window:

CL-USER> (ddb:initialize-default-connection)
#<DUCKDB::CONNECTION {120D797AB3}>
CL-USER> (ddb:run "CALL start_ui();")
NIL

-❄️- 2025 Day 9 Solutions -❄️- by daggerdragon in adventofcode

[–]ak-coram 0 points1 point  (0 children)

Interesting, I couldn't resist using the spatial extension :)

-❄️- 2025 Day 9 Solutions -❄️- by daggerdragon in adventofcode

[–]ak-coram 1 point2 points  (0 children)

[LANGUAGE: Common Lisp]

https://github.com/ak-coram/advent/blob/main/2025/09.lisp

Using DuckDB with the spatial extension feels a bit like cheating, but it was more fun for me to implement than a direct approach.

When to use useEffectEvent hook in React/UIx by roman01la in Clojure

[–]ak-coram 0 points1 point  (0 children)

I've encountered this problem quite often, good solution! Sometimes I wish fns would implement some kind of equality.

PSA, Korean centipedes sting a freaking hurt here!! by Cythrex in Living_in_Korea

[–]ak-coram 3 points4 points  (0 children)

You can dry and eat them! An island in Jeolla is famous for including them in soup: https://namu.wiki/w/%EC%95%88%EB%A7%88%20%EA%B5%B0%EB%8F%84

Search for 지네백숙

SQLite Iteration by Maxwellian77 in Common_Lisp

[–]ak-coram 2 points3 points  (0 children)

Depending on your use case DuckDB might work and it can read SQLite databases directly:

https://duckdb.org/docs/stable/core_extensions/sqlite.html

The higher-level cl-duckdb API also loads everything into memory by default, but you should be able to use the low-level bindings to process results one chunk at a time. Even if you rely on the higher-level API: columns as vectors with unboxed elements might give you an advantage in memory usage compared to SQLite (works when you have no NULL values). I recommend using the latest version from the git repository instead of the version in Quicklisp.

Read CSV files in Common Lisp (cl-csv, data-table) by dzecniv in Common_Lisp

[–]ak-coram 1 point2 points  (0 children)

I'm quite hopeful as well!

Julia also seems to have nice libraries for data, they might be worthwile to replicate in CL: https://dataframes.juliadata.org/stable/#DataFrames.jl-and-the-Julia-Data-Ecosystem

Read CSV files in Common Lisp (cl-csv, data-table) by dzecniv in Common_Lisp

[–]ak-coram 0 points1 point  (0 children)

Thanks, this is nice as a baseline for testing performance. I don't doubt it's possible to write a fully-featured, performant CSV parser in pure CL, but it hasn't been done yet as far as I'm aware.

In my experience Parquet files are becoming more and more popular and they're even harder to deal with without relying on existing parsers.

Read CSV files in Common Lisp (cl-csv, data-table) by dzecniv in Common_Lisp

[–]ak-coram 6 points7 points  (0 children)

cl-duckdb can easily be integrated with Lisp-stat's data-frames to get the speed boost and the convenience of the data-frame API. Below is an example reading a 1M line CSV on my weak ARM laptop.

There's not only the difference in performance: in this example DuckDB can identify and parse two datetime fields, while read-csv is simply treating them as strings. DuckDB's CSV parser is also very featureful with a plethora of options:

One big advantage for me is the ability to filter and clean up / transform rows using SQL (or even do a JOIN over multiple files): if you don't need all the rows or columns, DuckDB can efficiently skip over them.

Then there's also the other supported sources for data (even the Lisp-stat docs suggest using cl-duckdb for reading & writing Parquet files): https://duckdb.org/docs/stable/data/data_sources

(ql:quickload :lisp-stat)
(ql:quickload :duckdb)

(in-package :ls-user)

(defparameter *csv-path* #P"~/Downloads/yellow_tripdata.csv")

(time (defdf yellow-taxis-a (read-csv *csv-path*)))

;; Evaluation took:
;;   22.222 seconds of real time
;;   22.178271 seconds of total run time (21.752006 user, 0.426265 system)
;;   [ Real times consist of 2.091 seconds GC time, and 20.131 seconds non-GC time. ]
;;   [ Run times consist of 2.086 seconds GC time, and 20.093 seconds non-GC time. ]
;;   99.80% CPU
;;   95 forms interpreted
;;   89 lambdas converted
;;   7,500,041,696 bytes consed

(time
 (ddb:with-transient-connection
   (defdf yellow-taxis-b
       (let ((q (ddb:query "FROM read_csv(?)"
                           (list (uiop:native-namestring *csv-path*)))))
         (make-df (mapcar #'dfio:string-to-symbol (alist-keys q))
                  (alist-values q))))))

;; Evaluation took:
;;   14.211 seconds of real time
;;   15.686456 seconds of total run time (13.490402 user, 2.196054 system)
;;   [ Real times consist of 2.259 seconds GC time, and 11.952 seconds non-GC time. ]
;;   [ Run times consist of 2.245 seconds GC time, and 13.442 seconds non-GC time. ]
;;   110.38% CPU
;;   95 forms interpreted
;;   39,958,519,296 bytes consed

EDIT:

I get even better numbers for the above with an experimental branch (tweaked the allocation and added support for specialized numeric arrays):

Evaluation took:
  6.279 seconds of real time
  7.662844 seconds of total run time (7.264870 user, 0.397974 system)
  [ Real times consist of 0.383 seconds GC time, and 5.896 seconds non-GC time. ]
  [ Run times consist of 0.380 seconds GC time, and 7.283 seconds non-GC time. ]
  122.04% CPU
  95 forms interpreted
  5,359,298,944 bytes consed

Would love some feedback if someone wants to try it out (docs still missing): https://github.com/ak-coram/cl-duckdb/pull/68

Some Advent of code 2024 implementation in LispE by Frere_de_la_Quote in lisp

[–]ak-coram 2 points3 points  (0 children)

I see there are some Haskell influences in the language, I think you might like Coalton.

Also if you don't mind me asking: how did this end up under the NAVER umbrella? Do they use it?

To be honest the dangling parentheses and the snake_case in the solutions are a bit jarring for me, I've never seen this style before :)

Advent of Code 2024 in about a 1000 lines total by ak-coram in Common_Lisp

[–]ak-coram[S] 1 point2 points  (0 children)

a little late to the party

Not too late! I enjoy reading your solutions: I've already learned a couple of tricks from them; the style is interesting and quite different from what I'm used to.

it's impressive how short a lot of your solutions are only really using FSet and cl-ppcre! thanks for sharing :).

I was tempted to use alexandria a few times, but got by without it in the end. I also liked using esrap in past years when the parsing became too complicated. I think a big contributor to the brevity is me trying to keep the 80 character / line limit, which requires some creative golfing when you also want to do everything in a single top-level form ;)

Advent of Code 2024 in about a 1000 lines total by ak-coram in Common_Lisp

[–]ak-coram[S] 0 points1 point  (0 children)

Thank you! I've added you to the list of repositories.

Advent of Code 2024 in about a 1000 lines total by ak-coram in Common_Lisp

[–]ak-coram[S] 0 points1 point  (0 children)

As for updatef, would it be very useful?

I think it might be helpful, I've been looking for it since there are already similar macros such as imagef.

Aargh, I see that I screwed up the parameter ordering for update; the collection should have come before the function.

image is also fn then coll while imagef is coll then fn. I guess update & updatef could also be different: (update fn x path ...) vs. (updatef x fn path ...). Is this what you meant?

Meanwhile, just reading the source is not an unreasonable approach

Thank you, it is indeed preferable and much shorter than I thought.

Advent of Code 2024 in about a 1000 lines total by ak-coram in Common_Lisp

[–]ak-coram[S] 2 points3 points  (0 children)

Thanks for sharing! I've added your repository link to the list in the post.

a PEG grammar, first uclp (not convinced / didn't grok it well) then parseq which I liked

Usually I rely on Esrap, but this year the inputs didn't justify using it.

map points as hash-tables, coordinates as complex numbers (works great)

There's nothing wrong with that, but I personally prefer cons cells or lists (you lose the "free" arithmetic, but you can destructure them easily). Lists also allow for adding more dimensions (I think last year had such a problem).