Lysp yn Swyft – a (toy) Lisp implemented in the Swift language (2022 – 2023)
  • Common Lisp 50.9%
  • Swift 45.8%
  • Python 2.2%
  • NewLisp 0.6%
  • Makefile 0.3%
  • Other 0.2%
Find a file
Juergen Nickelsen 84d02186ea Capabilities.md: some polishing and updates
In particular, updated to reflect the renaming of the file, now
speaking of capabilities where it was functionality before.
2025-10-30 07:51:34 +01:00
_morgue have inline builtin function descriptions now 2025-10-17 16:14:59 +02:00
builtins builtins/arithmetic.swift: fix add and mult builtin names 2025-10-26 17:20:38 +01:00
div div/notes: ideas and references 2025-10-14 17:17:15 +02:00
doc copied over doc/ from lyk; annotated 2025-10-14 15:54:23 +02:00
external external/: interesting things from elsewhere 2025-05-28 07:52:39 +02:00
functions rename pair => cons 2025-04-11 16:23:39 +02:00
io charactera basically work now 2025-10-26 11:27:19 +01:00
l new file: l/nconc.lisp 2025-10-14 17:17:37 +02:00
objects common .typeof property of all Objects 2025-10-26 13:46:29 +01:00
old-regtests new file l/regtests.lisp, not yet ported 2022-12-12 09:46:33 +01:00
preload 15-places.lisp: adapt to tables not being callable 2023-01-11 08:30:44 +01:00
regtests new file l/regtests.lisp, not yet ported 2022-12-12 09:46:33 +01:00
scripts scripts/gen-builtin-reg: better wrap at 78 2025-10-17 20:35:22 +02:00
system new system/debug.swift (empty for now) 2025-10-25 16:48:52 +02:00
utils charactera basically work now 2025-10-26 11:27:19 +01:00
.gitignore PLAN.md: plan to port back the progress made in Lyk/Kotlin 2025-05-24 14:31:25 +02:00
Capabilities.md Capabilities.md: some polishing and updates 2025-10-30 07:51:34 +01:00
LICENSE new file: LICENSE 2025-10-14 15:14:05 +02:00
main.swift reading a character literal works to some degree 2025-10-25 16:49:17 +02:00
Makefile Makefile: build optimised for install 2025-10-27 08:49:08 +01:00
PLAN.md PLAN.md: typo fix 2025-09-11 06:46:49 +00:00
README.md README.md: update 2022-12-28 09:11:48 +01:00
run-tests.lisp more baby steps to adapt the regtest mechanism 2023-01-03 23:56:10 +01:00
subdir-Makefile in porting #'factor: builtins last-pair, fset, defvar 2022-12-09 10:14:06 +01:00

Lisp in Swift

After -- to a varying degree -- not being blissfully happy with Modula 2, C, Java, Perl, Go, and Python for this application, it was time to try this pet project of mine in another language. Once I wrote an article https://jyrgenn.dreamwidth.org/30953.html pondering the choice of a programming language, and I excluded Swift, because it wasn't open source and not widely available. This has changed in between. In between it is open source and available on macOS and Linux; a FreeBSD port has gone stale, but that is no longer my platform of choice (sadly). All the world's Linux anyway, right?

Swift has the chance to be what I was looking for -- it is fast (maybe not quite fast as C, but in that league), has static type checking, at least simple type inference, AFAIK some approach to parallelism, automatic memory management, and does not seem to be a pain in the ass. Syntax and semantics seem to be rather clear and well-defined, and it seems to have not too much boilerplate (am not as far to judge that).

So it was time to give it a shot. First impression was good; certainly better than Nim, which kind of rubbed me the wrong way here and there. That is one aspect of a programming language I hadn't mentioned in that article -- I must be able to bend my mind around it. That seemed to be the problem with Nim, with which I found that difficult, and I did not really like it. This does not seem to be the problem with Swift.

Swift's concepts seem straightforward, easy to understand, and well designed for me, and I find it easy to use them in my code. It has been fun from the beginning, because I don't seem to run into major obstacles. It feels a bit similar to Python in parts, which I also found fun to work with from the start. Only here, with strong typing and very explicit error handling, it feels like I get the code more right from the start. I like that.

I was a bit disappointed when I saw the system interface library. Compared to python, where everything looks like it is meant to be as simple to handle as the language, the Swift standard library seems to carry a lot of baggage from being an Objective C library before, and from being intertwined with a complex windowing system, far from being simple to handle. But I'll try to manage.

Currently I still am in the process of simplifying the argument list handling of Lisp functions and the resulting breakage, most likely from trying to make that change more or less automatically. Somthing broke, and I don't know what. Most things seem to work, most of the time, but the program l/factor.lisp, which I wanted to use to benchmark the expected performance improvements of the argument passing change, broke and has so far resisted my attempts of locating the cause. And it isn't the only thing that behaves weirdly. Let's hope for the best.

[ni 2022-12-26]