* Newbie: references in elisp @ 2007-01-23 17:12 Pawel 0 siblings, 0 replies; 4+ messages in thread From: Pawel @ 2007-01-23 17:12 UTC (permalink / raw) Hallo group members! I want my function return one than one element. I C I do it using references. Is there something like reference in elisp? .. or maybe I should use lists with some additional trick? regards Pawel ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <mailman.3471.1169572533.2155.help-gnu-emacs@gnu.org>]
* Re: Newbie: references in elisp [not found] <mailman.3471.1169572533.2155.help-gnu-emacs@gnu.org> @ 2007-01-23 20:24 ` Andreas Roehler 2007-01-23 20:24 ` Andreas Roehler 2007-01-24 0:58 ` Harold Lee 2 siblings, 0 replies; 4+ messages in thread From: Andreas Roehler @ 2007-01-23 20:24 UTC (permalink / raw) Pawel wrote: > Hallo group members! > I want my function return one than one element. I C I do it > using references. Is there something like reference in elisp? > .. or maybe I should use lists with some additional trick? > > regards > Pawel ;; Just one possibility: (setq my-list '("a" "b" "c")) (car my-list) => "a" (defun one-by-one (my-list) "This is an example" (let ((many my-list)) (while many (insert (car many)) (setq many (cdr many))))) (one-by-one my-list) => abc __ Andreas Roehler ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Newbie: references in elisp [not found] <mailman.3471.1169572533.2155.help-gnu-emacs@gnu.org> 2007-01-23 20:24 ` Andreas Roehler @ 2007-01-23 20:24 ` Andreas Roehler 2007-01-24 0:58 ` Harold Lee 2 siblings, 0 replies; 4+ messages in thread From: Andreas Roehler @ 2007-01-23 20:24 UTC (permalink / raw) To: help-gnu-emacs Pawel wrote: > Hallo group members! > I want my function return one than one element. I C I do it > using references. Is there something like reference in elisp? > .. or maybe I should use lists with some additional trick? > > regards > Pawel ;; Just one possibility: (setq my-list '("a" "b" "c")) (car my-list) => "a" (defun one-by-one (my-list) "This is an example" (let ((many my-list)) (while many (insert (car many)) (setq many (cdr many))))) (one-by-one my-list) => abc __ Andreas Roehler ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Newbie: references in elisp [not found] <mailman.3471.1169572533.2155.help-gnu-emacs@gnu.org> 2007-01-23 20:24 ` Andreas Roehler 2007-01-23 20:24 ` Andreas Roehler @ 2007-01-24 0:58 ` Harold Lee 2 siblings, 0 replies; 4+ messages in thread From: Harold Lee @ 2007-01-24 0:58 UTC (permalink / raw) On Jan 23, 9:12 am, Pawel <n...@wp.pl> wrote: > Hallo group members! > I want my function return one than one element. I C I do it using references. Is there something like reference in elisp? .. or maybe I should use lists with some additional trick? I guess you mean returning more than one value? Try MULTIPLE-VALUE-BIND, taken from Common Lisp: http://www.lisp.org/HyperSpec/Body/mac_multiple-value-bind.html Thus you can define a function that returns multiple values: (defun f () (values 1 2)) And get at the values like this: (multiple-value-bind (a b) (f) (format "a is %d and b is %d" a b)) ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-01-24 0:58 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-01-23 17:12 Newbie: references in elisp Pawel [not found] <mailman.3471.1169572533.2155.help-gnu-emacs@gnu.org> 2007-01-23 20:24 ` Andreas Roehler 2007-01-23 20:24 ` Andreas Roehler 2007-01-24 0:58 ` Harold Lee
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).