Hello!
Post by swedebugiaHi
I would like to learn more scheme and I would like to make a small CLI
program that runs in the terminal and prompts the user for input and
evaluates it.
Is that possible with guile? In the REPL?
Can someone point me in the right direction for succeding with that?
In addition to what Tk recommends, here some pointers:
- For commandline argument parsing & organization, you could
specifically look at (ice-9 getopt-long). I think there's a srfi for
some form of arg-fold, but I have not used that yet. In addition, you
may want to look at guile-config (it's something that I wrote) which
provides a more comprehensive way of structuring your entire CLI into
different sub-commands and providing a nice structure for documenting
your CLI. It's particularly easy to install through Guix.
- For reading and writing interactively, you may want to look at the
(read) and (write) procedures if you're intending to read & write
s-expressions. Otherwise you may want to look at (ice-9 rdelim),
which provides line based, or other delimiter based reading rather
than s-expression reading.
- You could also look at the readline library to be able to implement
nice command line features if you decide to go down the full
commandline path.
Hope this helps. As Tk suggested, the documentation for Guile is great,
if at points a little light on examples.
Best wishes,
Alex