From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 107f24,626a0a064b320310 X-Google-Attributes: gid107f24,public X-Google-Thread: f4fd2,626a0a064b320310 X-Google-Attributes: gidf4fd2,public X-Google-Thread: 103376,ea8ea502d35ca2ce X-Google-Attributes: gid103376,public X-Google-Thread: 103d24,626a0a064b320310 X-Google-Attributes: gid103d24,public X-Google-Thread: 114809,626a0a064b320310 X-Google-Attributes: gid114809,public X-Google-ArrivalTime: 2001-05-09 03:20:02 PST Path: newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!fu-berlin.de!uni-berlin.de!fw.baan.COM!not-for-mail From: "Biep @ http://www.biep.org/" Newsgroups: comp.lang.ada,comp.lang.lisp,comp.lang.smalltalk,comp.lang.functional,comp.lang.scheme Subject: Re: Beginner's Language? Date: Wed, 9 May 2001 12:22:15 +0200 Message-ID: <9db5kg$gk5c4$1@ID-63952.news.dfncis.de> References: <9cukad$nn68@news-dxb> <9d5u1p$goiql$1@ID-63952.news.dfncis.de> <3AF67F9D.72B90142@andrewcooke.free-online.co.uk> NNTP-Posting-Host: fw.baan.com (194.149.80.1) X-Trace: fu-berlin.de 989403600 17438084 194.149.80.1 (16 [63952]) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2462.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2462.0000 Xref: newsfeed.google.com comp.lang.ada:7359 comp.lang.lisp:9858 comp.lang.smalltalk:9621 comp.lang.functional:5581 comp.lang.scheme:3723 Date: 2001-05-09T12:22:15+02:00 List-Id: "Andrew Cooke" wrote in message news:3AF67F9D.72B90142@andrewcooke.free-online.co.uk... > > For an introductory course you might omit whatever the Scheme equivalent > of setq is. And does Scheme have macros? - if so, they could go too. > > Andrew O.K. In a trivial sense, if the course is introductory enough, you might omit even lambda.. Delaying the introduction of 'set!' is often a good idea, but you have to be careful that people don't get the impression that 'define' is a kind of 'set!' (which it unfortunately is :-( ) Syntactic abstraction is a very important concept, in my view. For introductory courses I sometimes introduce a macro 'translate!' that simplifies the 'define-syntax' + 'syntax-rules' machinery, and use that to show how e.g. 'let' is defined in terms of 'lambda'. (define-syntax translate! (syntax-rules () ((translate! (name . body) new) (define-syntax name (syntax-rules () ((name . body) new) ) ) ) ) ) Then I state that the same locality principles that hold for procedures also hold for syntactic transformations, and point to the existence of let-syntax and letrec-syntax. I normally start from the REP-loop in disussing syntactic abstraction, first explaning read macros (such as quote, quasiquote) and print macros (unfortunately not well supported in Scheme, but a REP loop and a print procedure are easily written), and then come to 'define-syntax' as eval-macros. All this fits under the banner "never say the same thing twice", which covers a whole lot of software engineering.. Only in a *very* introductory course I would leave out macros altogether. Oh, and I guess some people might be willing to argue that Scheme is the *only* programming language with real macros :-) -- Biep Reply via http://www.biep.org