[Top][All Lists]

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

Re: Pass argument to function

From: Nevroz Arslan
Subject: Re: Pass argument to function
Date: Fri, 10 Mar 2023 20:15:13 +0300

Hi utz and Brandon,

> (capture ,(string-append "docker inspect " str))) 
doesn't work because of the same reason that you expressed. 
You would get "quasiquote not found" from the shell.

As a workaround, execute procedure might be used straightly. 
(define (inspect str)
  (execute (list (string-append "docker inspect " str)) 'verbose: #t ))


Am Fr., 10. März 2023 um 19:22 Uhr schrieb <>:
Hi Brandon,

'capture' and its friends 'run' and 'run*' are macros that treat their
arguments differently from what you would expect from a regular procedure.

Looking at the documentation of '(run COMMAND ...)', you will find that

>  COMMAND is also implicitly quasiquoted so subexpressions may be computed at run-time by unquoting them.

which means that COMMAND is passed to the shell as-is, without being
evaluated. So the "not found" error is actually returned by the shell,
since it does not know what 'string-append' is.

In order to evaluate a quasi-quoted _expression_ (or parts of it), you
must unquote it (or the parts in question).
This should work:

(capture ,(string-append "docker inspect " str)))

Hope that helps.

Best wishes,

reply via email to

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