Here’s the translation of the Go URL parsing example to Lisp, formatted in Markdown suitable for Hugo:
Running our URL parsing program shows all the different pieces that we extracted:
This Lisp example uses the quri library to parse URLs, which provides functionality similar to Go’s net/url package. The dexador library is also loaded for potential HTTP requests, although it’s not used in this specific example.
Key differences in the Lisp version:
We use quri:uri to parse the URL instead of url.Parse.
The parsed URL is represented as a quri:uri object, which we can query using various accessor functions.
There’s no direct equivalent to Go’s SplitHostPort, so we access host and port separately.
Query parameters are parsed into an association list (alist) instead of a map.
Error handling is done using Common Lisp’s condition system instead of returning an error value.
The overall structure and functionality of the program remain similar to the original Go version, demonstrating URL parsing capabilities in Common Lisp.