From: Yves S. G. <you...@gm...> - 2012-06-17 18:20:20
|
Hi all, I'm reading this chapter of gigamonkeys. http://www.gigamonkeys.com/book/practical-a-simple-database.html 2/3 down the page, I see the following methods: http://bin.cakephp.org/view/1169646936 Now, where I'm drawing a complete and utter blank is 1) how *db* is accessed, that's where all the data is held and 2) what the heck is &key? If I'm missing something absurdly obvious, please feel free to point it out. |
From: Pascal J. B. <pj...@in...> - 2012-06-17 19:08:25
|
"Yves S. Garret" <you...@gm...> writes: > Hi all, > > I'm reading this chapter of gigamonkeys. > > http://www.gigamonkeys.com/book/practical-a-simple-database.html > > 2/3 down the page, I see the following methods: > > http://bin.cakephp.org/view/1169646936 > > Now, where I'm drawing a complete and utter blank is 1) how *db* is > accessed, that's where all the data is held and 2) what the heck is > &key? > > If I'm missing something absurdly obvious, please feel free to point it out. > This is not the right place to ask that. https://lists.sourceforge.net/lists/listinfo/clisp-devel This mailing list is for the developers of the CLISP implementation of ANSI Common Lisp. It is the proper forum for enhancement requests, design discussions, source code patches, pre-release announcements, etc. and also for those support questions which are not appropriate for the users' list. https://lists.sourceforge.net/lists/listinfo/clisp-list This mailing list is for users of the CLISP implementation of Common Lisp by Bruno Haible and Michael Stoll. It is the proper forum for questions about CLISP and also bug reports, compatibility issues, problems of CLISP on specific platforms, enhancement of CLISP, miscellaneous comments, etc. Stretching it, your question could enter the "miscellaneous comments" category, but since it really has nothing to do with clisp specifically, but more with Common Lisp in general, you should be asking it on: news://comp.lang.lisp &key is described in chapter "5. Functions" of "Practical Common Lisp". Lambda Lists are explained in section "3.4 Lambda Lists" of CLHS. -- __Pascal Bourguignon__ http://www.informatimago.com/ A bad day in () is better than a good day in {}. |
From: Yves S. G. <you...@gm...> - 2012-06-17 19:31:57
|
Odd. I've asked questions here before and got answers. If I'm wrong, then I will re-ask the question in the appropriate location. Thanks for the heads up. On Sun, Jun 17, 2012 at 3:08 PM, Pascal J. Bourguignon < pj...@in...> wrote: > "Yves S. Garret" <you...@gm...> writes: > > > Hi all, > > > > I'm reading this chapter of gigamonkeys. > > > > http://www.gigamonkeys.com/book/practical-a-simple-database.html > > > > 2/3 down the page, I see the following methods: > > > > http://bin.cakephp.org/view/1169646936 > > > > Now, where I'm drawing a complete and utter blank is 1) how *db* is > > accessed, that's where all the data is held and 2) what the heck is > > &key? > > > > If I'm missing something absurdly obvious, please feel free to point it > out. > > > > This is not the right place to ask that. > > > https://lists.sourceforge.net/lists/listinfo/clisp-devel > > This mailing list is for the developers of the CLISP implementation > of ANSI Common Lisp. It is the proper forum for enhancement > requests, design discussions, source code patches, pre-release > announcements, etc. and also for those support questions which are > not appropriate for the users' list. > > > https://lists.sourceforge.net/lists/listinfo/clisp-list > > This mailing list is for users of the CLISP implementation of Common > Lisp by Bruno Haible and Michael Stoll. It is the proper forum for > questions about CLISP and also bug reports, compatibility issues, > problems of CLISP on specific platforms, enhancement of CLISP, > miscellaneous comments, etc. > > Stretching it, your question could enter the "miscellaneous comments" > category, but since it really has nothing to do with clisp specifically, > but more with Common Lisp in general, you should be asking it on: > news://comp.lang.lisp > > > &key is described in chapter "5. Functions" of "Practical Common Lisp". > Lambda Lists are explained in section "3.4 Lambda Lists" of CLHS. > > -- > __Pascal Bourguignon__ http://www.informatimago.com/ > A bad day in () is better than a good day in {}. > |
From: Sam S. <sd...@gn...> - 2012-06-18 14:50:35
|
> * Yves S. Garret <lbh...@tz...> [2012-06-17 14:20:13 -0400]: >> > 1) how *db* is accessed, that's where all the data is held and (defun select (selector-fn) (remove-if-not selector-fn *db*)) (defun where (&key title artist rating (ripped nil ripped-p)) #'(lambda (cd) (and (if title (equal (getf cd :title) title) t) (if artist (equal (getf cd :artist) artist) t) (if rating (equal (getf cd :rating) rating) t) (if ripped-p (equal (getf cd :ripped) ripped) t)))) SELECT returns elements of *DB* which satisfy SELECTOR-FN WHERE returns a function which __APPARENTLY__ can be used as an argument to SELECT. e.g., (select (where :title "foo")) will return the objects with the given title. > 2) what the heck is &key? a lambda list keyword. http://www.lispworks.com/documentation/HyperSpec/Body/03_da.htm it is a way to pass optional arguments to functions in a position independent way. e.g.: (defun foo (&key (a 1) (b 2) (c 3)) (list a b c)) (foo :b 10) => (1 10 3) (foo :a 4 :c 5) => (4 2 5) (foo :c 5 :a 4) => (4 2 5) > If I'm missing something absurdly obvious, please feel free to point it out. You might get a more detailed and informative reply to such a general Lisp question on the comp.lang.lisp newsgroup. -- Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000 http://www.childpsy.net/ http://jihadwatch.org http://openvotingconsortium.org http://iris.org.il http://palestinefacts.org http://mideasttruth.com Democrats, get out of my wallet! Republicans, get out of my bedroom! |