[GoLUG] I'm enjoying Guile

Barry Fishman barry at ecubist.org
Sun Jan 19 17:26:53 EST 2025


On 2025-01-19 16:52:39 GMT, David Billsbrough wrote:
> Steve and all,
>
> Quickly browsing though the updated guile intro to coding page, I found that you didn't show
> examples of formatting output:
>
> so try:
>
> #!/usr/bin/guile -s
>   !#
>
> (use-modules (ice-9 format))

The format function, which was taken from Common Lisp can do a
lot of very powerful things:

(format #t "{ ~{~a: ~s~^, ~} }~%" '("one" "two" "three" "four"))

will output:

{ one: "two", three: "four" }

And that is just the start.  It described in:

https://www.gnu.org/software/guile/manual/html_node/Formatted-Output.html

-- 
Barry



More information about the GoLUG mailing list