On Sun, Aug 27, 2017 at 01:17:13AM +0530, Arun Isaac wrote:
> 
> Is there a Scheme or Guile equivalent to Emacs Lisp's `when-let' ?
> 
> Basically, I'm looking for a shorthand to express this:
> 
> (let ((x (foo))
>   (when x
>     (bar x))))
> 
> as this:
> 
> (when-let (x (foo))
>   (bar x))

(cond
 ((foo) => bar))

Or, in general:

(cond
 ((foo)
  => (lambda (x)
       (bar x))))

Reply via email to