Are you taking the square brackets in `[failure-result]` too literally? ;) They
simply denote an optional argument. Racket reads `[]` as `()` which it
interprets as an incomplete function expression.
The fallback value can be passed directly:
(hash-ref metas 'doc-publish-date "")
(hash-ref metas 'doc-publish-date #f)
Or wrapped in a lambda (if it's something costly that you'd prefer to defer
until needed:
(hash-ref metas 'doc-publish-date (λ () (calculate-value)))
So this would work:
\date{◊(pubdate->english (hash-ref metas 'doc-publish-date ""))}
If you want the date to be suppressed unless it exists, you can do test that
the key exists with `hash-has-key?`
But more compact to do this:
◊(define maybe-date (hash-ref metas 'doc-publish-date #f))
◊when/splice[maybe-date]{
\date{◊(pubdate->english maybe-date)}}
> On Mar 21, 2017, at 10:20 PM, Paul Atlan <[email protected]> wrote:
>
> Unfortunately all my efforts to set the failure-result have failed. I've
> tried e.g.
> \date{◊(pubdate->english (hash-ref metas 'doc-publish-date [] ))}
> in order to return an empty string, but racket chokes by telling me [] is not
> a procedure.
>
> And I can't find reference to something resembling if-error in the racket
> documentation.
--
You received this message because you are subscribed to the Google Groups
"Pollen" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.