[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: basic help evaluating function in an alist
From: |
WJ |
Subject: |
Re: basic help evaluating function in an alist |
Date: |
2 Dec 2012 01:06:07 GMT |
User-agent: |
XanaNews/1.18.1.6 |
WJ wrote:
> Matt Price wrote:
>
> > Hi,
> >
> > i'm trying to figure out what's wrong with this simple code:
> >
> > (add-to-list 'my-winlist
> > '(guide . (selected-window) )
> > )
> > (windmove-right)
> > (select-window(cdr(assoc 'guide my-winlist)) )
> >
> > So, what I would hope happens here is that I add an element (guide .
> > (selected-window)) to an alist, but that the second element would be
> > the actual window object in question, not the text string
> > "(selected-window)". Lisp puzzles me pretty thoroughly so I know I'm
> > missing a very basic feature, but I can't figure it out by flipping
> > through the info pages... Thanks everyone!
> > Matt
>
> : (setq mylist '((b . 2)))
> ((b . 2))
> : (add-to-list 'mylist (cons 'c (sqrt 3)))
> ((c . 1.7320508075688772) (b . 2))
Another way:
: (require 'cl)
cl
: (setq mylist '((b . 2)))
((b . 2))
: (setq mylist (acons 'c (sqrt 3) mylist))
((c . 1.7320508075688772) (b . 2))