# Reading the list produced by (mac-frame-geometry)

I just learned about the function `(mac-frame-geometry)`. It produces a list in the form of:

``````'((outer-position 0 . 25)
(outer-size 1920 . 1055)
(external-border-size 0 . 0)
(title-bar-size 1920 . 0)
(tab-bar-size 0 . 0)
(tool-bar-external . t)
(tool-bar-position . top)
(tool-bar-size 0 . 0)
(internal-border-width . 0))
``````

How would I lookup values from this list by symbol name (e.g. `menu-bar-size` to return `( 0 . 0 )`)

It looks like an alist, but ... weird.

It’s an alist:

``````(cdr (assoc 'menu-bar-size (mac-frame-geometry))) → (1920 . 24)
``````

Each item in the list is a pair, where the first element is the key and the second is the value:

``````'((k₁ . v₁) (k₂ . v₂) (k₃ . v₃))
``````

However, if the value is a long list, then it will look proper:

``````'((k₁ v₁ v₁ v₁ …))
``````

Unless the end of that long list is improper (not nil terminated). If the long list is improper, the dot will show up at the end.

What you have in this case are values that are themselves conses of two numbers: `'((k₁ v₁ . v₁))`.

While it may be unusual, it's a valid `alist` and `assoc` and related functions will work with it.

• The dot notation threw me. I only see that in `cons`... is this some improper list form? Commented Aug 24, 2022 at 3:26
• Alists are always “improper”, yes. Each item in the list is a pair, where the first element is the key and the second is the value: `'((k₁ . v₁) (k₂ . v₂) (k₃ . v₃))` However, if the value is a long list, then it will look proper: `'((k₁ v₁ v₁ v₁ …))`, unless the end of that long list is improper. If the long list is improper, the dot will show up at the end. Finally, what you have in this case are values that are themselves conses of two numbers: `'((k₁ v₁ . v₁))` You can think of this as a very short improper list. Commented Aug 24, 2022 at 14:18
• Updated to include these details in the answer. Commented Aug 25, 2022 at 2:22