novice: mapcan use?
- From: Bernd Schmitt <Bernd.Schmitt.News@xxxxxxx>
- Date: Sun, 28 Aug 2005 19:15:48 +0200
Hello,
I am currently learning lisp, so this is a novice basic question and I apologize for wrong use of words, I am still not used to some terms (hobby-coder in c/c++ tcl/tk).
It is about destructive functions. As far as I understand, destructive functions "destroy" their arguments, right?
So, if one wants to use their result, the argument should be a variable (somehow unsure which vocabulary to use, is symbol in lisp the same (in this regard) as variable in c?)?
The book, I am reading gives this as an example for the use of mapcan (a filter for numbers):
CL-USER> (mapcan #'(lambda (x) (cond ((numberp x) (list x)) (t nil))) '(a 2 b c 3 4 d 5)) ;; my problem (2 3 4 5)
(sorry, I have to figure out how indentation is done with spaces in rpl of clisp (slime))
I do have problems with this.
What happens to '(a 2 b c 3 4 d 5)?
Is this a temporary object which will be changed?
If such a code would be in a source file, the code (the argument) would be changed?
Where are those objects stored?
When will their space be freed (by GC?)?
If my question shows deep misunderstanding of basic concepts of lisp, please feel free to give me the keyword I should have a closer look at.
Thanks for replies, Bernd
-- https://gna.org/projects/mipisti - (microscope) picture stitching T_a_k_e__c_a_r_e__o_f__y_o_u_r__R_I_G_H_T_S. P_r_e_v_e_n_t__L_O_G_I_C--P_A_T_E_N_T_S http://www.ffii.org, http://www.nosoftwarepatents.org .
- Follow-Ups:
- Re: novice: mapcan use?
- From: Kent M Pitman
- Re: novice: mapcan use?
- From: Pascal Bourguignon
- Re: novice: mapcan use?
- From: Pascal Costanza
- Re: novice: mapcan use?
- Prev by Date: Re: generic programming + Lisp
- Next by Date: Re: novice: mapcan use?
- Previous by thread: Four "bagatelles": calculating PI and E randomly
- Next by thread: Re: novice: mapcan use?
- Index(es):
Relevant Pages
|
|