[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Complex --evaluate command line option
From: |
Thomas Morley |
Subject: |
Re: Complex --evaluate command line option |
Date: |
Fri, 26 Oct 2018 17:41:47 +0200 |
Am Fr., 26. Okt. 2018 um 16:44 Uhr schrieb Peter Anglea <address@hidden>:
>
> I’m trying to use the -e (--evaluate) option to define a hash, not just a
> single variable. For instance
>
> lilypond -e ‘((define myhash (make-hash-table))(hashq-set! myhash
> ‘foo “bar”))’ file.ly
>
> The above doesn’t work. I think, obviously, it’s breaking at the single quote
> – ‘foo.
>
> I’ve tried escaping it with a backslash (\’foo) and a couple other things,
> but nothing seems to work.
>
> Is it possible to run complex Scheme code in the command line option, and/or
> am I just not escaping special characters the right way?
Well, from here it looks you used “” ‘’ -signs instead of " and '.
But even with correct ones your example will fail.
But you could do (at least on Linux):
lilydevel -e "(begin (define myhash (make-hash-table))(hashq-set!
myhash 'foo \"bar\"))" file.ly
and in file.ly
#(use-modules (guile-user))
#(write (hashq-ref myhash 'foo))
returning "bar" as wished.
Otoh, I think the -e option is not very convenient for longer and/or
complex expressions.
Cheers,
Harm
Re: Complex --evaluate command line option, David Kastrup, 2018/10/26