unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Neil Jerram <neil@ossau.homelinux.net>
To: Catonano <catonano@gmail.com>
Cc: Guile User <guile-user@gnu.org>
Subject: Re: Beginner questions
Date: Wed, 28 Nov 2018 16:45:26 +0000	[thread overview]
Message-ID: <87o9a9kv6h.fsf@ossau.homelinux.net> (raw)
In-Reply-To: <CAJ98PDyVaU=dEf-98hE7ao5Obsyvo4HHQnV9fHAsfUk=6QKMCQ@mail.gmail.com>

Catonano <catonano@gmail.com> writes:

> Neil,
>
> Il giorno lun 19 nov 2018 alle ore 10:02 Neil Jerram <
> neil@ossau.homelinux.net> ha scritto:
>
>>
>>
>> On 18 November 2018 19:33:31 GMT, Catonano <catonano@gmail.com> wrote:
>> >Il giorno lun 29 ott 2018 alle ore 22:58 swedebugia
>> ><swedebugia@riseup.net>
>> >ha scritto:
>> >
>> >> Hi
>> >>
>> >> 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?
>> >>
>> >>
>> >>
>> >
>> > Hi
>> >
>> >I am curious: did you manage to put together a prototype of this thing
>> >prompting a user in the terminal ?
>>
>> In case it's of interest, I wrote this kind of thing a few years ago: a
>> command loop for Guile where you can register possible commands, and each
>> command has a spec like the Emacs 'interactive' form that says what the
>> args are and how to prompt for them.
>>
>> The command loop entry point is at
>> http://git.savannah.nongnu.org/cgit/ossaulib.git/tree/ossau/command-loop.scm
>> and the dependency modules are all included in that git repo.
>>
>> Best wishes,
>>      Neil
>>
>
> thank you
>
> But I'm a bit overwhelmed by so much code

Thanks for taking a look.  It is a _lot_ of code, so I can understand it
being overwhelming.

> a tiny example of reading a short string that a user could type at a prompt
> would be more useful to a beginner, I think
>
> I came up with this short example
>
> (use-modules (ice-9 rdelim))
>
> (let ((str (read-line (current-input-port))))
>     (display (string-append str "\n")))
>
> it's extremely essential but it demonstrates the usage of the current input
> port in association with delimited text reading
>
> This is a very basic use case, intended as an example, a step 0 for further
> developments

I started with that (or something very like it), but then gradually
added more structure for the specific applications that I had in
mind... and surprisingly quickly we can end up with the amount of code
that I have in ossaulib.

Best wishes,
   Neil



      reply	other threads:[~2018-11-28 16:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-29 22:00 Beginner questions swedebugia
2018-10-29 22:35 ` Tk
2018-10-30 13:15 ` Alex Sassmannshausen
2018-10-30 13:27 ` Mark H Weaver
2018-10-30 19:22 ` Alex Vong
2018-11-18 19:33 ` Catonano
2018-11-19  9:02   ` Neil Jerram
2018-11-27 19:59     ` Catonano
2018-11-28 16:45       ` Neil Jerram [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o9a9kv6h.fsf@ossau.homelinux.net \
    --to=neil@ossau.homelinux.net \
    --cc=catonano@gmail.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).