guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: guile-user Digest, Vol 188, Issue 9


From: Zelphir Kaltstahl
Subject: Re: guile-user Digest, Vol 188, Issue 9
Date: Sun, 8 Jul 2018 19:00:40 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0


On 08.07.2018 18:00, address@hidden wrote:
> ------------------------------
>
> Message: 3
> Date: Sun, 8 Jul 2018 08:44:22 -0700
> From: Matt Wette <address@hidden>
> To: address@hidden
> Subject: Re: Parsing command line arguments, predicate error
> Message-ID: <address@hidden>
> Content-Type: text/plain; charset=utf-8; format=flowed
>
>
>
> On 07/08/2018 04:49 AM, Zelphir Kaltstahl wrote:
>> Hi!
>>
>> I decided to take a look at how one can parse command line arguments in
>> Guile and was looking for something like argparse in Python. It seems
>> that (use-modules (ice-9 getopt-long)) does the job, except that I hit
>> one problem and don't know what the mistake I am making is. It seems to
>> be connected to the usage of `predicate` in my code.
> You probably want to use quasi-quote + unquote:
>  ? `((version ... (predicate ,string-exact-integer?))))
>
> I believe the module (srfi srfi-37), args-fold, is now recommended over 
> getopt-long.
>
> Matt

That solved the problem, thank you Matt!
I was so far quite fond of the way one specifies options with
getopt-long, but the quasi-quote unquote was not mentioned in the Guile
docs and feels unnatural. There seems to be no reason for it to force me
to do that, except that it does not work otherwise. I'll probably look
into how it is done with SRFI-37, because of this.

Apart from this issue, what are the reasons for SRFI-37 to be
recommended over getopt-long?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]