lisp - how to set a bunch of variables depending on one condition in elisp? -


suppose want set values of bar , baz depending on 1 condition, same in both cases, value of foo. using let special form, this

(let ((bar (if foo 1 2))       (baz (if foo 3 4)))   ... ) 

while above program correct, seems little strange checks value of foo twice. there idiomatic expression 1 can use in such cases avoid double-check?

you needn't set values in let form itself. let form creates local bindings, after can set values wish.

(let (bar baz)   (if foo       (setq bar 1             baz 2)     (setq bar 3           baz 4))   ...) 

Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -