|
From: biran on 14 Sep 2006 03:35 (define (p) (p)) (define (test x y) (if (= x 0) 0 y)) (test 0 (p)) while i run these code in scsh, the interpreter does not return.? why? and what does "(define (p) (p))" mean?
From: Lars Rune Nøstdal on 14 Sep 2006 03:43 On Thu, 14 Sep 2006 00:35:39 -0700, biran wrote: > (define (p) (p)) > (define (test x y) > (if (= x 0) > 0 > y)) > (test 0 (p)) > > while i run these code in scsh, > the interpreter does not return.? > > why? and what does "(define (p) (p))" mean? That looks like Scheme, and defines a function named `p' that takes no arguments and when called calls itself - which again calls itself - which again calls itself - which .. In Lisp, that is Common Lisp - which is what is discussed (well, ok - sometimes) here in `comp.lang.lisp' that would have looked like: (defun p () (p)) For more about Scheme see `comp.lang.scheme'. -- Lars Rune Nøstdal http://lars.nostdal.org/
From: Thomas A. Russ on 14 Sep 2006 15:16 "biran" <zelzel.zsu(a)gmail.com> writes: Hmmm. My homework problem sensor just went off. > (define (p) (p)) > (define (test x y) > (if (= x 0) > 0 > y)) > (test 0 (p)) > > while i run these code in scsh, > the interpreter does not return.? > > why? and what does "(define (p) (p))" mean? But maybe it's not homework after all, but you could say where these came from. I'm assuming that since you are asking about the meaning of the code, you didn't write it yourself. The definition question has been answered by Lars already. As for the other question, you have to ponder the rules for evaluation of forms in Scheme. What happens when you call (test 0 (p)) ? How doe the interpreter handle this? If you know any other programming languages, is this any different than what would happen in those languages? -- Thomas A. Russ, USC/Information Sciences Institute
From: Chris Barts on 14 Sep 2006 16:22 On Thu, 14 Sep 2006 09:43:22 +0200, Lars Rune Nøstdal wrote: > In Lisp, that is Common Lisp - which is what is discussed (well, ok - > sometimes) here in `comp.lang.lisp' Come, now. They just shut down comp.lang.lisp.x and comp.lang.lisp.franz with the justification that those who needed to discuss those dialects could do so much more profitably in this group. comp.lang.lisp is a very inclusive newsgroup, and excluding Scheme is just silly. That said, there are Scheme-specific groups and, quite possibly, scsh-specific groups as well. -- My address happens to be com (dot) gmail (at) usenet (plus) chbarts, wardsback and translated. It's in my header if you need a spoiler. ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
From: Lars Rune Nøstdal on 14 Sep 2006 21:55 On Thu, 14 Sep 2006 14:22:39 -0600, Chris Barts wrote: > On Thu, 14 Sep 2006 09:43:22 +0200, Lars Rune Nøstdal wrote: > >> In Lisp, that is Common Lisp - which is what is discussed (well, ok - >> sometimes) here in `comp.lang.lisp' > > Come, now. They just shut down comp.lang.lisp.x and comp.lang.lisp.franz > with the justification that those who needed to discuss those dialects > could do so much more profitably in this group. comp.lang.lisp is a very > inclusive newsgroup, and excluding Scheme is just silly. Ok, then .. let's throw in some Ruby also; that's Lispy enough some think. Or maybe Ruby is Perlish, while Python is the one more Lispy - I dunno. Well, I don't care either way really. Since `comp.lang.scheme' exists, maybe I'll ask my Common Lisp question there if "they" lack activity and "need" to come here. :} At least the OP know about both Scheme, `comp.lang.scheme', Common Lisp and `comp.lang.lisp' now: http://en.wikipedia.org/wiki/Lisp_programming_language Now, what is the "best one"? O_o -- Lars Rune Nøstdal http://lars.nostdal.org/
|
Next
|
Last
Pages: 1 2 Prev: Tektonic and Lisp Hosting (sbcl) Next: what does "(define (p) (p))" mean? |