Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs Dotted Pair Syntax Improvement

Tags:

emacs

elisp

I want to create a dotted pair of variables in Emacs Lisp. But the only way I can find to do it seems really unwieldy. As a simplified example:

(let ((width (calculate-width)
      (height (calculate-height))
  `(,width . ,height))

This backquote, double-unquote syntax smells to me, but I can't find a neater way and my Google-fu is failing me.

Is there a better way to construct a dotted pair when the values are variables?

(For clarification, it must be a dotted pair. A straight list won't do.)

like image 689
Kris Jenkins Avatar asked Mar 27 '13 14:03

Kris Jenkins


1 Answers

You could use cons:

(let ((width (calculate-width))
      (height (calculate-height))
   (cons width height))
like image 193
ryuslash Avatar answered Oct 30 '22 22:10

ryuslash