From DekuDekuplex at Yahoo.com Mon Jun 1 00:53:45 2009 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Mon Jun 1 00:54:43 2009 Subject: [plt-scheme] Re: HTDP on National Radio References: <99EB39A5-DE4E-4283-9ED5-DBD9A56ACE3E@gmail.com> <99EB39A5-DE4E-4283-9ED5-DBD9A56ACE3E-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> <4A23125F.1050905@ccs.neu.edu> Message-ID: On Sun, 31 May 2009 19:27:27 -0400, David Van Horn wrote: >Brent Fulgham wrote: >> I turned the radio on this morning and happened to hear radio host Leo >> Laporte recommending a young listener interested in learning to program >> visit the HTDP (http://www.htdp.org) website and download the book and >> use Dr. Scheme. >> >> Quite a shock to hear the words Lisp, Scheme, and "extremely advanced >> programming language" in a matter of five minutes on a syndicated radio >> show. ;-) > > http://techguylabs.com/radio/ShowNotes/Show566 > > Thomas, Manhattan Beach, CA - Starting a tech company > > Thomas is 10 years old and he wants to start a software company with > his friends! He programs in C++, Java, and Python?! Wow. Leo says he > wants Thomas to learn these programs right, not just noodling with > them and learning bad habits. So Leo says that Alice is a good place > to start, but Leo suggests HTDP.ORG. It’s a programming book written > by software professors all over the country and teaches "SCHEME," > which is a "flavor" of a programming language called LISP. Download > DrScheme. This will teach you to plan, design, and organize your > software ideas. The next step would be to have somebody host BBC and/or PBS television programs on programming for beginners using DrScheme. -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ From acowley at gmail.com Mon Jun 1 01:02:54 2009 From: acowley at gmail.com (Anthony Cowley) Date: Mon Jun 1 01:08:59 2009 Subject: [plt-scheme] define-for-syntax mutual recursion In-Reply-To: <990e0c030905312048q34c6f48et860cb5a804dcd29f@mail.gmail.com> References: <81addec70905312027m6bb4310ey64aa7d70631f34dd@mail.gmail.com> <990e0c030905312038h68288ddcn8e32df39b26ce365@mail.gmail.com> <81addec70905312044x7cd173ecxbe9a608155db1437@mail.gmail.com> <990e0c030905312048q34c6f48et860cb5a804dcd29f@mail.gmail.com> Message-ID: <3CF242D4-C4CC-4454-8E3A-11FBCF583979@gmail.com> Thanks, Carl, I'll give that a shot. Is there any explanation for why this is necessary, though? It seems natural to expect the define-for- syntax form to work like define. Anthony On May 31, 2009, at 11:48 PM, Carl Eastlund wrote: > On Sun, May 31, 2009 at 11:44 PM, Anthony Cowley > wrote: >> On Sun, May 31, 2009 at 11:38 PM, Carl Eastlund> > wrote: >>> You can use define-values-for-syntax: >>> >>> (define-values-for-syntax [is-even? is-odd?] >>> (values >>> (lambda (x) (if (zero? x) #t (is-odd? (sub1 x)))) >>> (lambda (x) (if (zero? x) #f (is-even? (sub1 x)))))) >> >> Ah, thanks, Carl. I usually try to avoid this form since it separates >> the name from the lambda by such a long distance, but this seems to >> be >> the quick fix for my current troubles. >> >> Anthony > > (define-syntax-rule (define-mutual-for-syntax [(name . args) . > body] ...) > (define-values-for-syntax [name ...] > (values (lambda args . body) ...))) > > (define-mutual-for-syntax > [(is-even? x) (if (zero? x) #t (is-odd? (sub1 x)))] > [(is-odd? x) (if (zero? x) #f (is-even? (sub1 x)))]) > > -- > Carl Eastlund From DekuDekuplex at Yahoo.com Mon Jun 1 02:09:30 2009 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Mon Jun 1 02:10:09 2009 Subject: [plt-scheme] Re: Off topic, but ... References: <4A1FEC83.7020205@soegaard.net> Message-ID: <42s625l0bqbnhhvie858tn2e626n4r9vdu@4ax.com> On Fri, 29 May 2009 16:09:07 +0200, Jens Axel Soegaard wrote: >A few comics tangentially related to this list: > >http://www.phdcomics.com/comics/archive.php?comicid=1022 >http://www.phdcomics.com/comics/archive.php?comicid=1002 >http://www.phdcomics.com/comics/archive.php?comicid=1047 >http://www.phdcomics.com/comics/archive.php?comicid=1078 > >Well - it is friday, These bring back nightmares from my computer science education.... -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ From wookiz at hotmail.com Mon Jun 1 02:11:40 2009 From: wookiz at hotmail.com (wooks) Date: Mon Jun 1 02:11:58 2009 Subject: [plt-scheme] Re: Why "lambda"? In-Reply-To: <0E136CA4-A82F-4C3C-B891-9970CFA9404D@adelphi.edu> References: <904774730905260753k39650950n933e8d26d804baa5@mail.gmail.com> <5dd2fe54-7e64-4b41-abd1-84540e400b68@t21g2000yqi.googlegroups.com> <20090526181852.GB17555@topoi.pooq.com> <0E136CA4-A82F-4C3C-B891-9970CFA9404D@adelphi.edu> Message-ID: <53574f5e-def5-4971-8a7b-fea59a4afded@r13g2000vbr.googlegroups.com> On May 27, 3:00?am, Stephen Bloch wrote: > On May 26, 2009, at 3:43 PM, wooks wrote: > > > On May 26, 8:22 pm, Noel Welsh wrote: > >> ... you either > >> have to change the world or learn to read it. One of these is > >> practical. > > > I tend to go for a 3rd option. Put the textbook back on the shelf and > > find one written in English. > > The problem with that is that English (like most natural human ? > languages) is notoriously unclear and ambiguous, and mathematicians ? > don't like things being unclear or ambiguous. ?So they invent ? > specialized symbols and terms that mean EXACTLY what they're defined ? > to mean, no more and no less -- not in order to be unclear, but in ? > order to be clear. ?It IS possible to write clear, precise ? > mathematics in the vernacular, without specialized symbols and terms ? > -- it was done for thousands of years -- but that style tends to be ? > so verbose that you forget what you were trying to prove by the time ? > you get to the end of it. > > Stephen Bloch > sbl...@adelphi.edu > Actually to be fair. This does more or less answer the question I asked. It doesn't explain the Greek I see or the affinity CS people (who have other notations) have for it, but I asked it originally of Mathematicians. From ntoronto at cs.byu.edu Mon Jun 1 02:26:43 2009 From: ntoronto at cs.byu.edu (Neil Toronto) Date: Mon Jun 1 02:27:02 2009 Subject: [plt-scheme] Re: HTDP on National Radio In-Reply-To: References: <99EB39A5-DE4E-4283-9ED5-DBD9A56ACE3E@gmail.com> <99EB39A5-DE4E-4283-9ED5-DBD9A56ACE3E-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> <4A23125F.1050905@ccs.neu.edu> Message-ID: <4A2374A3.3000608@cs.byu.edu> Benjamin L.Russell wrote: > > The next step would be to have somebody host BBC and/or PBS television > programs on programming for beginners using DrScheme. Yes! It would be called "The Joy of Scheming" and feature a really mellow guy with an afro like you wouldn't believe, calmly discoursing on the virtues of "happy little contracts" and "happy little test cases" while he designed programs. The show would occasionally feature some cute little code snippet he found in the wild and fixed up. There are no bugs, just happy errors! Hey, it was awesome in my head. Neil T From yinso.chen at gmail.com Mon Jun 1 04:24:52 2009 From: yinso.chen at gmail.com (YC) Date: Mon Jun 1 04:25:15 2009 Subject: [plt-scheme] Fwd: [erlang-questions] Another Programming Language Comparison In-Reply-To: <290b3ba10905311309i32e339e4mb8eaadce02615e69@mail.gmail.com> References: <290b3ba10905311309i32e339e4mb8eaadce02615e69@mail.gmail.com> Message-ID: <779bf2730906010124g4fcfb417i4258a5bb65bf9de6@mail.gmail.com> Produced by Guillaume with PLT - interesting the link first came from erlang-questions instead of plt-scheme... very good stuff about language performance visualization and comparisons in the link. Sorry if this is a duplicate for ya. Cheers, yc ---------- Forwarded message ---------- From: t ty Date: Sun, May 31, 2009 at 1:09 PM Subject: [erlang-questions] Another Programming Language Comparison To: Erlang Questions http://gmarceau.qc.ca/blog/2009/05/speed-size-and-dependability-of.html Some interesting analysis/commentaries. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090601/5b04f10e/attachment.htm From dvanhorn at ccs.neu.edu Mon Jun 1 04:38:00 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Mon Jun 1 04:39:13 2009 Subject: [plt-scheme] Re: HTDP on National Radio In-Reply-To: <4A2374A3.3000608@cs.byu.edu> References: <99EB39A5-DE4E-4283-9ED5-DBD9A56ACE3E@gmail.com> <99EB39A5-DE4E-4283-9ED5-DBD9A56ACE3E-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> <4A23125F.1050905@ccs.neu.edu> <4A2374A3.3000608@cs.byu.edu> Message-ID: <4A239368.60803@ccs.neu.edu> This isn't the first time PLT has been on the radio: http://www.npr.org/templates/story/story.php?storyId=1047843 David From stephen.degabrielle at acm.org Mon Jun 1 05:00:35 2009 From: stephen.degabrielle at acm.org (Stephen De Gabrielle) Date: Mon Jun 1 05:01:01 2009 Subject: [plt-scheme] Re: HTDP on National Radio In-Reply-To: <4A239368.60803@ccs.neu.edu> References: <99EB39A5-DE4E-4283-9ED5-DBD9A56ACE3E@gmail.com> <99EB39A5-DE4E-4283-9ED5-DBD9A56ACE3E-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> <4A23125F.1050905@ccs.neu.edu> <4A2374A3.3000608@cs.byu.edu> <4A239368.60803@ccs.neu.edu> Message-ID: <595b9ab20906010200y1a75c48dv3342cfc58b45889a@mail.gmail.com> It's a shame there is no way of measuring the impact of such 'mentions' in the media. (or public performance with things like Fluxus) s. On Mon, Jun 1, 2009 at 9:38 AM, David Van Horn wrote: -- -- Stephen De Gabrielle stephen.degabrielle@acm.org Telephone +44 (0)20 85670911 Mobile +44 (0)79 85189045 http://www.degabrielle.name/stephen -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090601/5058ec15/attachment.html From erich at snafu.de Mon Jun 1 05:44:00 2009 From: erich at snafu.de (Erich Rast) Date: Mon Jun 1 05:37:09 2009 Subject: [plt-scheme] Re: Why "lambda"? In-Reply-To: <1d3aff7f-591b-40d3-bda6-8b616bbb3bb1@q14g2000vbn.googlegroups.com> References: <1243807231.5017.7.camel@Nokia-N800-43-7> <1d3aff7f-591b-40d3-bda6-8b616bbb3bb1@q14g2000vbn.googlegroups.com> Message-ID: <1243849441.6454.23.camel@darkstar> > Insofar as the message is - there's a good reason why we do this > (clarity, avoids ambiguity, makes no difference if you abstract > etc...). No. I ain't swallowing it. I tried to avoid it, but can't resist any longer. :O There is a good reason for Greek letters and it's not just convention. I'm not sure how much you've been exposed to formal logic so far, but at least in this domain I'd say it's impossible to have a clear, correct and concise notation without using additional letters such as the Greek ones. Arbitrary symbols, usually taken from a huge Latex symbol list, are harder to read than Greek letters, and when you write down a complete logic including some meta-theorems, you'll quickly run out of ordinary Roman letters. Having the Greek alphabet is a matter of necessity when you're doing logic, because you frequently need different *types* of letters. Try to distinguish normal, italic and boldface 'A' on the blackboard---impossible. Even upper vs. lower-case letters can be a pain to write on the blackboard. IMHO, the most important thing with 'strange' letters is that (a) you have to know how to pronounce them, and (b) they need to be easily writable on the blackboard. Greek letters are fine with both respects and beat any kind of hand-made symbol at anytime. Personally, I have problems with Kyrillic, some of the less common Hebrew letters, and old German Fraktur fonts, though. Yes, I've seen logic books that used the whole Kyrillic alphabet, which might be easy for a Russian logician, but is hard to read for someone who never learned Russian. Fraktur, on the other hand, is not hard to read, but in my opinion impossible to write and read on the blackboard. From marek at xivilization.net Mon Jun 1 06:54:20 2009 From: marek at xivilization.net (Marek Kubica) Date: Mon Jun 1 07:11:52 2009 Subject: [plt-scheme] Re: HTDP on National Radio In-Reply-To: <4A2374A3.3000608@cs.byu.edu> References: <99EB39A5-DE4E-4283-9ED5-DBD9A56ACE3E@gmail.com> <99EB39A5-DE4E-4283-9ED5-DBD9A56ACE3E-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> <4A23125F.1050905@ccs.neu.edu> <4A2374A3.3000608@cs.byu.edu> Message-ID: <20090601125420.019ebf96@halmanfloyd.lan.local> On Mon, 01 Jun 2009 00:26:43 -0600 Neil Toronto wrote: > It would be called "The Joy of Scheming" and feature a really mellow > guy with an afro like you wouldn't believe, calmly discoursing on the > virtues of "happy little contracts" and "happy little test cases" > while he designed programs. The show would occasionally feature some > cute little code snippet he found in the wild and fixed up. > > There are no bugs, just happy errors! > > Hey, it was awesome in my head. Wow, that is totally awesome. It's still broadcast on TV and I like to sit there, and listen to that voice :) The more I think about it, the better it sounds. regards, Marek From robby at eecs.northwestern.edu Mon Jun 1 07:36:51 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Mon Jun 1 07:37:11 2009 Subject: [plt-scheme] define-for-syntax mutual recursion In-Reply-To: <81addec70905312043t1cf8db08q8ae277a637bb4c10@mail.gmail.com> References: <81addec70905312027m6bb4310ey64aa7d70631f34dd@mail.gmail.com> <4A234D11.4050903@cs.utah.edu> <81addec70905312043t1cf8db08q8ae277a637bb4c10@mail.gmail.com> Message-ID: <932b2f1f0906010436x4f060baele0b21f5d8f5c6708@mail.gmail.com> Probably you wanted (require (for-template scheme/base)) to avoid the #%app problem. On Sun, May 31, 2009 at 10:43 PM, Anthony Cowley wrote: > On Sun, May 31, 2009 at 11:37 PM, Chongkai Zhu wrote: >> The long answer: define them in a separate module using `define', and then >> require that module via (require (for-syntax ...)) > > Right, I'd like to avoid this for the sake of code organization and > because when I quickly tried it, my previously working code started > giving me an "unbound identifier (and no #%app syntax transformer is > bound) in: lambda" which further motivated me to try to keep related > syntax mungers together. > > Anthony > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From mflatt at cs.utah.edu Mon Jun 1 07:45:14 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Mon Jun 1 07:45:35 2009 Subject: [plt-scheme] define-for-syntax mutual recursion In-Reply-To: <3CF242D4-C4CC-4454-8E3A-11FBCF583979@gmail.com> References: <81addec70905312027m6bb4310ey64aa7d70631f34dd@mail.gmail.com> <990e0c030905312038h68288ddcn8e32df39b26ce365@mail.gmail.com> <81addec70905312044x7cd173ecxbe9a608155db1437@mail.gmail.com> <990e0c030905312048q34c6f48et860cb5a804dcd29f@mail.gmail.com> <3CF242D4-C4CC-4454-8E3A-11FBCF583979@gmail.com> Message-ID: <20090601114515.9C4466500EA@mail-svr1.cs.utah.edu> At Mon, 1 Jun 2009 01:02:54 -0400, Anthony Cowley wrote: > Is there any explanation for why > this is necessary, though? It seems natural to expect the define-for- > syntax > form to work like define. It has to do with the order of expansion. In the case of a plain `define', the macro expander can delay expanding the RHS of the `define' until it has seen all of the module's other top-level forms, so it knows all available bindings by the time it expands an expression. Values bound with `define-for-syntax', however, can be used for expanding later top-level forms in the module, so the RHS must be expanded and evaluated right away. I think there must be a way to define expansion and evaluation to allow mutually dependent `define-for-syntax' forms (e.g., complain only if a not-yet-defined identifier is actually used before it is defined, and also check for references to undefined identifiers at the end of the module body instead of when each RHS is compiled), but I never got around to refining the expander in that direction. From grettke at acm.org Mon Jun 1 00:46:38 2009 From: grettke at acm.org (Grant Rettke) Date: Mon Jun 1 08:12:20 2009 Subject: [plt-scheme] Off topic: Overt PLT Advertising Message-ID: <756daca50905312146g5ab77608h9acba6f21cfe19cb@mail.gmail.com> My employer has started aggregating employee blogs on their homepage. (See attached) I wonder what clients must think! :) -------------- next part -------------- A non-text attachment was scrubbed... Name: Picture 1.png Type: image/png Size: 302625 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090531/cff7cf24/Picture1-0001.png From grettke at acm.org Mon Jun 1 08:14:16 2009 From: grettke at acm.org (Grant Rettke) Date: Mon Jun 1 08:14:36 2009 Subject: [plt-scheme] Does anyone have non-standard keybindings for OS X that they would like to share? Message-ID: <756daca50906010514p69b0c3c8yc45d6c9f8eea9cdc@mail.gmail.com> Does anyone have non-standard keybindings for OS X that they would like to share? Since I am going to have to remap all of the insert matching brackets commands, I am wondering if anyone has done and made additional improvements in the process that they could share. I haven't tried doing so yet, but I wonder if there is an issue with making alt+shift+bracket a mapping since it is the default on Windows but not OS X. I would like to use roughly the same mappings as in Windows; but I am guessing there is some reason they are different. Is there? From DekuDekuplex at Yahoo.com Mon Jun 1 08:41:10 2009 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Mon Jun 1 08:41:46 2009 Subject: [plt-scheme] Re: Fwd: [erlang-questions] Another Programming Language Comparison References: <290b3ba10905311309i32e339e4mb8eaadce02615e69@mail.gmail.com> <290b3ba10905311309i32e339e4mb8eaadce02615e69-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> <779bf2730906010124g4fcfb417i4258a5bb65bf9de6@mail.gmail.com> Message-ID: <9fi72595v8cf6mggv6317ek3sob9a5l46k@4ax.com> Just before forwarding a near-duplicate of this message from the Haskell mailing list (see "The speed, size and dependability of programming languages" at http://www.haskell.org/pipermail/haskell/2009-June/021363.html), I saw your message. It looks like you had beaten me to the punch *-(. Aside, what I found particularly interesting about this blog entry was the blog writer's choice of PLT Scheme for generating the charts; _viz._: >Source code > >The code to generate these charts runs in PLT Scheme (MzScheme) v4.1.5. >You will need the data file from The Game's cvs repository. This file is from >2005, which is the one I used for the charts above. Update: I rerun the >generation using the 2009 data. Here are the updated big chart and colored >chart. There are fewer languages in the 2009 roundup, unfortunately. Some >languages moved in interesting ways, both most of the trends are the same. > >Despite it not having a particularly remarkable spot on this performance chart, >I code in PLT Scheme because it has a fantastic macro system. I also have >wrists problems, so coding in Scheme lets me use my ergonomic editor >DivaScheme. Not bad for PLT Scheme, considering that the writer was coding a benchmark and chose PLT Scheme as his tool! -- Benjamin L. Russell On Mon, 1 Jun 2009 01:24:52 -0700, YC wrote: >Produced by Guillaume with PLT - interesting the link first came from >erlang-questions instead of plt-scheme... very good stuff about language >performance visualization and comparisons in the link. Sorry if this is a >duplicate for ya. > >Cheers, >yc > >---------- Forwarded message ---------- >From: t ty >Date: Sun, May 31, 2009 at 1:09 PM >Subject: [erlang-questions] Another Programming Language Comparison >To: Erlang Questions > > >http://gmarceau.qc.ca/blog/2009/05/speed-size-and-dependability-of.html > >Some interesting analysis/commentaries. -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ From sk at cs.brown.edu Mon Jun 1 08:59:01 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Mon Jun 1 08:59:41 2009 Subject: [plt-scheme] Off topic: Overt PLT Advertising In-Reply-To: <756daca50905312146g5ab77608h9acba6f21cfe19cb@mail.gmail.com> References: <756daca50905312146g5ab77608h9acba6f21cfe19cb@mail.gmail.com> Message-ID: Very cool! Hopefully nobody in your company has noticed the Web page lately. (-: From toddobryan at gmail.com Mon Jun 1 09:14:47 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Mon Jun 1 09:15:09 2009 Subject: [plt-scheme] Natural Language parsing in CS1 Message-ID: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> I'm starting to think about my courses for next year, and one thing that I really want to do with my intro classes is introduce topics that require the same kinds of thinking as programming, but feel different enough that students will see them as something different. For example, I think I'm going to do a short unit on finite state automata and regular expressions (and I'll use something like the macros Shriram presents in his "The Swine Before Perl" talk http://www.cs.brown.edu/~sk/Publications/Talks/SwineBeforePerl/ ). I also thought I could do a short unit on parsing, in order to introduce the idea of context-free grammars. What I'd like to do is create a teachpack that would take code like this: (define-grammar G ?((S -> NP VP) ? (NP -> "Bob") ? (VP -> "ate"))) and then (parse G S "Bob ate") would produce a parse tree (S (NP ("Bob")) ? ?(VP ("ate"))) and ideally, I could write a function that would display this as text (this looks good in monospace): ?? ? S +----+----+ NP??????? VP |???????? | "Bob"??? "ate" and maybe even display the tree graphically. Eventually, I'd like to do some kind of features: (define-grammar G ((S -> NP[number: X] VP[number: X]) (NP[number: sing] -> "he") (NP[number: plur] -> "they") (VP[number: sing] -> "sleeps") (VP[number: plur] -> "sleep"))) So that "He sleeps" and "They sleep" parse, but *"They sleeps" and *"He sleep" don't. So, the question... Where do I start? I can write a parser that produces a list of all possible parses given a grammar and a list of terminals, but I'm not sure how to approach this in Scheme. After the recent comment that OO doesn't scale down, I'm wondering if Grammar and Tree are worth my first attempt at classes in Scheme. I think I should probably use strings for the terminals, but should I use symbols for the symbols of the grammar or is there something built in that would handle attribute-value pairs nicely if I get that far? Any suggestions appreciated. I'll try to publish back what I come up with, along with whatever assignments I come up with. Thanks, Todd From toddobryan at gmail.com Mon Jun 1 09:18:29 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Mon Jun 1 09:18:48 2009 Subject: [plt-scheme] libGL.so Message-ID: <904774730906010618l3ed7b1ffk1bcb08424e49621e@mail.gmail.com> I'm trying to play Gobblet on Ubuntu using the Debian 4.1.5 package, but I get an error saying that libGL.so is not available. I have libGLU.so, but if I try to install the package that provides libGL, it gets rid of some of the other packages (including ubuntu-desktop). Can someone with more Linux-fu than I explain the way out of this conundrum? Todd From acowley at seas.upenn.edu Mon Jun 1 09:37:43 2009 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Mon Jun 1 09:38:01 2009 Subject: [plt-scheme] define-for-syntax mutual recursion In-Reply-To: <20090601114515.9C4466500EA@mail-svr1.cs.utah.edu> References: <81addec70905312027m6bb4310ey64aa7d70631f34dd@mail.gmail.com> <990e0c030905312038h68288ddcn8e32df39b26ce365@mail.gmail.com> <81addec70905312044x7cd173ecxbe9a608155db1437@mail.gmail.com> <990e0c030905312048q34c6f48et860cb5a804dcd29f@mail.gmail.com> <3CF242D4-C4CC-4454-8E3A-11FBCF583979@gmail.com> <20090601114515.9C4466500EA@mail-svr1.cs.utah.edu> Message-ID: <81addec70906010637n2c63098s4c23510d724825c2@mail.gmail.com> On Mon, Jun 1, 2009 at 7:45 AM, Matthew Flatt wrote: > It has to do with the order of expansion. In the case of a plain > `define', the macro expander can delay expanding the RHS of the > ... Thanks for the explanation and help, everyone! My biggest concern was actually that I had fundamentally misunderstood some part of how a module was expanded, so I'm glad to hear that that's not the case. At least my code is now working with the (require (for-template scheme/base)) in an auxiliary module where my syntax eaters now live. Anthony From acowley at seas.upenn.edu Mon Jun 1 09:47:13 2009 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Mon Jun 1 09:47:32 2009 Subject: [plt-scheme] Does anyone have non-standard keybindings for OS X that they would like to share? In-Reply-To: <756daca50906010514p69b0c3c8yc45d6c9f8eea9cdc@mail.gmail.com> References: <756daca50906010514p69b0c3c8yc45d6c9f8eea9cdc@mail.gmail.com> Message-ID: <81addec70906010647i2c90b98dy7b004c56296c2f02@mail.gmail.com> On Mon, Jun 1, 2009 at 8:14 AM, Grant Rettke wrote: > Does anyone have non-standard keybindings for OS X that they would > like to share? Not intrinsically OS X-specific, but the only additions I always make are chords for comment-out and uncomment (with semicolons) a block of selected text. The one I wish I had (from emacs) is a "reformat" command that I could hit comment text with to reformat a run of text to 80 character width lines, but I've never gotten around to figuring that out. (keybinding "d:semicolon" (lambda (editor event) (send (send editor get-keymap) call-function "comment-out" editor event #t))) (keybinding "c:d:semicolon" (lambda (editor event) (send (send editor get-keymap) call-function "uncomment" editor event #t))) From eli at barzilay.org Mon Jun 1 09:49:07 2009 From: eli at barzilay.org (Eli Barzilay) Date: Mon Jun 1 09:49:29 2009 Subject: [plt-scheme] libGL.so In-Reply-To: <904774730906010618l3ed7b1ffk1bcb08424e49621e@mail.gmail.com> References: <904774730906010618l3ed7b1ffk1bcb08424e49621e@mail.gmail.com> Message-ID: <18979.56403.860304.291069@winooski.ccs.neu.edu> On Jun 1, Todd O'Bryan wrote: > I'm trying to play Gobblet on Ubuntu using the Debian 4.1.5 package, > but I get an error saying that libGL.so is not available. I have > libGLU.so, but if I try to install the package that provides libGL, > it gets rid of some of the other packages (including > ubuntu-desktop). > > Can someone with more Linux-fu than I explain the way out of this > conundrum? Do you have any other libGL.so library? -- try ls /usr/lib/libGL.so* and if you see one, then you can just create a symlink to the version-less name, for example: cd /usr/lib ln -s libGL.so.1 libGL.so (In 4.2 the sgl library will look for that version too, so this won't be needed.) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From robby at eecs.northwestern.edu Mon Jun 1 09:50:22 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Mon Jun 1 09:50:58 2009 Subject: [plt-scheme] Does anyone have non-standard keybindings for OS X that they would like to share? In-Reply-To: <756daca50906010514p69b0c3c8yc45d6c9f8eea9cdc@mail.gmail.com> References: <756daca50906010514p69b0c3c8yc45d6c9f8eea9cdc@mail.gmail.com> Message-ID: <932b2f1f0906010650t7440e66dj2056a64aed6171ef@mail.gmail.com> The main difference between windows and mac os x is the menu shortcut key is not control. This means that many of the underlying emacs bindings (which are often control-based) are visible on the mac. Robby On Mon, Jun 1, 2009 at 7:14 AM, Grant Rettke wrote: > Does anyone have non-standard keybindings for OS X that they would > like to share? > > Since I am going to have to remap all of the insert matching brackets > commands, I am wondering if anyone has done and made additional > improvements in the process that they could share. > > I haven't tried doing so yet, but I wonder if there is an issue with > making alt+shift+bracket a mapping since it is the default on Windows > but not OS X. > > I would like to use roughly the same mappings as in Windows; but I am > guessing there is some reason they are different. Is there? > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From sbloch at adelphi.edu Mon Jun 1 09:52:51 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Mon Jun 1 09:53:48 2009 Subject: [plt-scheme] Another Programming Language Comparison In-Reply-To: <9fi72595v8cf6mggv6317ek3sob9a5l46k@4ax.com> References: <290b3ba10905311309i32e339e4mb8eaadce02615e69@mail.gmail.com> <290b3ba10905311309i32e339e4mb8eaadce02615e69-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> <779bf2730906010124g4fcfb417i4258a5bb65bf9de6@mail.gmail.com> <9fi72595v8cf6mggv6317ek3sob9a5l46k@4ax.com> Message-ID: On Jun 1, 2009, at 8:41 AM, Benjamin L.Russell wrote: > Aside, what I found particularly interesting about this blog entry was > the blog writer's choice of PLT Scheme for generating the charts; > ... > Not bad for PLT Scheme, considering that the writer was coding a > benchmark and chose PLT Scheme as his tool! Actually, he was coding an analysis of benchmarks, not a benchmark itself. But yes, Guillaume is a member of the PLT community (a former student of Shriram's, right?), has used my textbook in class and provided lots of valuable suggestions for improving it. Stephen Bloch sbloch@adelphi.edu From eli at barzilay.org Mon Jun 1 09:56:14 2009 From: eli at barzilay.org (Eli Barzilay) Date: Mon Jun 1 09:56:36 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> Message-ID: <18979.56830.723396.281647@winooski.ccs.neu.edu> On Jun 1, Todd O'Bryan wrote: > > I also thought I could do a short unit on parsing, in order to > introduce the idea of context-free grammars. What I'd like to do is > create a teachpack that would take code like this: > > (define-grammar G > ?((S -> NP VP) > ? (NP -> "Bob") > ? (VP -> "ate"))) > > and then > > (parse G S "Bob ate") > > would produce a parse tree > > (S (NP ("Bob")) > ? ?(VP ("ate"))) > [...] Just a quick warning on this: the world of natural language processing has moved away from this kind of symbolic approach to parsing texts, so it would be better to leave such exercises for a formal language instead (like writing a parser for a mini language, for example). Another thing that I did in the past that might be interesting is an "ambiguous" construct that chooses a random sub-form to evaluate and does not evaluate the rest. For example, (define (foo) (choose (list 'y) (cons 'x (foo)))) would return a list of a random number of `x's, terminated by a `y'. This is a different aspect of NLP -- text generation -- which generally works better with such a symbolic approach. > Eventually, I'd like to do some kind of features: > > (define-grammar G > ((S -> NP[number: X] VP[number: X]) > (NP[number: sing] -> "he") > (NP[number: plur] -> "they") > (VP[number: sing] -> "sleeps") > (VP[number: plur] -> "sleep"))) > > So that "He sleeps" and "They sleep" parse, but *"They sleeps" and > *"He sleep" don't. If you do want to go with this, then a good place to start would be to look at a system called "Fuf", which was written by Michael Elhadad a while back. (That system was written in Lisp, but the code should be very "schemy".) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From matthias at ccs.neu.edu Mon Jun 1 10:02:30 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Jun 1 10:03:40 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> Message-ID: <90DFD4F0-CB07-4756-BB9A-380283CC0FA6@ccs.neu.edu> Let me recommend an alternative. Provide a data definition for parse trees to your students and just ask them to write functions that process these parse trees. You may/should need a teachpack that helps you represent parse trees, but it is much less work than what you propose. For a decent experience, your teachpack may also provide some large examples of parse trees. One of the functions you can assign then is the sentence diagramming thing you sketch below. (I have done something like that once.) If the project is a success, you can expand it in a second semester (year) with the parsing function that you propose here. -- Matthias On Jun 1, 2009, at 9:14 AM, Todd O'Bryan wrote: > I'm starting to think about my courses for next year, and one thing > that I really want to do with my intro classes is introduce topics > that require the same kinds of thinking as programming, but feel > different enough that students will see them as something different. > > For example, I think I'm going to do a short unit on finite state > automata and regular expressions (and I'll use something like the > macros Shriram presents in his "The Swine Before Perl" talk > http://www.cs.brown.edu/~sk/Publications/Talks/SwineBeforePerl/ ). > > I also thought I could do a short unit on parsing, in order to > introduce the idea of context-free grammars. What I'd like to do is > create a teachpack that would take code like this: > > (define-grammar G > ((S -> NP VP) > (NP -> "Bob") > (VP -> "ate"))) > > and then > > (parse G S "Bob ate") > > would produce a parse tree > > (S (NP ("Bob")) > (VP ("ate"))) > > and ideally, I could write a function that would display this as text > (this looks good in monospace): > > S > +----+----+ > NP VP > | | > "Bob" "ate" > > and maybe even display the tree graphically. > > Eventually, I'd like to do some kind of features: > > (define-grammar G > ((S -> NP[number: X] VP[number: X]) > (NP[number: sing] -> "he") > (NP[number: plur] -> "they") > (VP[number: sing] -> "sleeps") > (VP[number: plur] -> "sleep"))) > > So that "He sleeps" and "They sleep" parse, but *"They sleeps" and > *"He sleep" don't. > > So, the question... > > Where do I start? I can write a parser that produces a list of all > possible parses given a grammar and a list of terminals, but I'm not > sure how to approach this in Scheme. After the recent comment that OO > doesn't scale down, I'm wondering if Grammar and Tree are worth my > first attempt at classes in Scheme. I think I should probably use > strings for the terminals, but should I use symbols for the symbols of > the grammar or is there something built in that would handle > attribute-value pairs nicely if I get that far? > > Any suggestions appreciated. I'll try to publish back what I come up > with, along with whatever assignments I come up with. > > Thanks, > Todd > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From sk at cs.brown.edu Mon Jun 1 10:04:25 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Mon Jun 1 10:05:03 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: <18979.56830.723396.281647@winooski.ccs.neu.edu> References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> <18979.56830.723396.281647@winooski.ccs.neu.edu> Message-ID: I agree with Eli (who knows more about this topic than we might imagine). It is very difficult to make these kinds of NL parsers scale to any complexity, and moreover, the kinds that do (those used in real software today) use a very different approach, so it's not like there's a smooth continuum from here to there. It would actually be somewhat misleading to show this and suggest that this is how real NL parsers work, just with more of the same. Shriram From sk at cs.brown.edu Mon Jun 1 10:05:45 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Mon Jun 1 10:06:27 2009 Subject: [plt-scheme] Another Programming Language Comparison In-Reply-To: References: <290b3ba10905311309i32e339e4mb8eaadce02615e69@mail.gmail.com> <290b3ba10905311309i32e339e4mb8eaadce02615e69-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> <779bf2730906010124g4fcfb417i4258a5bb65bf9de6@mail.gmail.com> <9fi72595v8cf6mggv6317ek3sob9a5l46k@4ax.com> Message-ID: Former student of mine and about to begin (next week) as a student of Kathi's. So I wouldn't read too much into his use of PLT Scheme. If he hadn't, he knows I'd be harassing him next week. (-: On Mon, Jun 1, 2009 at 9:52 AM, Stephen Bloch wrote: > > On Jun 1, 2009, at 8:41 AM, Benjamin L.Russell wrote: > >> Aside, what I found particularly interesting about this blog entry was >> the blog writer's choice of PLT Scheme for generating the charts; >> ... >> Not bad for PLT Scheme, considering that the writer was coding a >> benchmark and chose PLT Scheme as his tool! > > Actually, he was coding an analysis of benchmarks, not a benchmark itself. > ?But yes, Guillaume is a member of the PLT community (a former student of > Shriram's, right?), has used my textbook in class and provided lots of > valuable suggestions for improving it. > > > Stephen Bloch > sbloch@adelphi.edu > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From ramalho at gmail.com Mon Jun 1 10:56:38 2009 From: ramalho at gmail.com (Luciano Ramalho) Date: Mon Jun 1 10:56:57 2009 Subject: [plt-scheme] Another Programming Language Comparison In-Reply-To: References: <290b3ba10905311309i32e339e4mb8eaadce02615e69@mail.gmail.com> <290b3ba10905311309i32e339e4mb8eaadce02615e69-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> <779bf2730906010124g4fcfb417i4258a5bb65bf9de6@mail.gmail.com> <9fi72595v8cf6mggv6317ek3sob9a5l46k@4ax.com> Message-ID: <4331ad810906010756x4ce9847cy5826df1449be839a@mail.gmail.com> On Mon, Jun 1, 2009 at 10:52 AM, Stephen Bloch wrote: > Actually, he was coding an analysis of benchmarks, not a benchmark itself. > ?But yes, Guillaume is a member of the PLT community (a former student of > Shriram's, right?), has used my textbook in class and provided lots of > valuable suggestions for improving it. Where can I find your textbook, Stephen? I'm just getting involved in Scheme and collecting references. After a few Google and Worldcat searches I did find your homepage at Adelphi, but not your book... Cheers, Luciano From chadestioco at gmail.com Mon Jun 1 10:57:09 2009 From: chadestioco at gmail.com (Andrei Estioco) Date: Mon Jun 1 10:57:52 2009 Subject: [plt-scheme] Re: Why "lambda"? In-Reply-To: <779bf2730905311234x5737cd80r176df0c8f324340c@mail.gmail.com> References: <4A2000C5.9090802@uwaterloo.ca> <78b04c8b-0aa7-44ad-8a29-47ae1fd7d77d@j12g2000vbl.googlegroups.com> <353b408f-2585-4e92-9b25-ce2e2c96b273@r13g2000vbr.googlegroups.com> <9b1fff280905301838t689ee96fqe75719e412268bdd@mail.gmail.com> <99ba57d8-6f6d-43c5-8c8f-ebeec6ecf85f@m17g2000vbi.googlegroups.com> <2B19AF04D3044BA8A71EAB0EA05CF92B@uw2b2dff239c4d> <779bf2730905311234x5737cd80r176df0c8f324340c@mail.gmail.com> Message-ID: Hear, hear YC. Symbols really *do* matter. Although with regards to the Physics part, I beg to disagree. I just took Physics (this particular course covering Classic Newtonian Mechanics). I really had trouble with the variables. Sometimes T (in caps) refers to period, sometimes to tension. Then there's small rho (for density) and p (for pressure). I've had the time of my life trying to figure out if the symbol is small rho or p, their only difference being that, the upper left edge of small rho is smooth. When the system in question gets complex, this can be quite a pain in the neck (literally and figuratively). Suddenly, I remembered one of the things my most recent Computer Science instructor prioritized in grading our code: good variable names. (Sure, subscripts are quite handy in the abovementioned case. I found them useful when I solve at home. However, I found them pesky in face of exam time pressure) Well, just thought I'd give some opinion. I'm a student and it sounds like most of you here are educators. To balance things pretty well. 2009/6/1 YC > > On Sun, May 31, 2009 at 11:41 AM, Jos Koot wrote: > >> >> That does not sound like a sound idea. Learning programming, or maths or >> music is like learning a language. The alphabet is part of it. If you don't >> master the alphabet, you can'r read communications of others. >> >> There is a (small) possibility you only want to understand the essentials >> without being disturbed by a new language (cq alphabet). But if the subject >> catches you and you want to read more about it, ignorance of the language >> gives you no access to other literature. >> >> We are even lucky compared to Chinese people, I think. May be we should >> use Chinese characters in our maths too. A very rich set of new symbols! >> >> > Yes the symbol matters. I would love to see someone experiment with using > Chinese characters and see what happens. It's just abstractions right? > Then one should have no issue picking up the following two equations with > equal ease. > > 能 = 量光^2 > > E = MC^2 > > At least physics equations' choice of symbols often have direct meanings, > which aids understanding. Math symbols often appeared arbitrary. > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -- Chad Estioco BS Computer Science (ongoing) University of the Philippines-Diliman ============================== http://www.geocities.com/lokisky_walker -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090601/6e0566bf/attachment.htm From plragde at uwaterloo.ca Mon Jun 1 11:04:46 2009 From: plragde at uwaterloo.ca (Prabhakar Ragde) Date: Mon Jun 1 11:05:17 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> Message-ID: <4A23EE0E.9010303@uwaterloo.ca> Todd wrote: > I think I'm going to do a short unit on finite state > automata and regular expressions (and I'll use something like the > macros Shriram presents in his "The Swine Before Perl" talk > http://www.cs.brown.edu/~sk/Publications/Talks/SwineBeforePerl/ ). May I also suggest the "derivatives" approach to regular expressions? It dates back to 1961, but is nicely described in a paper by Owens, Reppy, and Turon in the March 2009 issue of the Journal of Functional Programming (Owens used this approach in the parser-tools library that ships with PLT Scheme). The idea is simple: a regular expression is a tree. So write a function that consumes a regular expression E and a character c, and produces the regular expression E' describing all strings described by E that start with c. It's easy to program in Scheme (at least a basic version without lots of efficiency hacks). > I also thought I could do a short unit on parsing, in order to > introduce the idea of context-free grammars. Recursive-descent parsing with just recognition is not bad, though you have to worry about left recursion. If you want to produce the parse tree or trees, or produce meaningful error messages, you need to develop some machinery. It may be too much in an introductory course. In our second course, I show them how to implement Scheme's `read' (for lists of symbols and natural numbers), and then point out how it can be generalized to parse XML and (well-formed) HTML. That might be another direction to pursue. I'll send you some slides from a (too-jam-packed) talk on functional lexing and parsing I gave to the Computer Science Club here at UW. (The slides are available on their server, but it seems to be down at the moment.) --PR From ramalho at gmail.com Mon Jun 1 11:12:31 2009 From: ramalho at gmail.com (Luciano Ramalho) Date: Mon Jun 1 11:20:15 2009 Subject: [plt-scheme] Re: Why "lambda"? In-Reply-To: References: <1243807231.5017.7.camel@Nokia-N800-43-7> Message-ID: <4331ad810906010812y1ed3a6a6r8410684a835ab74a@mail.gmail.com> On Sun, May 31, 2009 at 7:53 PM, Shriram Krishnamurthi wrote: > Aside: Though Postel's Law makes for good copy, it's also the cause > for at least part of the current mess with HTML, JavaScript, and > browsers. And also the cause of the runaway success of the Web, which after decades finally allowed the Internet to benefit people who were not in some academic niche. If malformed pages and ill-defined programming languages were verboten, a lot of wonderful things would just not have been built... Cheers, Luciano From hendrik at topoi.pooq.com Mon Jun 1 11:27:32 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Mon Jun 1 11:33:53 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: <4A23EE0E.9010303@uwaterloo.ca> References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> <4A23EE0E.9010303@uwaterloo.ca> Message-ID: <20090601152731.GA1130@topoi.pooq.com> On Mon, Jun 01, 2009 at 11:04:46AM -0400, Prabhakar Ragde wrote: > Todd wrote: > > >I think I'm going to do a short unit on finite state > >automata and regular expressions (and I'll use something like the > >macros Shriram presents in his "The Swine Before Perl" talk > >http://www.cs.brown.edu/~sk/Publications/Talks/SwineBeforePerl/ ). > > May I also suggest the "derivatives" approach to regular expressions? It > dates back to 1961, but is nicely described in a paper by Owens, Reppy, > and Turon in the March 2009 issue of the Journal of Functional > Programming (Owens used this approach in the parser-tools library that > ships with PLT Scheme). The idea is simple: a regular expression is a > tree. So write a function that consumes a regular expression E and a > character c, and produces the regular expression E' describing all > strings described by E that start with c. It's easy to program in Scheme > (at least a basic version without lots of efficiency hacks). > > >I also thought I could do a short unit on parsing, in order to > >introduce the idea of context-free grammars. > > Recursive-descent parsing with just recognition is not bad, though you > have to worry about left recursion. If you want to produce the parse > tree or trees, or produce meaningful error messages, you need to develop > some machinery. It may be too much in an introductory course. In our > second course, I show them how to implement Scheme's `read' (for lists > of symbols and natural numbers), and then point out how it can be > generalized to parse XML and (well-formed) HTML. That might be another > direction to pursue. > > I'll send you some slides from a (too-jam-packed) talk on functional > lexing and parsing I gave to the Computer Science Club here at UW. (The > slides are available on their server, but it seems to be down at the > moment.) --PR In a first course on compiling, the first assignment was to take a very simple language (explicitly specified as part of the assignment) and to translate it to object code (also explicitly specified -- I specified exactly what code every source-language construct was to be translated to). I provided them with a sample program to translate. The trick to the assignment was that the language was a notation for grammars with explicit output commands to be performed during the parse, its semantics was a straight recursive-descent parse, and the sample program was itself the solution to the assignment (except that it was written in a language not available on their computer (until they finished the assignment, of course)) I gave them two weeks to do it. It worked. Afterwards they knew a fair amount of the pragmatics of recursive-descent parsing. -- hendrik From gregor at cs.ubc.ca Mon Jun 1 12:46:13 2009 From: gregor at cs.ubc.ca (Gregor Kiczales) Date: Mon Jun 1 12:46:37 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> Message-ID: Have you looked at the book David Evans (Virginia) has been writing? http://www.cs.virginia.edu/~evans/ctbook/ Your goal sounds similar to part of his. On 1-Jun-09, at 6:14 AM, Todd O'Bryan wrote: > I'm starting to think about my courses for next year, and one thing > that I really want to do with my intro classes is introduce topics > that require the same kinds of thinking as programming, but feel > different enough that students will see them as something different. > > For example, I think I'm going to do a short unit on finite state > automata and regular expressions (and I'll use something like the > macros Shriram presents in his "The Swine Before Perl" talk > http://www.cs.brown.edu/~sk/Publications/Talks/SwineBeforePerl/ ). > > I also thought I could do a short unit on parsing, in order to > introduce the idea of context-free grammars. What I'd like to do is > create a teachpack that would take code like this: > > (define-grammar G > ((S -> NP VP) > (NP -> "Bob") > (VP -> "ate"))) > > and then > > (parse G S "Bob ate") > > would produce a parse tree > > (S (NP ("Bob")) > (VP ("ate"))) > > and ideally, I could write a function that would display this as text > (this looks good in monospace): > > S > +----+----+ > NP VP > | | > "Bob" "ate" > > and maybe even display the tree graphically. > > Eventually, I'd like to do some kind of features: > > (define-grammar G > ((S -> NP[number: X] VP[number: X]) > (NP[number: sing] -> "he") > (NP[number: plur] -> "they") > (VP[number: sing] -> "sleeps") > (VP[number: plur] -> "sleep"))) > > So that "He sleeps" and "They sleep" parse, but *"They sleeps" and > *"He sleep" don't. > > So, the question... > > Where do I start? I can write a parser that produces a list of all > possible parses given a grammar and a list of terminals, but I'm not > sure how to approach this in Scheme. After the recent comment that OO > doesn't scale down, I'm wondering if Grammar and Tree are worth my > first attempt at classes in Scheme. I think I should probably use > strings for the terminals, but should I use symbols for the symbols of > the grammar or is there something built in that would handle > attribute-value pairs nicely if I get that far? > > Any suggestions appreciated. I'll try to publish back what I come up > with, along with whatever assignments I come up with. > > Thanks, > Todd > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From toddobryan at gmail.com Mon Jun 1 12:54:18 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Mon Jun 1 12:54:41 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> Message-ID: <904774730906010954h581615t18b94c377d5592e8@mail.gmail.com> I had not seen that...thanks for the link. On Mon, Jun 1, 2009 at 12:46 PM, Gregor Kiczales wrote: > Have you looked at the book David Evans (Virginia) has been writing? > > http://www.cs.virginia.edu/~evans/ctbook/ > > Your goal sounds similar to part of his. > > > On 1-Jun-09, at 6:14 AM, Todd O'Bryan wrote: > >> I'm starting to think about my courses for next year, and one thing >> that I really want to do with my intro classes is introduce topics >> that require the same kinds of thinking as programming, but feel >> different enough that students will see them as something different. >> >> For example, I think I'm going to do a short unit on finite state >> automata and regular expressions (and I'll use something like the >> macros Shriram presents in his "The Swine Before Perl" talk >> http://www.cs.brown.edu/~sk/Publications/Talks/SwineBeforePerl/ ). >> >> I also thought I could do a short unit on parsing, in order to >> introduce the idea of context-free grammars. What I'd like to do is >> create a teachpack that would take code like this: >> >> (define-grammar G >> ?((S -> NP VP) >> ?(NP -> "Bob") >> ?(VP -> "ate"))) >> >> and then >> >> (parse G S "Bob ate") >> >> would produce a parse tree >> >> (S (NP ("Bob")) >> ? (VP ("ate"))) >> >> and ideally, I could write a function that would display this as text >> (this looks good in monospace): >> >> ? ? S >> +----+----+ >> NP ? ? ? ?VP >> | ? ? ? ? | >> "Bob" ? ?"ate" >> >> and maybe even display the tree graphically. >> >> Eventually, I'd like to do some kind of features: >> >> (define-grammar G >> ?((S -> NP[number: X] VP[number: X]) >> ?(NP[number: sing] -> "he") >> ?(NP[number: plur] -> "they") >> ?(VP[number: sing] -> "sleeps") >> ?(VP[number: plur] -> "sleep"))) >> >> So that "He sleeps" and "They sleep" parse, but *"They sleeps" and >> *"He sleep" don't. >> >> So, the question... >> >> Where do I start? I can write a parser that produces a list of all >> possible parses given a grammar and a list of terminals, but I'm not >> sure how to approach this in Scheme. After the recent comment that OO >> doesn't scale down, I'm wondering if Grammar and Tree are worth my >> first attempt at classes in Scheme. I think I should probably use >> strings for the terminals, but should I use symbols for the symbols of >> the grammar or is there something built in that would handle >> attribute-value pairs nicely if I get that far? >> >> Any suggestions appreciated. I'll try to publish back what I come up >> with, along with whatever assignments I come up with. >> >> Thanks, >> Todd >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > From ebellani at gmail.com Mon Jun 1 12:57:03 2009 From: ebellani at gmail.com (ebellani@gmail.com) Date: Mon Jun 1 12:57:42 2009 Subject: [plt-scheme] Poignant comparison Message-ID: I was wandering in some old articles for a research I'm doing, and ended up finding this article[1]. Very beautiful and well argued article about teaching programming, specially to high school students (I think it is specially relevant for those in the US, but the concepts are for everywhere). Anyone else has read it and wanted to share some thoughts? [1] (Symbolic Programming Vs. the A.P. Curriculum by Brian Harvey). http://el.media.mit.edu/Logo-foundation/pubs/papers/symbolic_vs_ap.html -- Eduardo Bellani www.cnxs.com.br Someone once called me "just a dreamer" That offended me, the "just" part. Being a dreamer is hard work. It really gets hard when you start believing in your dreams. --Doug Engelbart -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: OpenPGP digital signature Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090601/e72b5fc9/signature.pgp From clements at brinckerhoff.org Mon Jun 1 14:22:29 2009 From: clements at brinckerhoff.org (John Clements) Date: Mon Jun 1 14:22:57 2009 Subject: [plt-scheme] Does anyone have non-standard keybindings for OS X that they would like to share? In-Reply-To: <756daca50906010514p69b0c3c8yc45d6c9f8eea9cdc@mail.gmail.com> References: <756daca50906010514p69b0c3c8yc45d6c9f8eea9cdc@mail.gmail.com> Message-ID: <5E74362B-F36D-4249-B7B4-4F38163A371C@brinckerhoff.org> On Jun 1, 2009, at 5:14 AM, Grant Rettke wrote: > Does anyone have non-standard keybindings for OS X that they would > like to share? Here's what I use: it maps plain old paren to insert-()-pair; no escape or meta required. It does the same for curly braces and quotes. It turns out that this doesn't work for square brackets--this may be because of smart parens, and the solution might be as simple as disabling smart parens. (module jbc-keybindings framework/keybinding-lang (define (kb binder function) (keybinding binder (lambda (editor event) (send (send editor get-keymap) call-function function editor event #t)))) (kb "~c:s:(" "insert-()-pair") (kb "~c:s:{" "insert-{}-pair") (kb "~c:s:\"" "insert-\"\"-pair")) > Since I am going to have to remap all of the insert matching brackets > commands, I am wondering if anyone has done and made additional > improvements in the process that they could share. > > I haven't tried doing so yet, but I wonder if there is an issue with > making alt+shift+bracket a mapping since it is the default on Windows > but not OS X. > > I would like to use roughly the same mappings as in Windows; but I am > guessing there is some reason they are different. Is there? > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2484 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090601/cb06c4b6/smime.bin From eli at barzilay.org Mon Jun 1 14:24:39 2009 From: eli at barzilay.org (Eli Barzilay) Date: Mon Jun 1 14:25:01 2009 Subject: [plt-scheme] PLT Scheme v4.2 Message-ID: PLT Scheme version 4.2 is now available from http://plt-scheme.org/ Internally, this version includes a conversion from C++ to Scheme for part of the GUI toolbox --- specifically, 25k lines of code that implement the general text and pasteboard editor. This conversion is a start on a larger reimplementation of the GUI toolbox. Although we believe that this change will help make PLT Scheme better in the long run, we must expect bugs in the short term due to porting errors. Users should therefore be aware of the change, even though the new implementation is meant to behave the same as previous versions. * A new statistical profiler is now available; see the "profiler" manual for more information. Currently, the profiler supports only textual output, but future plans include a GUI interface and DrScheme integration. * The `world' teachpack is now deprecated. Its replacement `universe' has a new interface that uses strings instead of symbols and characters. * Web-server: Native continuations in the stateless servlet language support capturing continuations from untransformed contexts; soft state library for stateless servlets. * DrScheme's Stepper can now jump to a selected program expression. * New in `scheme/base': `hash-has-key?', `hash-ref!', `in-sequences', `in-cycle'. New in `scheme': `count', `make-list' (from `scheme/list'), `const' (from `scheme/function'). * Some performance improvements, including faster start-up for small programs. The latter is a result of delaying module invocations at higher phases (compile time, meta-compile time, etc.) until compilation is demanded at the next lower phase; this on-demand instantiation is per-phase, as opposed to per-module within a phase. [Note that mirror sites can take a while to catch up with the new downloads.] Feedback Welcome, -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From toddobryan at gmail.com Mon Jun 1 14:40:11 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Mon Jun 1 14:40:37 2009 Subject: [plt-scheme] libGL.so In-Reply-To: <18979.56403.860304.291069@winooski.ccs.neu.edu> References: <904774730906010618l3ed7b1ffk1bcb08424e49621e@mail.gmail.com> <18979.56403.860304.291069@winooski.ccs.neu.edu> Message-ID: <904774730906011140w7d6683ddxa92ee67f1ee0e7f8@mail.gmail.com> OK, that got Gobblet to start. And then I had a core dump. I'll see if I can figure out what's going on and send you a decent error message. On Mon, Jun 1, 2009 at 9:49 AM, Eli Barzilay wrote: > On Jun ?1, Todd O'Bryan wrote: >> I'm trying to play Gobblet on Ubuntu using the Debian 4.1.5 package, >> but I get an error saying that libGL.so is not available. I have >> libGLU.so, but if I try to install the package that provides libGL, >> it gets rid of some of the other packages (including >> ubuntu-desktop). >> >> Can someone with more Linux-fu than I explain the way out of this >> conundrum? > > Do you have any other libGL.so library? ?-- try > > ?ls /usr/lib/libGL.so* > > and if you see one, then you can just create a symlink to the > version-less name, for example: > > ?cd /usr/lib > ?ln -s libGL.so.1 libGL.so > > (In 4.2 the sgl library will look for that version too, so this won't > be needed.) > > -- > ? ? ? ? ?((lambda (x) (x x)) (lambda (x) (x x))) ? ? ? ? ?Eli Barzilay: > ? ? ? ? ? ? ? ? ?http://www.barzilay.org/ ? ? ? ? ? ? ? ? Maze is Life! > From toddobryan at gmail.com Mon Jun 1 14:42:58 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Mon Jun 1 14:43:16 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> <18979.56830.723396.281647@winooski.ccs.neu.edu> Message-ID: <904774730906011142q3e370d5fme220026c07674012@mail.gmail.com> I'm sorry I wasn't as clear as I should have been... I do NOT want my students to write the parsers or deal with the parse trees more than understanding what they represent. The challenge for them would be writing grammars that recognize grammatical sentences, don't recognize ungrammatical ones, and allow for more than one parse of ambiguous sentences that capture the ambiguity (e.g., "The mother of the boy and the girl slept." can mean that one or two people slept.) Yes, it's a toy project and doesn't scale well, but it's an interesting application of a skill that's very similar to but feels very different from traditional programming. (I guess it's actually more akin to declarative programming ala ProLog or something similar.) The tough part is recognizing how small changes in the grammar can ripple through and cause whole classes of sentences that should be grammatical to be ungrammatical and vice versa. So I'd write the parser and such and let the kids just play with the grammars. Todd From yinso.chen at gmail.com Mon Jun 1 15:11:32 2009 From: yinso.chen at gmail.com (YC) Date: Mon Jun 1 15:19:33 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> <18979.56830.723396.281647@winooski.ccs.neu.edu> Message-ID: <779bf2730906011211x1b622665r5acea2523a8a3045@mail.gmail.com> On Mon, Jun 1, 2009 at 7:04 AM, Shriram Krishnamurthi wrote: > I agree with Eli (who knows more about this topic than we might imagine). > > It is very difficult to make these kinds of NL parsers scale to any > complexity, and moreover, the kinds that do (those used in real > software today) use a very different approach, so it's not like > there's a smooth continuum from here to there. It would actually be > somewhat misleading to show this and suggest that this is how real NL > parsers work, just with more of the same. > Shriram, The AI books that I had read before took the parsing approach, so I am not familiar with the alternative - would you happen to have links or googling phrases for finding the alternatives? Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090601/70d32648/attachment.htm From eli at barzilay.org Mon Jun 1 15:22:23 2009 From: eli at barzilay.org (Eli Barzilay) Date: Mon Jun 1 15:23:04 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: <779bf2730906011211x1b622665r5acea2523a8a3045@mail.gmail.com> References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> <18979.56830.723396.281647@winooski.ccs.neu.edu> <779bf2730906011211x1b622665r5acea2523a8a3045@mail.gmail.com> Message-ID: <18980.10863.548451.600306@winooski.ccs.neu.edu> On Jun 1, YC wrote: > > The AI books that I had read before took the parsing approach, Yes, this was a typical example in generic AI books. Probably dating back to when people thought that this would be relatively easy. (I don't remember where exactly, but there's a story from the early days of CS where parsing natural language was given as a homework assignment.) > so I am not familiar with the alternative - would you happen to have > links or googling phrases for finding the alternatives? Modern NL parsers are all statistical tools. They usually begin with a large corpus of human-parsed text, and learn how to parse more data. And there's significant work in making the learning process effective, and generalize it. The shift to this direction happened roughly during the 90s, and now I don't think that there are any practical tools that are using the symbolic approach. The bottom line is that the statistical shift makes this a very different field from what is presented in common AI books -- one thing you'll see is that there is much more "serious math" involved. As for a google phrase, a simple "natural language parsing" should work. You can also try google scholar if you're really interested (but in that case pay attention to the dates, since post 2000 papers will be very different than pre-1990). [BTW, just to clarify -- I'm not an expert in NLP by any measure, I just happen to live with one so I have extensive second-hand knowledge, whatever that may be worth...] -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From yinso.chen at gmail.com Mon Jun 1 15:30:50 2009 From: yinso.chen at gmail.com (YC) Date: Mon Jun 1 15:31:09 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: <18980.10863.548451.600306@winooski.ccs.neu.edu> References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> <18979.56830.723396.281647@winooski.ccs.neu.edu> <779bf2730906011211x1b622665r5acea2523a8a3045@mail.gmail.com> <18980.10863.548451.600306@winooski.ccs.neu.edu> Message-ID: <779bf2730906011230q353ba40eu6b0b4994eff9894b@mail.gmail.com> On Mon, Jun 1, 2009 at 12:22 PM, Eli Barzilay wrote: > > > so I am not familiar with the alternative - would you happen to have > > links or googling phrases for finding the alternatives? > > Modern NL parsers are all statistical tools. They usually begin with > a large corpus of human-parsed text, and learn how to parse more data. > And there's significant work in making the learning process effective, > and generalize it. The shift to this direction happened roughly > during the 90s, and now I don't think that there are any practical > tools that are using the symbolic approach. The bottom line is that > the statistical shift makes this a very different field from what is > presented in common AI books -- one thing you'll see is that there is > much more "serious math" involved. > > Cool - thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090601/82d49b59/attachment.html From sk at cs.brown.edu Mon Jun 1 15:44:08 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Mon Jun 1 15:44:27 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: <779bf2730906011230q353ba40eu6b0b4994eff9894b@mail.gmail.com> References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> <18979.56830.723396.281647@winooski.ccs.neu.edu> <779bf2730906011211x1b622665r5acea2523a8a3045@mail.gmail.com> <18980.10863.548451.600306@winooski.ccs.neu.edu> <779bf2730906011230q353ba40eu6b0b4994eff9894b@mail.gmail.com> Message-ID: Also look up books with titles like "Statistical Natural Language Processing" -- there are a few pioneering ones and more (possibly better ones) lately as the field has matured. In a way the shift to (Bayesian) statistics is unsurprising (easy to say in retrospect!), since it seems to better reflect the way we process language. On Jun 1, 2009 3:30 PM, "YC" wrote: On Mon, Jun 1, 2009 at 12:22 PM, Eli Barzilay wrote: > > > > so I am not familiar... Cool - thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090601/c25e55a7/attachment.html From rcleis at mac.com Mon Jun 1 18:01:16 2009 From: rcleis at mac.com (Richard Cleis) Date: Mon Jun 1 18:02:01 2009 Subject: [plt-scheme] Re: Why "lambda"? In-Reply-To: <4331ad810906010812y1ed3a6a6r8410684a835ab74a@mail.gmail.com> References: <1243807231.5017.7.camel@Nokia-N800-43-7> <4331ad810906010812y1ed3a6a6r8410684a835ab74a@mail.gmail.com> Message-ID: On Jun 1, 2009, at 9:12 AM, Luciano Ramalho wrote: > On Sun, May 31, 2009 at 7:53 PM, Shriram Krishnamurthi > wrote: >> Aside: Though Postel's Law makes for good copy, it's also the cause >> for at least part of the current mess with HTML, JavaScript, and >> browsers. > > And also the cause of the runaway success of the Web, which after > decades finally allowed the Internet to benefit people who were not in > some academic niche. > > If malformed pages and ill-defined programming languages were > verboten, a lot of wonderful things would just not have been built... > > Cheers, > > Luciano I view my own career that way, but I believe more influence from academia would have benefitted me greatly. After a few decades of writing software, I do not even want to look at much of my wonderful things (they truly are wonderful, in my most humble opinion) much less work on them... or explain to others how to rewrite them (my emerging #1 task) :) Greek symbols do not gain popularity outside of the Tex/Mathematica/ etc world because we cannot comfortably apply them in most computing environments ... or email, for that matter. Even though we all have unicode email, how many times did Greek letters show up in this thread? rac > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From grettke at acm.org Mon Jun 1 18:13:26 2009 From: grettke at acm.org (Grant Rettke) Date: Mon Jun 1 18:13:48 2009 Subject: [plt-scheme] Does anyone have non-standard keybindings for OS X that they would like to share? In-Reply-To: <932b2f1f0906010650t7440e66dj2056a64aed6171ef@mail.gmail.com> References: <756daca50906010514p69b0c3c8yc45d6c9f8eea9cdc@mail.gmail.com> <932b2f1f0906010650t7440e66dj2056a64aed6171ef@mail.gmail.com> Message-ID: <756daca50906011513s37f7deceg2bccda2d84f7d592@mail.gmail.com> On Mon, Jun 1, 2009 at 8:50 AM, Robby Findler wrote: > The main difference between windows and mac os x is the menu shortcut > key is not control. This means that many of the underlying emacs > bindings (which are often control-based) are visible on the mac. I see. So the preferred binding is the Emacs style! I always thought that meta:shift:bracket was easier to type than escape;bracket. From grettke at acm.org Mon Jun 1 18:13:51 2009 From: grettke at acm.org (Grant Rettke) Date: Mon Jun 1 18:14:11 2009 Subject: [plt-scheme] Does anyone have non-standard keybindings for OS X that they would like to share? In-Reply-To: <5E74362B-F36D-4249-B7B4-4F38163A371C@brinckerhoff.org> References: <756daca50906010514p69b0c3c8yc45d6c9f8eea9cdc@mail.gmail.com> <5E74362B-F36D-4249-B7B4-4F38163A371C@brinckerhoff.org> Message-ID: <756daca50906011513r5c531c65o4265421a2232bf28@mail.gmail.com> On Mon, Jun 1, 2009 at 1:22 PM, John Clements wrote: > Here's what I use: ?it maps plain old paren to insert-()-pair; no escape or > meta required. It does the same for curly braces and quotes. ?It turns out > that this doesn't work for square brackets--this may be because of smart > parens, and the solution might be as simple as disabling smart parens. Good idea. Thanks. That is the most common use case! From plragde at uwaterloo.ca Mon Jun 1 18:48:15 2009 From: plragde at uwaterloo.ca (Prabhakar Ragde) Date: Mon Jun 1 18:48:42 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: <904774730906011142q3e370d5fme220026c07674012@mail.gmail.com> Message-ID: <4A245AAF.4020308@uwaterloo.ca> Todd wrote: > So I'd write the parser and such and let the kids just play with the grammars. You're then going to have to implement a general CFG parser (with decent error messages for malformed input). You can parse the CFGs they write with parser-tools, but you can't expect them to write grammars that can be handled by parser-tools. So you need to implement an Earley parser, or a functional version of it (because you can't expect them to avoid left recursion, either). You also have to think about what happens if there are a huge number of parse trees generated for a highly ambiguous grammar. You might be better off doing something more traditionally considered declarative programming -- maybe working with Jay's Datalog package. --PR From ccshan at post.harvard.edu Mon Jun 1 19:16:21 2009 From: ccshan at post.harvard.edu (Chung-chieh Shan) Date: Mon Jun 1 19:18:22 2009 Subject: [plt-scheme] Re: Natural Language parsing in CS1 References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> <18979.56830.723396.281647@winooski.ccs.neu.edu> Message-ID: <534ef6-ck2.ln1@mantle.rutgers.edu> Eli Barzilay wrote in article <18979.56830.723396.281647@winooski.ccs.neu.edu> in gmane.lisp.scheme.plt: > Just a quick warning on this: the world of natural language processing > has moved away from this kind of symbolic approach to parsing texts, I'm not sure what you mean by "this kind of symbolic approach". The Penn Treebank, for example, is full of symbols like NP and VP and their hierarchical composition. After all, weight finite-state automata are based on finite-state automata, and probabilistic context-free grammars are based on context-free grammars. -- Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig We want our revolution, and we want it now! -- Marat/Sade We want our revolution, and we'll take it at such time as you've gotten around to delivering it -- Haskell programmer From eli at barzilay.org Mon Jun 1 20:03:41 2009 From: eli at barzilay.org (Eli Barzilay) Date: Mon Jun 1 20:04:09 2009 Subject: [plt-scheme] Re: Natural Language parsing in CS1 In-Reply-To: <534ef6-ck2.ln1@mantle.rutgers.edu> References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> <18979.56830.723396.281647@winooski.ccs.neu.edu> <534ef6-ck2.ln1@mantle.rutgers.edu> Message-ID: <18980.27741.474577.615232@winooski.ccs.neu.edu> On Jun 1, Chung-chieh Shan wrote: > Eli Barzilay wrote in article <18979.56830.723396.281647@winooski.ccs.neu.edu> in gmane.lisp.scheme.plt: > > Just a quick warning on this: the world of natural language > > processing has moved away from this kind of symbolic approach to > > parsing texts, > > I'm not sure what you mean by "this kind of symbolic approach". The > Penn Treebank, for example, is full of symbols like NP and VP and > their hierarchical composition. I'm talking about the kind of actual parsing that is based on (deterministic, usually) rules -- the kind that works nicely for parsing formal languages. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From gfb at cs.toronto.edu Mon Jun 1 21:22:32 2009 From: gfb at cs.toronto.edu (Gary Baumgartner) Date: Mon Jun 1 21:22:52 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: <904774730906011142q3e370d5fme220026c07674012@mail.gmail.com> References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> <18979.56830.723396.281647@winooski.ccs.neu.edu> <904774730906011142q3e370d5fme220026c07674012@mail.gmail.com> Message-ID: <20090602012232.GA1474@cs.toronto.edu> On Mon, Jun 01, 2009 at 02:42:58PM -0400, Todd O'Bryan wrote: > I'm sorry I wasn't as clear as I should have been... [...] > So I'd write the parser and such and let the kids just play with the grammars. [...] Earlier you wondered about how to write it in PLT Scheme. Does this get you off the ground: #lang scheme #| Example parser using cfg defined below, for a grammar at the start of CSC324 (one of our courses). The resulting p takes a string s, parses all prefixes of s, returning the suffix of each prefix that's in the language, repeated the number of times it parses (only once for this p, since unambiguous). E.g. (p "011") => ("1" "011"), so no complete parse of s, (p "1011") => ("" "11" "1011"), so s is in the language, |# (define p (cfg ( ( ) ('e)) ( ("0") ("1")))) #| A syntax for cfgs, producing a recursive descent parser by expanding into definitions of recursive functions for the productions (and keeping the macro simple by delegating most of the work except notation translation to match-concatenation). |# (require (planet "amb.ss" ("murphy" "amb.plt" 1 1))) ; (define-syntax-rule (cfg <> (<> ( ...) ...) ...) (letrec ([<> (lambda (string) (amb (match-concatenation string ...) ...))] ...) (lambda (string) (amb-collect (<> string))))) ; (require (only-in srfi/13 string-null? string-prefix? string-drop)) ; (define (match-concatenation string . components) (define (match-component component string) (cond [(equal? component 'e) string] [(string? component) (amb-assert (string-prefix? component string)) (string-drop string (string-length component))] [else (component string)])) (foldl match-component string components)) From adityashukla1983 at gmail.com Tue Jun 2 01:54:57 2009 From: adityashukla1983 at gmail.com (aditya shukla) Date: Tue Jun 2 01:55:18 2009 Subject: [plt-scheme] Htdp chapter 12 insertion sort Message-ID: <73045cca0906012254y974c13fxc99daee1ccf5abec@mail.gmail.com> I have a question about the insertion sort algorithm implemented in chapter 12.The figure 33 explains ;; sort : list-of-numbers -> list-of-numbers (sorted) ;; to create a list of numbers with the same numbers as ;; alon sorted in descending order (define (sort alon) (cond [(empty? alon) empty] [(cons? alon) (insert (first alon) (sort (rest alon)))]))- what is cons? alon here , is it required there? Thanks Aditya -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090602/2e8ef0a2/attachment.html From DekuDekuplex at Yahoo.com Tue Jun 2 04:25:47 2009 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Tue Jun 2 04:26:31 2009 Subject: [plt-scheme] bugs in DivaScheme 1.3 Message-ID: I've been trying to use DivaScheme 1.3 (see http://www.cs.brown.edu/research/plt/software/divascheme/) on Windows XP Professional, Service Pack 3, to enter the factorial function in DrScheme 4.2, but so far, I have encountered the following (rather frustrating) bugs: 1. Every time that I switch tabs in Windows from DrScheme to Firefox and back using ALT + TAB, DivaScheme mysteriously switches from insertion mode to command mode. 2. When editing a s-expression, if I make a mistake and backtrack, often a command prompt window suddenly appears and won't go away. For example, I tried typing the following in DivaScheme: >(define (factorial Then I wanted to do something else, so I backspaced back to the opening parenthesis immediately before the "factorial" identifier, and when I tried typing another opening parenthesis (by hitting the open-bracket key), suddenly a command prompt window entitled "DrScheme" and a Windows dialog box entitled "DrScheme Internal Error" appeared. The command prompt window contained the following text: >(file "C:\\Documents and Settings\\Benjamin\\Application Data\\PLT Scheme\\planet\\300\\4.2\\cache\\divascheme\\divascheme.plt\\1\\6\\insert-keymap.ss") broke the contract > (-> > (is-a?/c class:text%) > natural-number/c > natural-number/c > rope?) > on read-subrope-in-text; expected , given: -2 > > === context === >C:\bin\PLT-4.2\collects\scheme\private\contract-guts.ss:220:0: raise-contract-error >read-subrope-in-text >C:\Documents and Settings\Benjamin\Application Data\PLT Scheme\planet\300\4.2\cache\divascheme\divascheme.plt\1\6\insert-keymap.ss:322:4: eval-text >C:\Documents and Settings\Benjamin\Application Data\PLT Scheme\planet\300\4.2\cache\divascheme\divascheme.plt\1\6\insert-keymap.ss:350:4: eval-text&cmd >C:\bin\PLT-4.2\collects\scheme\private\map.ss:44:11: for-each >C:\bin\PLT-4.2\collects\scheme\private\map.ss:44:11: for-each >C:\bin\PLT-4.2\collects\mred\private\wxme\keymap.ss:485:2: chain-handle-key-event method in keymap%for-loop >C:\bin\PLT-4.2\collects\mred\private\wxme\keymap.ss:485:2: chain-handle-key-event method in keymap% >C:\bin\PLT-4.2\collects\mred\private\wxme\keymap.ss:441:2: handle-key-event method in keymap% >C:\bin\PLT-4.2\collects\mred\private\wxme\editor.ss:211:2: on-local-char method >in editor% >C:\bin\PLT-4.2\collects\mred\private\wxme\editor-canvas.ss:431:2: on-char method > in editor-canvas% >C:\bin\PLT-4.2\collects\scheme\private\more-scheme.ss:155:2: call-with-break-parameterization >C:\bin\PLT-4.2\collects\scheme\private\more-scheme.ss:271:2: call-with-exception-handler > > The Windows dialog box contained identical text. When I then clicked on the "OK" button below the Windows dialog box, that Windows dialog box disappeared. However, the command prompt window remained, so I then entered "Ctrl-c" in that window. Then, a new Windows dialog box, entitled "DrS..." (it was very short and had a very short title) appeared, with the contents "user break" appearing on the dialog box. When I clicked on the "OK" button for this new dialog box, that window diappeared, and the following message became appended to the previous contents of the command prompt window: >user break > >[Exited. Close box or Ctrl-C closes the console.] When I then entered "Ctrl-c" in that window, that window disappeared, and DrScheme also completely disappeared along with it. I cannot work effectively if DrScheme suddenly crashes when the command prompt window that appears when this type of error occurs is closed. DivaScheme seems to be an interesting editor, but it is hard to work effectively unless this bug is fixed. -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ From davidjamesbrooks at gmail.com Tue Jun 2 04:36:25 2009 From: davidjamesbrooks at gmail.com (David Brooks) Date: Tue Jun 2 04:36:53 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: <18980.10863.548451.600306@winooski.ccs.neu.edu> References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> <18979.56830.723396.281647@winooski.ccs.neu.edu> <779bf2730906011211x1b622665r5acea2523a8a3045@mail.gmail.com> <18980.10863.548451.600306@winooski.ccs.neu.edu> Message-ID: On 1 Jun 2009, at 20:22, Eli Barzilay wrote: > On Jun 1, YC wrote: >> >> The AI books that I had read before took the parsing approach, > Yes, this was a typical example in generic AI books. ... and still is in textbooks of computational linguistics. See, for example, Christopher Manning and Hinrich Sch?tze's "Foundations of Statistical Natural Language Processing". Chapter 3 of the above book deals with symbolic parsing of the nature described by Todd. I think Todd's exercise is a decent introduction to parsing, and an understanding of this is vital to see why strict symbolic grammar-and- parser approaches do not scale. I've used similar exercises in the past, and I believe them to be helpful. There's no harm in showing a broken system, because students can discover for themselves where it breaks down. >> so I am not familiar with the alternative - would you happen to have >> links or googling phrases for finding the alternatives? > > Modern NL parsers are all statistical tools. They usually begin with > a large corpus of human-parsed text, and learn how to parse more data. Some still have foundations in context-free grammars, while others have favoured different grammatical formalisms (dependency grammars have become popular in the last few years; categorial grammars are also widespread). Simpler models (in grammar terms) have also been employed with some success. Search terms "shallow parsing" or "text chunking" may get you somewhere. However, Shriram's earlier point about CFGs not scaling well, while correct, is not the major limiting factor here. It has long been known that CFGs are not capable of expressing some of the features of natural language (for English, sentences involving "respectively"), and that some degree of context is required. Again, this doesn't mean Todd's exercise is futile, since it can be used to show /why/ CFGs are inadequate. > As for a google phrase, a simple "natural language parsing" should > work. You can also try google scholar if you're really interested > (but in that case pay attention to the dates, since post 2000 papers > will be very different than pre-1990). The phrase "reranking parser" will also get you somewhere useful. I saw Michael Collins give a very interesting talk on the subject, so his name might be a useful term. A more general overview can be found in chapter 12 of the aforementioned book. There was a bit of an explosion in research in the field as Eli said, so an overview may be a better starting point than the huge numbers of papers published at ACL each year... > [BTW, just to clarify -- I'm not an expert in NLP by any measure, I > just happen to live with one so I have extensive second-hand > knowledge, whatever that may be worth...] You've accurately summarised most of what I knew. I wish I had that kind of second-hand knowledge... Cheers, D -- David Brooks http://www.untyped.com From ccshan at rutgers.edu Tue Jun 2 05:07:16 2009 From: ccshan at rutgers.edu (Chung-chieh Shan) Date: Tue Jun 2 05:07:51 2009 Subject: [plt-scheme] Re: Natural Language parsing in CS1 In-Reply-To: <18980.27741.474577.615232@winooski.ccs.neu.edu> References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> <18979.56830.723396.281647@winooski.ccs.neu.edu> <534ef6-ck2.ln1@mantle.rutgers.edu> <18980.27741.474577.615232@winooski.ccs.neu.edu> Message-ID: <20090602090716.GA20342@mantle.rutgers.edu> On 2009-06-01T20:03:41-0400, Eli Barzilay wrote: > On Jun 1, Chung-chieh Shan wrote: > > I'm not sure what you mean by "this kind of symbolic approach". The > > Penn Treebank, for example, is full of symbols like NP and VP and > > their hierarchical composition. > > I'm talking about the kind of actual parsing that is based on > (deterministic, usually) rules -- the kind that works nicely for > parsing formal languages. I see. I would definitely second the advice (to the original message on this thread) that the parser take into account the nondeterminism (i.e., ambiguity) of natural language. For example, the parser should allow and produce multiple parses for the same string. A parsing algorithm that does not require finite look-ahead, as simple as Earley or even CYK, would do nicely. But nondeterminism is the bedrock of both modern NLP and classical formal-language parsing. The role of nondeterminism in formal languages has been established since Rabin and Scott's Turing-award work (1959) and canonized in most introductory undergraduate courses on formal languages and theory of computation. Weighting is a useful kind of nondeterminism; a production in a probabilistic context-free grammar is a useful kind of a rule; and learning a grammar from data using Bayesian statistics is a useful way to generate code -- some would say to compile. Also, the familiar slogan "programs as data" is a useful way to understand hierarchical Bayesian models and some recent work on "adaptor grammars" coming from Brown. Thus, "the kind of actual parsing that is based on rules -- the kind that works nicely for parsing formal languages" -- is not at all limited to deterministic rules. As Shriram wants (and so do I), it is linked by a "smooth continuum" to practical NLP. It is not only compatible with symbolic processing but in fact presupposes symbolic processing. -- Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig We want our revolution, and we want it now! -- Marat/Sade We want our revolution, and we'll take it at such time as you've gotten around to delivering it -- Haskell programmer -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090602/a5a7118b/attachment.pgp From eli at barzilay.org Tue Jun 2 05:32:52 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Jun 2 05:33:13 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> <18979.56830.723396.281647@winooski.ccs.neu.edu> <534ef6-ck2.ln1@mantle.rutgers.edu> <18980.27741.474577.615232@winooski.ccs.neu.edu> <20090602090716.GA20342@mantle.rutgers.edu> <779bf2730906011211x1b622665r5acea2523a8a3045@mail.gmail.com> <18980.10863.548451.600306@winooski.ccs.neu.edu> Message-ID: <18980.61892.67525.128307@winooski.ccs.neu.edu> On Jun 2, David Brooks wrote: > > I think Todd's exercise is a decent introduction to parsing, and an > understanding of this is vital to see why strict symbolic > grammar-and- parser approaches do not scale. I've used similar > exercises in the past, and I believe them to be helpful. There's no > harm in showing a broken system, because students can discover for > themselves where it breaks down. Certainly presenting such an exercise as a way to make you understand where this approach fails is valid. But IMO that pretty requires committing more time to the specific subject (of parsing NL in this case). In an NLP course students can get the point of such an exercise -- but take a student in a PL course that is toying around with that as a side-exercise, and you're likely to see students who believe that this is actually a practical approach, and/or something that is actually in use. But (symbolic) parsing in itself is still extremely useful -- just not to the kind of vagueness that NLs make, so an exercise will of course be useful, you just need to be careful about the conclusions... (BTW, the book that you mention is kind of on the border of the paradigm shift (chronologically, it's past that, but books & textbooks usually lag) -- what I do know is that there's a problem with finding good textbooks on the subject.) > The phrase "reranking parser" will also get you somewhere useful. I > saw Michael Collins give a very interesting talk on the subject, so > his name might be a useful term. Yes, Collins is very related to this shift -- his statistical parser was a big success. Working with it is an easy way to "get" why this is so far from the symbolic corner of CS that we're usually buzzing around here -- it starts by loading a huge piece of data (IIRC, it was somewhere around 200-300MB) that contains the training results. (In fact, one thing I did with it was wrap it in some server code (using PLT, of course) so that you don't pay the huge startup time for each sentence.) When dealing with such a parser, the difference from the symbolic approach becomes painfully obvious: when there's a parsing mistake, you don't have a specific rule in your code that you need to debug -- an in fact, the whole debug-rerun cycle is very different since you measure the relative correctness of your code by running lots of experiments (in this case, parse many sentences) and inspecting the overall results. IOW, if you're writing a parser for a programming language that fails on one program out of a thousand, then you have a buggy parser -- but a parser for a natural language that fails on one sentence out of a thousand would be a huge success. > > [BTW, just to clarify -- I'm not an expert in NLP by any measure, > > I just happen to live with one so I have extensive second-hand > > knowledge, whatever that may be worth...] > > You've accurately summarised most of what I knew. I wish I had that > kind of second-hand knowledge... Heh... I still need to stress that I'm not at all an expert... My usual joke is that both me and my wife are doing CS, and we're both doing languages -- only I'm doing formal ones, and she's doing natural ones. Many people would conclude that we're doing very close things, but in practice it would be difficult to find two areas of CS that are more different. On Jun 2, Chung-chieh Shan wrote: > [...] > Thus, "the kind of actual parsing that is based on rules -- the kind > that works nicely for parsing formal languages" -- is not at all > limited to deterministic rules. As Shriram wants (and so do I), it > is linked by a "smooth continuum" to practical NLP. It is not only > compatible with symbolic processing but in fact presupposes symbolic > processing. Well, you can obviously speak about non-determinism formally... That's the kind of stuff that you need to do when you analyze something like a statistical parser. But the nature of working on a "symbolic program" (hand waving here) and on a "statistical program" (more waving) is very different. It's essentially related to what I wrote above: in the former you get precise rules for what your code is supposed to do, and your program is "usually" either correct or not (and there are exceptions to this, of course). In the latter, you measure success based on a statistical comparison with imprecise machines (aka humans) -- so the measure itself is statistical (and again, there are exceptions here too). To clarify, what I'm saying is that it's not only the code itself that uses statistics, it's also the analysis of whether it's correct or not which is measured in percentages. In yet other words -- if I'll add a function to PLT, and I'll document it as correct for 76% of all inputs, then it will look as ridiculous as someone writing a natural language parser that *is* correct period. But we're getting dangerously close to subjective opinions here, so I'll try to avoid taking this further... -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From DekuDekuplex at Yahoo.com Tue Jun 2 06:50:49 2009 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Tue Jun 2 06:51:24 2009 Subject: [plt-scheme] How about also creating a PLT Scheme Box? Message-ID: Along the lines of Lispbox (see http://www.gigamonkeys.com/book/lispbox/) and Clojure Box (see http://clojure.bighugh.com/), wouldn't it be useful, as an alternative for Emacs-users, to have a SLIME-based (see http://common-lisp.net/project/slime/) PLT Scheme Box? DrScheme is a great debugging environment, but there are certain advantages for quite a few users to being able to edit code also in Emacs, yet there does not seem to be a Scheme-equivalent to Lispbox (at least not yet). -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ From neil at neilvandyke.org Tue Jun 2 07:09:55 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Tue Jun 2 07:11:22 2009 Subject: [plt-scheme] How about also creating a PLT Scheme Box? In-Reply-To: References: Message-ID: <4A250883.1000806@neilvandyke.org> Benjamin L.Russell wrote at 06/02/2009 06:50 AM: > Along the lines of Lispbox [...] and Clojure Box (see > http://clojure.bighugh.com/), wouldn't it be useful, as an alternative > for Emacs-users, to have a SLIME-based [...] PLT Scheme Box? DrScheme pretty much fills the bill of "Scheme in a box," and does things that SLIME cannot do. One download, click the DrScheme icon, and, whoa, dude, you're hacking Scheme. DrScheme is not Emacs, and that is too bad in some ways. Eventually, someone will build really first-rate Emacs support for PLT Scheme. (I will, if someone hands me funding.) For now, I think that DrScheme is the obviously superior interface for people wanting a "Scheme in a box." More savvy, Emacs-oriented people can always install PLT, Emacs, and Quack themselves, with little trouble. -- http://www.neilvandyke.org/ From keiko at kurims.kyoto-u.ac.jp Tue Jun 2 07:39:32 2009 From: keiko at kurims.kyoto-u.ac.jp (Keiko Nakata) Date: Tue Jun 2 07:39:53 2009 Subject: [plt-scheme] semantics of letrec in Lazy Scheme Message-ID: <20090602.203932.68535186.keiko@kurims.kyoto-u.ac.jp> Hello, In the following Lazy Scheme code, u is bound to #, whereas u1 and u2 are to promises producing 5. Why is u exceptional? #lang lazy (define u (letrec ([x y] [y 5]) x)) (define u1 (letrec ([x (print y)] [y 5]) x)) (define u2 (letrec ([x (begin (print y) y)] [y 5]) x)) Best, Keiko From morazanm at gmail.com Tue Jun 2 07:47:21 2009 From: morazanm at gmail.com (Marco Morazan) Date: Tue Jun 2 07:47:40 2009 Subject: [plt-scheme] Htdp chapter 12 insertion sort In-Reply-To: <73045cca0906012254y974c13fxc99daee1ccf5abec@mail.gmail.com> References: <73045cca0906012254y974c13fxc99daee1ccf5abec@mail.gmail.com> Message-ID: <9b1fff280906020447n6fc9fa43o89432cbe126fe7@mail.gmail.com> > ;; sort : list-of-numbers ?->? list-of-numbers (sorted) > > ;; to create a list of numbers with the same numbers as > ;; alon sorted in descending order > (define (sort alon) > > (cond > [(empty? alon) empty] > [(cons? alon) (insert (first alon) (sort (rest alon)))]))- what is cons? > alon here , is it required there? What exactly is bothering you? cons? is a primitive used to determine if its input is a constructed list. Given that the contract guarantees a (listof number) as input, you can substitute (cons? alon) with else in the above function. In other words, given the above contract there is not need to check if alon is a constructed list after knowing it is not an empty list. -- Cheers, Marco From wcy123 at gmail.com Mon Jun 1 23:20:12 2009 From: wcy123 at gmail.com (charles wang) Date: Tue Jun 2 08:59:04 2009 Subject: [plt-scheme] Re: web server error In-Reply-To: References: <595b9ab20904160755t3ae707ecg35364656005a6555@mail.gmail.com> Message-ID: I was running into the same problem. DrScheme 4.1.5 on WinXP. when I try the blog example, sometime the error pop up Connection error: tcp-accept: accept from listener failed (????????????????????????????; errno=10038) it doesn't happen very often. On Apr 16, 11:05 pm, Jay McCarthy wrote: > What platform are you on? > > The Web Server defers all TCP management to run-server [1] so if you > want to debug further, you can try that directly. > > 1.http://docs.plt-scheme.org/mzlib/mzlib_thread.html#(def._((lib._mzlib...)) > > On Thu, Apr 16, 2009 at 8:55 AM, Stephen De Gabrielle > > > > wrote: > > Hi, > > > I'm using web-server/servlet-env and I occasionally get the following error; > > > Connection error: tcp-accept: accept from listener failed (An > > operation was attempted on something that is not a socket.; > > errno=10038) > > > It normally happens at the begining of my session, but restarting a > > few times seems to fix it. > > > Any idea what might be causing it? > > > Cheers, > > > Stephen > > > -- > > Stephen De Gabrielle > > s.degabrie...@cs.ucl.ac.uk > > Telephone +44 (0)20 7679 0693 (x30693) > > Mobile 079 851 890 45 > > Project: Making Sense of Information (MaSI) > > Work:http://www.uclic.ucl.ac.uk/annb/MaSI.html > > Home:http://www.degabrielle.name/stephen > > > UCL Interaction Centre > > MPEB 8th floor > > University College London > > Gower Street > > London WC1E 6BT > > _________________________________________________ > > For list-related administrative tasks: > > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -- > Jay McCarthy > Assistant Professor / Brigham Young Universityhttp://teammccarthy.org/jay > > "The glory of God is Intelligence" - D&C 93 > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From djb at untyped.com Tue Jun 2 09:01:24 2009 From: djb at untyped.com (David Brooks) Date: Tue Jun 2 09:01:45 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> <18979.56830.723396.281647@winooski.ccs.neu.edu> <779bf2730906011211x1b622665r5acea2523a8a3045@mail.gmail.com> <18980.10863.548451.600306@winooski.ccs.neu.edu> Message-ID: On 2 Jun 2009, at 13:51, Shriram Krishnamurthi wrote: >> I think Todd's exercise is a decent introduction to parsing, and an >> understanding of this is vital to see why strict symbolic >> grammar-and-parser approaches do not scale. > > ...if that is the point to the exercise. Otherwise you will have > another generation of students thinking this is how NL is parsed, and > will be in no position whatsoever to appreciate how something like > Babelfish works. (YC's message, where he effectively says he has read > multiple AI books that mentioned NLP and yet they all left him > unprepared to understand Eli's message, is telling.) Granted. I clearly missed something stating that this was for an intro to programming course, and wouldn't advocate teaching the "NL as formal language" approach as anything other than a precursor to a more detailed study of parsing. Cheers, D From eli at barzilay.org Tue Jun 2 09:04:22 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Jun 2 09:05:01 2009 Subject: [plt-scheme] semantics of letrec in Lazy Scheme In-Reply-To: <20090602.203932.68535186.keiko@kurims.kyoto-u.ac.jp> References: <20090602.203932.68535186.keiko@kurims.kyoto-u.ac.jp> Message-ID: <18981.9046.425542.134918@winooski.ccs.neu.edu> On Jun 2, Keiko Nakata wrote: > Hello, > > In the following Lazy Scheme code, u is bound to #, > whereas u1 and u2 are to promises producing 5. > Why is u exceptional? > > #lang lazy > > (define u (letrec ([x y] [y 5]) x)) > [...] That looks like a bug. It's a result of an optimization -- expressions are all delayed except when the expression is a literal value or an identifier -- so the first `y' in the above is not in a promise. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From jos.koot at telefonica.net Tue Jun 2 09:05:52 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Tue Jun 2 09:06:17 2009 Subject: [plt-scheme] semantics of letrec in Lazy Scheme References: <20090602.203932.68535186.keiko@kurims.kyoto-u.ac.jp> Message-ID: <5EA33A8ED0494591B1BC5E278A584199@uw2b2dff239c4d> Eli Barzilay is the best man for your question, but looking into lazy, I see that in u the reference to y is not delayed. In u1 the expression for x is an application and is therefore treated lazily. What you see is not the value 5, but the printed datum 5. The value of u1 is void. In u2 the expression for x is a begin form, which is treated lazily too. For u2 both the printed datum and the value are 5. Now see: #lang lazy (define u3 (letrec ((x (~ y)) (y 5)) a)) In interactions window (! u3) --> 5 I think that in u the reference to y should be delayed implicitly, but may be there are reasons not to do so. Jos ----- Original Message ----- From: "Keiko Nakata" To: Sent: Tuesday, June 02, 2009 1:39 PM Subject: [plt-scheme] semantics of letrec in Lazy Scheme > Hello, > > In the following Lazy Scheme code, u is bound to #, > whereas u1 and u2 are to promises producing 5. > Why is u exceptional? > > #lang lazy > > (define u (letrec ([x y] [y 5]) x)) > (define u1 (letrec ([x (print y)] [y 5]) x)) > (define u2 (letrec ([x (begin (print y) y)] [y 5]) x)) > > > Best, > Keiko > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From tom at zwizwa.be Tue Jun 2 09:08:53 2009 From: tom at zwizwa.be (Tom Schouten) Date: Tue Jun 2 09:09:12 2009 Subject: [plt-scheme] LLVM Message-ID: <20090602130853.GA15991@giebrok.zwizwa.be> Hello, I was wondering if there is anyone working on a bridge between LLVM and (PLT) Scheme. More specifically I'm thinking about run-time code generation (i.e. an embedded real-time DSL) and FFI to to the generated code. Also, what happened to the idea of using LLVM for the PLT JIT? Cheers, Tom From dtnoizerz58 at yandex.ru Tue Jun 2 09:12:32 2009 From: dtnoizerz58 at yandex.ru (DTNOIZR) Date: Tue Jun 2 09:12:56 2009 Subject: [plt-scheme] web server error In-Reply-To: <20090602125902.378E6402E6@qua.cs.brown.edu> References: <20090602125902.378E6402E6@qua.cs.brown.edu> Message-ID: <564081243948352@webmail17.yandex.ru> there was speech about it http://list.cs.brown.edu/pipermail/plt-scheme/2009-March/031584.html I have installed DrScheme 4.1.4 (on WinXP), and there are no this error > From: charles wang > Subject: [plt-scheme] Re: web server error > To: plt-scheme@list.cs.brown.edu > Message-ID: > > Content-Type: text/plain; charset=UTF-8 > I was running into the same problem. DrScheme 4.1.5 on WinXP. > when I try the blog example, sometime the error pop up > Connection error: tcp-accept: accept from listener failed > (????????????????????????????; errno=10038) > it doesn't happen very often. From pocmatos at gmail.com Tue Jun 2 09:15:38 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Jun 2 09:16:29 2009 Subject: [plt-scheme] How about also creating a PLT Scheme Box? In-Reply-To: References: Message-ID: <11b141710906020615j471314dmd8ba7f5c24f02604@mail.gmail.com> On Tue, Jun 2, 2009 at 11:50 AM, Benjamin L.Russell wrote: > Along the lines of Lispbox (see > http://www.gigamonkeys.com/book/lispbox/) and Clojure Box (see > http://clojure.bighugh.com/), wouldn't it be useful, as an alternative > for Emacs-users, to have a SLIME-based > (see http://common-lisp.net/project/slime/) PLT Scheme Box? ?DrScheme > is a great debugging environment, but there are certain advantages for > quite a few users to being able to edit code also in Emacs, yet there > does not seem to be a Scheme-equivalent to Lispbox (at least not yet). > I would also love something for Emacs, until the perfect mode arrives we have Quack and the most recent Geiser. > -- Benjamin L. Russell > -- > Benjamin L. Russell ?/ ? DekuDekuplex at Yahoo dot com > http://dekudekuplex.wordpress.com/ > Translator/Interpreter / Mobile: ?+011 81 80-3603-6725 > "Furuike ya, kawazu tobikomu mizu no oto." > -- Matsuo Basho^ > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From eli at barzilay.org Tue Jun 2 09:19:26 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Jun 2 09:19:49 2009 Subject: [plt-scheme] LLVM In-Reply-To: <20090602130853.GA15991@giebrok.zwizwa.be> References: <20090602130853.GA15991@giebrok.zwizwa.be> Message-ID: <18981.9950.851022.517644@winooski.ccs.neu.edu> On Jun 2, Tom Schouten wrote: > I was wondering if there is anyone working on a bridge between > LLVM and (PLT) Scheme. > > More specifically I'm thinking about run-time code generation > (i.e. an embedded real-time DSL) and FFI to to the generated code. > > Also, what happened to the idea of using LLVM for the PLT JIT? There were several problems with the project -- one was that LLVM is huge, and adding it to PLT is roughly on the same scale as adding GCC. After we've played with it for a while, Matthew did the mzscheme jitter using lightning -- which is much more light weight, but also (not surprisingly) leaves mzscheme with the burden of doing more optimizations itself. Having that done, there was little point in continguing the fight with LLVM, which had a few other issues at the time. (My guess is that using LLVM would make things faster, given the huge effort that went into making it an optimizing compiler.) Implementing an LLVM interface, however, should be very easy -- after spending some time looking at the various options, our conclusion was that it's really just easier to invoke LLVM on whole files (in the LLVM language), and using the LLVM jit to create an executable piece of code. The first instinct was to use the LLVM commands directly, but that doesn't really have any advantage over using whole files. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From keiko at kurims.kyoto-u.ac.jp Tue Jun 2 09:21:28 2009 From: keiko at kurims.kyoto-u.ac.jp (Keiko Nakata) Date: Tue Jun 2 09:21:50 2009 Subject: [plt-scheme] semantics of letrec in Lazy Scheme In-Reply-To: <18981.9046.425542.134918@winooski.ccs.neu.edu> References: <20090602.203932.68535186.keiko@kurims.kyoto-u.ac.jp> <18981.9046.425542.134918@winooski.ccs.neu.edu> Message-ID: <20090602.222128.125106297.keiko@kurims.kyoto-u.ac.jp> From: Eli Barzilay > On Jun 2, Keiko Nakata wrote: > > In the following Lazy Scheme code, u is bound to #, > > whereas u1 and u2 are to promises producing 5. > > Why is u exceptional? > > > > #lang lazy > > > > (define u (letrec ([x y] [y 5]) x)) > > [...] > > That looks like a bug. It's a result of an optimization -- It makes sense for me :) I am also looking at another behavior which I do not understand: > (define-values (v0 v1) (letrec ([x (begin (set! y 4) (print 0) 0)] [y (begin (print 1) 1)]) (values x y))) > (force v0) 00 > (force v1) 11 But I could think this is also a side-effect of the same optimization. Best, Keiko From eli at barzilay.org Tue Jun 2 09:32:11 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Jun 2 09:32:49 2009 Subject: [plt-scheme] semantics of letrec in Lazy Scheme In-Reply-To: <20090602.222128.125106297.keiko@kurims.kyoto-u.ac.jp> References: <20090602.203932.68535186.keiko@kurims.kyoto-u.ac.jp> <18981.9046.425542.134918@winooski.ccs.neu.edu> <20090602.222128.125106297.keiko@kurims.kyoto-u.ac.jp> Message-ID: <18981.10715.576439.994277@winooski.ccs.neu.edu> On Jun 2, Keiko Nakata wrote: > > I am also looking at another behavior which I do not understand: > > > (define-values (v0 v1) > > (letrec ([x (begin (set! y 4) (print 0) 0)] > > [y (begin (print 1) 1)]) > > (values x y))) > > (force v0) > 00 > > (force v1) > 11 > > But I could think this is also a side-effect of the same optimization. Yeah -- you can see the expected result if you change the last line to something like: (define-values (v0 v1) (letrec ([x (begin (set! y 4) (print 0) 0)] [y (begin (print 1) 1)]) (values x (begin 0 y)))) (FWIW, the lazy language needs some major overhaul which I didn't get to yet. It might be possible to make it much faster without requiring such an optimization.) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From sk at cs.brown.edu Tue Jun 2 08:51:19 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Tue Jun 2 09:56:51 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> <18979.56830.723396.281647@winooski.ccs.neu.edu> <779bf2730906011211x1b622665r5acea2523a8a3045@mail.gmail.com> <18980.10863.548451.600306@winooski.ccs.neu.edu> Message-ID: > I think Todd's exercise is a decent introduction to parsing, and an > understanding of this is vital to see why strict symbolic > grammar-and-parser approaches do not scale. ...if that is the point to the exercise. Otherwise you will have another generation of students thinking this is how NL is parsed, and will be in no position whatsoever to appreciate how something like Babelfish works. (YC's message, where he effectively says he has read multiple AI books that mentioned NLP and yet they all left him unprepared to understand Eli's message, is telling.) Moreover, it's actually possible for an intro course student to understand (a glimpse of) what's going on below the real thing. If that were impossible, that would be different. But just as the kind of parser Todd mentions was a glimpse of what happened in NLP systems 20 years ago, a very different system offers a perfectly reasonable glimpse of what happens in NLP systems today. And I think that's why you're getting a strong reaction from Eli and me. As for Eli's comment that the two kinds of languages (NL and PL) are processed completely differently, well, maybe that will change with time. Once you get past parsing and compilation to intent and errors, what people say in a PL resembles what they say in an NL.... Shriram From ccshan at rutgers.edu Tue Jun 2 10:29:41 2009 From: ccshan at rutgers.edu (Chung-chieh Shan) Date: Tue Jun 2 10:30:27 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: <18980.61892.67525.128307@winooski.ccs.neu.edu> References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> <18979.56830.723396.281647@winooski.ccs.neu.edu> <534ef6-ck2.ln1@mantle.rutgers.edu> <18980.27741.474577.615232@winooski.ccs.neu.edu> <20090602090716.GA20342@mantle.rutgers.edu> <779bf2730906011211x1b622665r5acea2523a8a3045@mail.gmail.com> <18980.10863.548451.600306@winooski.ccs.neu.edu> <18980.61892.67525.128307@winooski.ccs.neu.edu> Message-ID: <20090602142941.GC23694@mantle.rutgers.edu> On 2009-06-02T05:32:52-0400, Eli Barzilay wrote: > But the nature of working on a > "symbolic program" (hand waving here) and on a "statistical program" > (more waving) is very different. It's essentially related to what I > wrote above: in the former you get precise rules for what your code is > supposed to do, and your program is "usually" either correct or not > (and there are exceptions to this, of course). In the latter, you > measure success based on a statistical comparison with imprecise > machines (aka humans) -- so the measure itself is statistical (and > again, there are exceptions here too). To clarify, what I'm saying is > that it's not only the code itself that uses statistics, it's also the > analysis of whether it's correct or not which is measured in > percentages. In yet other words -- if I'll add a function to PLT, and > I'll document it as correct for 76% of all inputs, then it will look > as ridiculous as someone writing a natural language parser that *is* > correct period. You seem to be drawing a distinction between two kinds of programs by examining how they are specified and tested. I certainly agree with you that NLP has moved away from the "symbolic approach" to specifying and testing programs that process text. The typical ACL paper doesn't revolve around a select few problematic examples anymore unless they are representative of many test cases. However, that is not the same as saying, as you did earlier, that NLP has moved away from the "symbolic approach" to parsing (or more generally, processing) texts. Symbols are alive and well inside modern NLP applications such as Babelfish, whether they are represented inside containers such as probability distributions (a functor and a monad, like all good containers are :). So, it depends on what the goal of the exercise is. If the goal is to make the student appreciate how modern NLP applications are specified and tested, then having them write CFG productions for a toy fragment of English would not be the right way to go. But if the goal is to make the student "appreciate how Babelfish works", then there's nothing wrong with a CFG exercise. Shriram Krishnamurthi wrote: > Otherwise you will have > another generation of students thinking this is how NL is parsed, and > will be in no position whatsoever to appreciate how something like > Babelfish works. (YC's message, where he effectively says he has read > multiple AI books that mentioned NLP and yet they all left him > unprepared to understand Eli's message, is telling.) Production rules *are* how real NL is processed, as much as continuation passing is how real Web applications work and closure conversion is how real compilers work. It is a different issue what position someone who only learns about CFGs or continuation passing or closure conversion is in to appreciate how Babelfish or Amazon or gcc works. (I'm sure you'll have no trouble finding an email message that describes how programming languages are implemented nowadays and that someone who has read multiple PL books is left unprepared to understand. Even if the message and the books are written in the same NL. :) -- Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig We want our revolution, and we want it now! -- Marat/Sade We want our revolution, and we'll take it at such time as you've gotten around to delivering it -- Haskell programmer -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090602/850c62a1/attachment.pgp From hendrik at topoi.pooq.com Tue Jun 2 10:35:46 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Tue Jun 2 10:42:09 2009 Subject: [plt-scheme] LLVM In-Reply-To: <18981.9950.851022.517644@winooski.ccs.neu.edu> References: <20090602130853.GA15991@giebrok.zwizwa.be> <18981.9950.851022.517644@winooski.ccs.neu.edu> Message-ID: <20090602143546.GA3481@topoi.pooq.com> On Tue, Jun 02, 2009 at 09:19:26AM -0400, Eli Barzilay wrote: > On Jun 2, Tom Schouten wrote: > > I was wondering if there is anyone working on a bridge between > > LLVM and (PLT) Scheme. > > > > More specifically I'm thinking about run-time code generation > > (i.e. an embedded real-time DSL) and FFI to to the generated code. > > > > Also, what happened to the idea of using LLVM for the PLT JIT? > > There were several problems with the project -- one was that LLVM is > huge, and adding it to PLT is roughly on the same scale as adding GCC. > After we've played with it for a while, Matthew did the mzscheme > jitter using lightning -- which is much more light weight, but also > (not surprisingly) leaves mzscheme with the burden of doing more > optimizations itself. What's this 'lightning'? It sounds useful, but googling it leads to a lot of intersting, but irrelevant, pages about thunderstoorms and computer graphics. -- hendrik From eli at barzilay.org Tue Jun 2 10:44:28 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Jun 2 10:44:50 2009 Subject: [plt-scheme] LLVM In-Reply-To: <20090602143546.GA3481@topoi.pooq.com> References: <20090602130853.GA15991@giebrok.zwizwa.be> <18981.9950.851022.517644@winooski.ccs.neu.edu> <20090602143546.GA3481@topoi.pooq.com> Message-ID: <18981.15052.439172.964780@winooski.ccs.neu.edu> On Jun 2, hendrik@topoi.pooq.com wrote: > > What's this 'lightning'? It sounds useful, but googling it leads to > a lot of intersting, but irrelevant, pages about thunderstoorms and > computer graphics. GNU Lightning, http://www.gnu.org/software/lightning/ -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From eli at barzilay.org Tue Jun 2 10:52:15 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Jun 2 10:52:36 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: <20090602142941.GC23694@mantle.rutgers.edu> References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> <18979.56830.723396.281647@winooski.ccs.neu.edu> <534ef6-ck2.ln1@mantle.rutgers.edu> <18980.27741.474577.615232@winooski.ccs.neu.edu> <20090602090716.GA20342@mantle.rutgers.edu> <779bf2730906011211x1b622665r5acea2523a8a3045@mail.gmail.com> <18980.10863.548451.600306@winooski.ccs.neu.edu> <18980.61892.67525.128307@winooski.ccs.neu.edu> <20090602142941.GC23694@mantle.rutgers.edu> Message-ID: <18981.15519.148715.770669@winooski.ccs.neu.edu> On Jun 2, Chung-chieh Shan wrote: > > You seem to be drawing a distinction between two kinds of programs > by examining how they are specified and tested. I certainly agree > with you that NLP has moved away from the "symbolic approach" to > specifying and testing programs that process text. The typical ACL > paper doesn't revolve around a select few problematic examples > anymore unless they are representative of many test cases. Yes (to all that). > However, that is not the same as saying, as you did earlier, that > NLP has moved away from the "symbolic approach" to parsing (or more > generally, processing) texts. Symbols are alive and well inside > modern NLP applications such as Babelfish, whether they are > represented inside containers such as probability distributions (a > functor and a monad, like all good containers are :). Right -- I talked about the general approach. > Shriram Krishnamurthi wrote: > > [...] > (I'm sure you'll have no trouble finding an email message that > describes how programming languages are implemented nowadays and > that someone who has read multiple PL books is left unprepared to > understand. Even if the message and the books are written in the > same NL. :) I think that a similar problem exists if someone reads the dragon book (at least in the edition that I used) in an attempt to learn about programming languages. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From hendrik at topoi.pooq.com Tue Jun 2 10:48:17 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Tue Jun 2 10:54:40 2009 Subject: [plt-scheme] LLVM In-Reply-To: <18981.9950.851022.517644@winooski.ccs.neu.edu> References: <20090602130853.GA15991@giebrok.zwizwa.be> <18981.9950.851022.517644@winooski.ccs.neu.edu> Message-ID: <20090602144817.GB3481@topoi.pooq.com> On Tue, Jun 02, 2009 at 09:19:26AM -0400, Eli Barzilay wrote: > On Jun 2, Tom Schouten wrote: > > I was wondering if there is anyone working on a bridge between > > LLVM and (PLT) Scheme. > > > > More specifically I'm thinking about run-time code generation > > (i.e. an embedded real-time DSL) and FFI to to the generated code. > > > > Also, what happened to the idea of using LLVM for the PLT JIT? > > There were several problems with the project -- one was that LLVM is > huge, and adding it to PLT is roughly on the same scale as adding GCC. > After we've played with it for a while, Matthew did the mzscheme > jitter using lightning -- which is much more light weight, but also > (not surprisingly) leaves mzscheme with the burden of doing more > optimizations itself. Having that done, there was little point in > continguing the fight with LLVM, which had a few other issues at the > time. (My guess is that using LLVM would make things faster, given > the huge effort that went into making it an optimizing compiler.) > > Implementing an LLVM interface, however, should be very easy -- after > spending some time looking at the various options, our conclusion was > that it's really just easier to invoke LLVM on whole files (in the > LLVM language), and using the LLVM jit to create an executable piece > of code. The first instinct was to use the LLVM commands directly, > but that doesn't really have any advantage over using whole files. I considered using LLVM to replace the code generator of a legacy compiler, one that previously generated IBM 360 assembler with a lot of macro-time goto's to handle the issued of having to generated code in a different order from what the assembler demanded. I gave that up, partly because, as you say, LLVM is HUGE, but mostly because it too, even in its alluring parse tree interface, demanded that some crucial things be done in an order inconsitent with the data flow of the compiler. In particular, it demanded that a structure type be completely defined before you could build parse trees for code that declares variables of that type. This seems a little too strong a requirement at parse-tree-building time, and it killed my code-generatong algorithms. I ended up picking C minus minus, which has its own problems (limited support and currently a small set of target machine architectures), but was small and comprehensible. To deal with out-of-order I had the compiler use a "string-with-insertion-points" data structure, which is essentially a mutable tree of text snippets, which is eventually treewalked to create an output file. That's practical now. It wasn't in the legacy era thirty years ago. I suppose at this point I could use the same data structure to generate LLVM files out of order, too. -- hendrik From toddobryan at gmail.com Tue Jun 2 11:01:34 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Tue Jun 2 11:01:54 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> <18979.56830.723396.281647@winooski.ccs.neu.edu> <779bf2730906011211x1b622665r5acea2523a8a3045@mail.gmail.com> <18980.10863.548451.600306@winooski.ccs.neu.edu> Message-ID: <904774730906020801k46a14d16hb08a58cc72ba69a0@mail.gmail.com> On Tue, Jun 2, 2009 at 9:01 AM, David Brooks wrote: > > On 2 Jun 2009, at 13:51, Shriram Krishnamurthi wrote: >> >> ...if that is the point to the exercise. ?Otherwise you will have >> another generation of students thinking this is how NL is parsed, and >> will be in no position whatsoever to appreciate how something like >> Babelfish works. ?(YC's message, where he effectively says he has read >> multiple AI books that mentioned NLP and yet they all left him >> unprepared to understand Eli's message, is telling.) As Eli mentioned, statistical models for generation are not nearly as successful as models for parsing. One of my personal prejudices (from way too many classes in MIT-style syntax, a few in Cognitive Grammar, and semantics of both the truth-conditional and cognitivist sorts) is that I happen to believe that humans are so good at parsing language because they're also good at generating language. As we do language understanding, I think we're constantly asking "What would I mean if I said what the person who's talking to me is saying?" "Garden path" sentences of the sort: The horse raced past the barn fell. and Spiro conjectures Ex-Lax. are actually fairly easy for symbolic parsers to parse, but very hard for human beings, largely (I think) because it's hard for humans to create contexts in which they make sense. With the right context, they're fairly easy, even for humans. One of my computational linguistics professors said that the statistical revolution of the 1990s was incredibly important, but he worried that it was the result of competitive systems that encouraged people to create something that worked, not necessarily something that was based in good research. His view was that people had kind of hit a wall and the field needed to go back to doing some basic research to figure out how to get past the limitations people had hit. As for my project, I think I'm going to implement a GLR/Tomita parser, since it works on ambiguous grammars, is guaranteed O(n^3) performance, and will give me a chance to program some really interesting data structures and get more comfortable with idiomatic Scheme. Todd From sbloch at adelphi.edu Tue Jun 2 11:45:42 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Tue Jun 2 11:46:46 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: <18981.15519.148715.770669@winooski.ccs.neu.edu> References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> <18979.56830.723396.281647@winooski.ccs.neu.edu> <534ef6-ck2.ln1@mantle.rutgers.edu> <18980.27741.474577.615232@winooski.ccs.neu.edu> <20090602090716.GA20342@mantle.rutgers.edu> <779bf2730906011211x1b622665r5acea2523a8a3045@mail.gmail.com> <18980.10863.548451.600306@winooski.ccs.neu.edu> <18980.61892.67525.128307@winooski.ccs.neu.edu> <20090602142941.GC23694@mantle.rutgers.edu> <18981.15519.148715.770669@winooski.ccs.neu.edu> Message-ID: <15AC064E-1F2A-4701-AB22-57E69259C8CE@adelphi.edu> On Jun 2, 2009, at 10:52 AM, Eli Barzilay wrote: > I think that a similar problem exists if someone reads the dragon book > (at least in the edition that I used) in an attempt to learn about > programming languages. Well, I already knew something about programming languages, but I read the dragon book the summer between high school and college to learn about compilers. It was pretty heavy going, and the Greek letters contributed to that, I have to admit :-) Two months later, in my first term in college, I was assigned to write a Roman-numeral- reading program. I wrote down a regular expression for Roman numerals, converted it by hand to a DFA, coded it in Pascal, and (since the dragon book hadn't said anything about attaching semantics to a DFA) made up a seat-of-the-pants way to add actions to compute the value of the Roman numeral. It was utterly incomprehensible, because all the states had integer names. The teaching assistant wrote on my printout "I'll assume this works...." Stephen Bloch sbloch@adelphi.edu From dyoo at cs.wpi.edu Tue Jun 2 13:15:56 2009 From: dyoo at cs.wpi.edu (Danny Yoo) Date: Tue Jun 2 13:16:20 2009 Subject: [plt-scheme] bugs in DivaScheme 1.3 In-Reply-To: References: Message-ID: On Tue, Jun 2, 2009 at 4:25 AM, Benjamin L.Russell wrote: > I've been trying to use DivaScheme 1.3 (see > http://www.cs.brown.edu/research/plt/software/divascheme/) on Windows > XP Professional, Service Pack 3, to enter the factorial function in > DrScheme 4.2, but so far, I have encountered the following (rather > frustrating) bugs: > > 1. Every time that I switch tabs in Windows from DrScheme to Firefox > and back using ALT + TAB, DivaScheme mysteriously switches from > insertion mode to command mode. This is intentional in the code: we explicitely switch back from command mode to insertion mode if the window loses focus. > 2. When editing a s-expression, if I make a mistake and backtrack, > often a command prompt window suddenly appears and won't go away. ?For > example, I tried typing the following in DivaScheme: This is bad. I'll investigate this tonight. It may be some weird interaction with Drscheme 4.2, but I'll need to take a closer look at it. From wookiz at hotmail.com Tue Jun 2 13:21:43 2009 From: wookiz at hotmail.com (wooks) Date: Tue Jun 2 13:30:36 2009 Subject: [plt-scheme] Re: Why "lambda"? In-Reply-To: <1243849441.6454.23.camel@darkstar> References: <1243807231.5017.7.camel@Nokia-N800-43-7> <1d3aff7f-591b-40d3-bda6-8b616bbb3bb1@q14g2000vbn.googlegroups.com> <1243849441.6454.23.camel@darkstar> Message-ID: On Jun 1, 5:44?am, Erich Rast wrote: > > Insofar as the message is - there's a good reason why we do this > > (clarity, avoids ambiguity, makes no difference if you abstract > > etc...). No. I ain't swallowing it. > > I tried to avoid it, but can't resist any longer. :O > > There is a good reason for Greek letters and it's not just convention. > I'm not sure how much you've been exposed to formal logic so far, but at > least in this domain I'd say it's impossible to have a clear, correct > and concise notation without using additional letters such as the Greek > ones. Arbitrary symbols, usually taken from a huge Latex symbol list, > are harder to read than Greek letters, and when you write down a > complete logic including some meta-theorems, you'll quickly run out of > ordinary Roman letters. Having the Greek alphabet is a matter of > necessity when ?you're doing logic, because you frequently need > different *types* of letters. Try to distinguish normal, italic and > boldface 'A' on the blackboard---impossible. Even upper vs. lower-case > letters can be a pain to write on the blackboard. > > IMHO, the most important thing with 'strange' letters is that (a) you > have to know how to pronounce them, and (b) they need to be easily > writable on the blackboard. Greek letters are fine with both respects > and beat any kind of hand-made symbol at anytime. Personally, I have > problems with Kyrillic, some of the less common Hebrew letters, and old > German Fraktur fonts, though. Yes, I've seen logic books that used the > whole Kyrillic alphabet, which might be easy for a Russian logician, but > is hard to read for someone who never learned Russian. Fraktur, on the > other hand, is not hard to read, but in my opinion impossible to write > and read on the blackboard. > Fair cop. I was too careless with the scope of my statement. My exposure to Greek has been from classes and texts in Theory of Computation, Machine Learning and Bayesian Statistics and that is the appropriate scope for my comment. Coming from a discipline where it is suggested that for reasons of clarity the maximum number of arguments a module should have is 7 (I either read that in Code Complete or Larry Constantine's Peopleware) it is hard to envisage a scenario where you need so many variables to present a concept that you have to resort to Greek ones. I watched a lecture on OCL and remembered wondering whether it's raison d'etre was other than to provide a Greekless formal specification language which would be palatable in the "real world". From sk at cs.brown.edu Tue Jun 2 13:35:54 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Tue Jun 2 13:36:44 2009 Subject: [plt-scheme] Re: Why "lambda"? In-Reply-To: References: <1243807231.5017.7.camel@Nokia-N800-43-7> <1d3aff7f-591b-40d3-bda6-8b616bbb3bb1@q14g2000vbn.googlegroups.com> <1243849441.6454.23.camel@darkstar> Message-ID: > I watched a lecture on OCL and remembered wondering whether it's > raison d'etre was other than to provide a Greekless formal > specification language which would be palatable in the "real world". That's pretty much it, but also customized to objects. Shriram From grettke at acm.org Tue Jun 2 13:54:22 2009 From: grettke at acm.org (Grant Rettke) Date: Tue Jun 2 13:54:54 2009 Subject: [plt-scheme] Re: Why "lambda"? In-Reply-To: References: <1243807231.5017.7.camel@Nokia-N800-43-7> <1d3aff7f-591b-40d3-bda6-8b616bbb3bb1@q14g2000vbn.googlegroups.com> <1243849441.6454.23.camel@darkstar> Message-ID: <756daca50906021054j53b7487fm939d16c5ea83c1cc@mail.gmail.com> On Tue, Jun 2, 2009 at 12:35 PM, Shriram Krishnamurthi wrote: >> I watched a lecture on OCL and remembered wondering whether it's >> raison d'etre was other than to provide a Greekless formal >> specification language which would be palatable in the "real world". > > That's pretty much it, but also customized to objects. Please elaborate: OCL provides a means by which to describe the valid state(s) of an object; what is the connection between that and the Greek used elsewhere in this thread? From wookiz at hotmail.com Tue Jun 2 15:07:06 2009 From: wookiz at hotmail.com (wooks) Date: Tue Jun 2 15:07:25 2009 Subject: [plt-scheme] Re: Htdp chapter 12 insertion sort In-Reply-To: <9b1fff280906020447n6fc9fa43o89432cbe126fe7@mail.gmail.com> References: <73045cca0906012254y974c13fxc99daee1ccf5abec@mail.gmail.com> <9b1fff280906020447n6fc9fa43o89432cbe126fe7@mail.gmail.com> Message-ID: <67f9ebcd-b4f1-4bc4-8edd-a9f75e185dac@r13g2000vbr.googlegroups.com> On Jun 2, 7:47?am, Marco Morazan wrote: > > ;; sort : list-of-numbers ?->? list-of-numbers (sorted) > > > ;; to create a list of numbers with the same numbers as > > ;; alon sorted in descending order > > (define (sort alon) > > > ? (cond > > ? ? [(empty? alon) empty] > > ? ? [(cons? alon) (insert (first alon) (sort (rest alon)))]))- what is cons? > > alon here , is it required there? > > What exactly is bothering you? cons? is a primitive used to determine > if its input is a constructed list. > Perhaps he is bothered by the use of cons? rather than list? From maxigas at anargeek.net Tue Jun 2 15:08:18 2009 From: maxigas at anargeek.net (maxigas) Date: Tue Jun 2 15:18:05 2009 Subject: [plt-scheme] Does anyone have non-standard keybindings for OS X that they would like to share? In-Reply-To: <756daca50906010514p69b0c3c8yc45d6c9f8eea9cdc@mail.gmail.com> References: <756daca50906010514p69b0c3c8yc45d6c9f8eea9cdc@mail.gmail.com> Message-ID: <20090602.210818.243431061.maxigas@anargeek.net> From: Grant Rettke Subject: [plt-scheme] Does anyone have non-standard keybindings for OS X that they would like to share? Date: Mon, 1 Jun 2009 07:14:16 -0500 > Does anyone have non-standard keybindings for OS X that they would > like to share? i am using Debian on my Apple G3 laptop and for Lisp mode i mapped F3 and F4 (without modifier keys) for insert-left-bracket and insert-right-bracket, respectively. these are the keys with the volume symbols on them that look like brackets. :) maxigas From grettke at acm.org Tue Jun 2 15:18:15 2009 From: grettke at acm.org (Grant Rettke) Date: Tue Jun 2 15:18:33 2009 Subject: [plt-scheme] Does anyone have non-standard keybindings for OS X that they would like to share? In-Reply-To: <20090602.210818.243431061.maxigas@anargeek.net> References: <756daca50906010514p69b0c3c8yc45d6c9f8eea9cdc@mail.gmail.com> <20090602.210818.243431061.maxigas@anargeek.net> Message-ID: <756daca50906021218s5e9565c7wa40bf2c360477a3@mail.gmail.com> On Tue, Jun 2, 2009 at 2:08 PM, maxigas wrote: > i am using Debian on my Apple G3 laptop and for Lisp mode i mapped F3 and F4 (without modifier > keys) for insert-left-bracket and insert-right-bracket, respectively. ?these are the keys with > the volume symbols on them that look like brackets. :) Thanks maxigas and everyone. I was hoping I could use the option keys for alt instead; but I find that I am not sure about what is safe to remap and not safe :(. From adityashukla1983 at gmail.com Tue Jun 2 15:40:07 2009 From: adityashukla1983 at gmail.com (aditya shukla) Date: Tue Jun 2 15:40:27 2009 Subject: [plt-scheme] Re: Htdp chapter 12 insertion sort In-Reply-To: <67f9ebcd-b4f1-4bc4-8edd-a9f75e185dac@r13g2000vbr.googlegroups.com> References: <73045cca0906012254y974c13fxc99daee1ccf5abec@mail.gmail.com> <9b1fff280906020447n6fc9fa43o89432cbe126fe7@mail.gmail.com> <67f9ebcd-b4f1-4bc4-8edd-a9f75e185dac@r13g2000vbr.googlegroups.com> Message-ID: <73045cca0906021240y1606822dl9c86f4a32408fa73@mail.gmail.com> I thought there should be else in place of cons? and what's the use of cons? here. Aditya -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090602/9803ac44/attachment.htm From tomasz.skutnik at gmail.com Tue Jun 2 15:41:53 2009 From: tomasz.skutnik at gmail.com (Tomasz) Date: Tue Jun 2 15:42:15 2009 Subject: [plt-scheme] Re: Style question In-Reply-To: <78c04168-dbee-48f0-98a9-4440b58d839d@h11g2000yqb.googlegroups.com> References: <8f7f1350-2735-416a-882b-7014db5ff228@x5g2000yqk.googlegroups.com> <4A21B4BB.6000901@ccs.neu.edu> <78c04168-dbee-48f0-98a9-4440b58d839d@h11g2000yqb.googlegroups.com> Message-ID: On May 31, 11:40?am, Tomasz wrote: > > Thanks - that helped. I'll probably take procedure-rename route. > Well... taking that route didn't work. procedure-rename drops keyword arguments. Consider test case: --8<-------------- #lang scheme (define (kwtest #:p1 p1) (list p1)) (procedure-keywords kwtest) (procedure-keywords (procedure-rename kwtest 'kwtest2)) --8<-------------- that produces: (#:p1) (#:p1) () () Is this planned/desirable effect? Should I fill bug-report? Tomasz From eli at barzilay.org Tue Jun 2 15:47:25 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Jun 2 15:47:47 2009 Subject: [plt-scheme] Re: Style question In-Reply-To: References: <8f7f1350-2735-416a-882b-7014db5ff228@x5g2000yqk.googlegroups.com> <4A21B4BB.6000901@ccs.neu.edu> <78c04168-dbee-48f0-98a9-4440b58d839d@h11g2000yqb.googlegroups.com> Message-ID: <18981.33229.855038.22018@winooski.ccs.neu.edu> On Jun 2, Tomasz wrote: > On May 31, 11:40?am, Tomasz wrote: > > Thanks - that helped. I'll probably take procedure-rename route. > > Well... taking that route didn't work. procedure-rename drops > keyword arguments. Consider test case: > [...] > Is this planned/desirable effect? Should I fill bug-report? Yes, `procedure-rename' doesn't work with keyword functions yet (it works at the low-level). But in any case, I think that in your case renaming the provided name is easier. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From matthias at ccs.neu.edu Tue Jun 2 16:01:14 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Tue Jun 2 16:02:34 2009 Subject: [plt-scheme] Re: Htdp chapter 12 insertion sort In-Reply-To: <73045cca0906021240y1606822dl9c86f4a32408fa73@mail.gmail.com> References: <73045cca0906012254y974c13fxc99daee1ccf5abec@mail.gmail.com> <9b1fff280906020447n6fc9fa43o89432cbe126fe7@mail.gmail.com> <67f9ebcd-b4f1-4bc4-8edd-a9f75e185dac@r13g2000vbr.googlegroups.com> <73045cca0906021240y1606822dl9c86f4a32408fa73@mail.gmail.com> Message-ID: <4DC88329-E6A2-47D1-89F9-930A0E17BDB9@ccs.neu.edu> 1. list? would be a mistake. Wny? 2. (cons? ..) and else are equivalent for our purposes. The use of cons? emphasizes that there really are two possibilities: empty? and cons?. The use of else is less informative for readers. On Jun 2, 2009, at 3:40 PM, aditya shukla wrote: > I thought there should be else in place of cons? and what's the use > of cons? here. > > > > Aditya > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From morazanm at gmail.com Tue Jun 2 16:02:44 2009 From: morazanm at gmail.com (Marco Morazan) Date: Tue Jun 2 16:03:12 2009 Subject: [plt-scheme] Re: Htdp chapter 12 insertion sort In-Reply-To: <73045cca0906021240y1606822dl9c86f4a32408fa73@mail.gmail.com> References: <73045cca0906012254y974c13fxc99daee1ccf5abec@mail.gmail.com> <9b1fff280906020447n6fc9fa43o89432cbe126fe7@mail.gmail.com> <67f9ebcd-b4f1-4bc4-8edd-a9f75e185dac@r13g2000vbr.googlegroups.com> <73045cca0906021240y1606822dl9c86f4a32408fa73@mail.gmail.com> Message-ID: <9b1fff280906021302o369e9105of31ae92f1d11bf5a@mail.gmail.com> On Tue, Jun 2, 2009 at 3:40 PM, aditya shukla wrote: > I thought there should be else in place of cons? and what's the use of cons? > here. > OK, that makes it clear. So as I said in my reply you can rewrite the function using else. It is two ways of doing exactly the same thing. :-) -- Cheers, Marco From eli at barzilay.org Tue Jun 2 16:06:39 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Jun 2 16:07:05 2009 Subject: [plt-scheme] docs.plt-scheme.org Message-ID: <18981.34383.128260.371039@winooski.ccs.neu.edu> I've changed things so http://docs.plt-scheme.org/ shows the documentation for the recently released version (currently 4.2). Having it show the nightly build documentation was a reasonable choice while the documentation was not still stable. This involved a DNS change so it will take a while to propagate through. The nightly build documentation is still available at http://pre.plt-scheme.org/docs/html/ -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From tomasz.skutnik at gmail.com Tue Jun 2 16:19:36 2009 From: tomasz.skutnik at gmail.com (Tomasz) Date: Tue Jun 2 16:19:54 2009 Subject: [plt-scheme] Re: Style question In-Reply-To: <18981.33229.855038.22018@winooski.ccs.neu.edu> References: <8f7f1350-2735-416a-882b-7014db5ff228@x5g2000yqk.googlegroups.com> <4A21B4BB.6000901@ccs.neu.edu> <78c04168-dbee-48f0-98a9-4440b58d839d@h11g2000yqb.googlegroups.com> <18981.33229.855038.22018@winooski.ccs.neu.edu> Message-ID: <1195b3aa-dfe9-4eae-9a45-80e13b44af7a@r34g2000vba.googlegroups.com> On Jun 2, 9:47?pm, Eli Barzilay wrote: > Yes, `procedure-rename' doesn't work with keyword functions yet (it > works at the low-level). ?But in any case, I think that in your case > renaming the provided name is easier. > Well... not quite. (provide (rename-out (internal-name external- name))) does not modify debugging information. Consider: m1.ss: --8<------------- #lang scheme (define (name-test) 'name-test) (define (name-test2 x) 'name-test2) (provide name-test (rename-out (name-test2 rename-test))) --8<------------- m2.ss: --8<------------- #lang scheme (require "m1.ss") (name-test) ;; intentional error below (rename-test) --8<------------- Running m2.ss produces following error: procedure name-test2: expects 1 argument, given 0 Which *is* confusing for end-user... Am I doing something wrong? Tomasz From eli at barzilay.org Tue Jun 2 16:37:11 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Jun 2 16:37:33 2009 Subject: [plt-scheme] Re: Style question In-Reply-To: <1195b3aa-dfe9-4eae-9a45-80e13b44af7a@r34g2000vba.googlegroups.com> References: <8f7f1350-2735-416a-882b-7014db5ff228@x5g2000yqk.googlegroups.com> <4A21B4BB.6000901@ccs.neu.edu> <78c04168-dbee-48f0-98a9-4440b58d839d@h11g2000yqb.googlegroups.com> <18981.33229.855038.22018@winooski.ccs.neu.edu> <1195b3aa-dfe9-4eae-9a45-80e13b44af7a@r34g2000vba.googlegroups.com> Message-ID: <18981.36215.785959.900469@winooski.ccs.neu.edu> On Jun 2, Tomasz wrote: > > Well... not quite. (provide (rename-out (internal-name external- > name))) does not modify debugging information. Consider: [...] Right. > Which *is* confusing for end-user... Am I doing something wrong? Well, if your concern is the end user, then the names that are used internally are irrelevant. The debugging information is more important to you, the author of the code, so in that sense it is even better to get a "more correct" error message. In other words, if I have this: #lang scheme (provide foo) (define (foo x) ...stuff...) then as the author, I can just as well change it to: #lang scheme (provide foo) (define (foo x) (bar x)) (define (bar x) ...stuff...) without thinking about the fact that the tail call mean that now errors will show `bar' -- the name is something that is relevant only to me. In the same way, I think that there is no harm in #lang scheme (provide (rename-out [create-foo make-foo])) (define-struct foo (x y z)) (define (create-foo ...) ... make-foo ...) since I could just as well do this: #lang scheme (provide make-foo) (define-struct internal-foo (x y z)) (define (make-foo ...) ... make-internal-foo ...) There is a minor issue here with values printed as # which is easily solved by either a custom writer, or some possible future extension (which should really be implemented, IMO): #lang scheme (provide make-foo) (define-struct foo (x y z) #:constructor-name make-foo*) (define (make-foo ...) ... make-foo* ...) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From jay.mccarthy at gmail.com Tue Jun 2 16:47:49 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Tue Jun 2 16:48:10 2009 Subject: [plt-scheme] ANN: Fra - Functional Relational Algebra Message-ID: I've just released a package on PLaneT: fra.plt http://planet.plt-scheme.org/display.ss?package=fra.plt&owner=jaymccarthy Fra is an implementation of the relational algebra with a database & query optimizer. I don't have proper documentation yet, but if you'd like to see what the code looks like, check out the test suite: http://planet.plt-scheme.org/package-source/jaymccarthy/fra.plt/1/0/test.ss High Points: - Query optimizer (currently not the best, but it is cool to see what it does) - Full relational algebra support (unlike SQL, I've stayed close to the mathematical definition) - Full Scheme value support (relations can contain any Scheme values) - Full Scheme support for propositions (propositions are lambdas with attributes as arguments) -- Why FRA? One acronym: FR-RA -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From jay.mccarthy at gmail.com Tue Jun 2 17:27:06 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Tue Jun 2 17:27:28 2009 Subject: [plt-scheme] Student parsing problem Message-ID: I just helped a student debug their program. It looked like this: (define (function1 arg) ... ) `;;(html (body "Text")) (define (function2 arg) ...) (function2 1) Naturally it is easy to tell that the problem is that ` finds the next s-expression, even if there are comments and whitespace between it and the next one; so function2 isn't really defined at all. Now, it seems reasonable for this to be a problem that the user should deal with in the Module and other higher languages. But you can get the same problem in Beginner (w/ List Abbrevs): (define (foo bar) 1) `;; Example (define (zog zag) 2) (zog 1) It would be nice, IMHO, if Beginner restricted ` and ' to be adjacent and the standard syntax Scheme highlighter in other languages made quoted expression visually distinct, but it doesn't appear that that is easy to do without trying to do a full parse, plus there is the obvious macro problem. Jay -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From carl.eastlund at gmail.com Tue Jun 2 17:33:23 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Tue Jun 2 17:33:46 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: References: Message-ID: <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> On Tue, Jun 2, 2009 at 5:27 PM, Jay McCarthy wrote: > I just helped a student debug their program. It looked like this: > > (define (function1 arg) > ?... > ?) > `;;(html (body "Text")) > > (define (function2 arg) > ?...) > > (function2 1) > > Naturally it is easy to tell that the problem is that ` finds the next > s-expression, even if there are comments and whitespace between it and > the next one; so function2 isn't really defined at all. > > Now, it seems reasonable for this to be a problem that the user should > deal with in the Module and other higher languages. But you can get > the same problem in Beginner (w/ List Abbrevs): > > (define (foo bar) > ?1) > `;; Example > > (define (zog zag) > ?2) > > (zog 1) > > It would be nice, IMHO, if Beginner restricted ` and ' to be adjacent > and the standard syntax Scheme highlighter in other languages made > quoted expression visually distinct, but it doesn't appear that that > is easy to do without trying to do a full parse, plus there is the > obvious macro problem. > > Jay This sounds like a custom reader problem to me, which avoids all issues of parsing in the editor and "macro problems". "Just" make it a read error to have whitespace, comments, etc. between ` or ' and their subsequent, implicitly-wrapped s-expression. --Carl From jay.mccarthy at gmail.com Tue Jun 2 17:36:38 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Tue Jun 2 17:37:00 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> References: <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> Message-ID: Yes, that would work for Beginner. But for the syntax highlighter, I don't think there's a nice way. My final sentence's "but" should only apply to the right-hand side of the "and". I'd change Beginner to show ya'll, but from what I can tell it use parameters to communicate the different syntax to the real C-reader. So I'd need to muck with that and add a new parameter... very messy and not sure its what the Powers That Be would prefer. Jay On Tue, Jun 2, 2009 at 3:33 PM, Carl Eastlund wrote: > On Tue, Jun 2, 2009 at 5:27 PM, Jay McCarthy wrote: >> I just helped a student debug their program. It looked like this: >> >> (define (function1 arg) >> ?... >> ?) >> `;;(html (body "Text")) >> >> (define (function2 arg) >> ?...) >> >> (function2 1) >> >> Naturally it is easy to tell that the problem is that ` finds the next >> s-expression, even if there are comments and whitespace between it and >> the next one; so function2 isn't really defined at all. >> >> Now, it seems reasonable for this to be a problem that the user should >> deal with in the Module and other higher languages. But you can get >> the same problem in Beginner (w/ List Abbrevs): >> >> (define (foo bar) >> ?1) >> `;; Example >> >> (define (zog zag) >> ?2) >> >> (zog 1) >> >> It would be nice, IMHO, if Beginner restricted ` and ' to be adjacent >> and the standard syntax Scheme highlighter in other languages made >> quoted expression visually distinct, but it doesn't appear that that >> is easy to do without trying to do a full parse, plus there is the >> obvious macro problem. >> >> Jay > > This sounds like a custom reader problem to me, which avoids all > issues of parsing in the editor and "macro problems". ?"Just" make it > a read error to have whitespace, comments, etc. between ` or ' and > their subsequent, implicitly-wrapped s-expression. > > --Carl > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From toddobryan at gmail.com Tue Jun 2 17:43:41 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Tue Jun 2 17:44:03 2009 Subject: [plt-scheme] Re: Htdp chapter 12 insertion sort In-Reply-To: <9b1fff280906021302o369e9105of31ae92f1d11bf5a@mail.gmail.com> References: <73045cca0906012254y974c13fxc99daee1ccf5abec@mail.gmail.com> <9b1fff280906020447n6fc9fa43o89432cbe126fe7@mail.gmail.com> <67f9ebcd-b4f1-4bc4-8edd-a9f75e185dac@r13g2000vbr.googlegroups.com> <73045cca0906021240y1606822dl9c86f4a32408fa73@mail.gmail.com> <9b1fff280906021302o369e9105of31ae92f1d11bf5a@mail.gmail.com> Message-ID: <904774730906021443g46ca3102xb19f01717e05f417@mail.gmail.com> One advantage to making the questions as clear as possible is that you get error messages earlier. (cond [(empty? alon) ....] [(cons? alon) ....] gives an "all question results were false" error if you pass in something like 4, "boo", or 'a. In contrast, (cond [(empty? alon) ...] [else ...] goes into the default answer and gives you some kind of error because you called a function like first or rest on something that's not a list. It seems to be a sound principle that, if you're going to fail, it's a good idea to do it as soon as possible. :-) Todd On Tue, Jun 2, 2009 at 4:02 PM, Marco Morazan wrote: > On Tue, Jun 2, 2009 at 3:40 PM, aditya shukla > wrote: >> I thought there should be else in place of cons? and what's the use of cons? >> here. >> > > OK, that makes it clear. So as I said in my reply you can rewrite the > function using else. It is two ways of doing exactly the same thing. > :-) > > -- > > Cheers, > > Marco > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From toddobryan at gmail.com Tue Jun 2 17:49:12 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Tue Jun 2 17:49:34 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: <15AC064E-1F2A-4701-AB22-57E69259C8CE@adelphi.edu> References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> <20090602090716.GA20342@mantle.rutgers.edu> <779bf2730906011211x1b622665r5acea2523a8a3045@mail.gmail.com> <18980.10863.548451.600306@winooski.ccs.neu.edu> <18980.61892.67525.128307@winooski.ccs.neu.edu> <20090602142941.GC23694@mantle.rutgers.edu> <18981.15519.148715.770669@winooski.ccs.neu.edu> <15AC064E-1F2A-4701-AB22-57E69259C8CE@adelphi.edu> Message-ID: <904774730906021449u4d1222dm1633ee56af169520@mail.gmail.com> When the only tool you have is a Dragon Book, everything looks like a .... I'm not sure how to finish that sentence, but I'm sure there's a punchline in there somewhere. :-) On Tue, Jun 2, 2009 at 11:45 AM, Stephen Bloch wrote: > > On Jun 2, 2009, at 10:52 AM, Eli Barzilay wrote: > >> I think that a similar problem exists if someone reads the dragon book >> (at least in the edition that I used) in an attempt to learn about >> programming languages. > > Well, I already knew something about programming languages, but I read the > dragon book the summer between high school and college to learn about > compilers. ?It was pretty heavy going, and the Greek letters contributed to > that, I have to admit :-) ?Two months later, in my first term in college, I > was assigned to write a Roman-numeral-reading program. ?I wrote down a > regular expression for Roman numerals, converted it by hand to a DFA, coded > it in Pascal, and (since the dragon book hadn't said anything about > attaching semantics to a DFA) made up a seat-of-the-pants way to add actions > to compute the value of the Roman numeral. ?It was utterly incomprehensible, > because all the states had integer names. ?The teaching assistant wrote on > my printout "I'll assume this works...." > > Stephen Bloch > sbloch@adelphi.edu > > > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From matthias at ccs.neu.edu Tue Jun 2 18:37:35 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Tue Jun 2 18:39:00 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: References: <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> Message-ID: <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> This is an interesting error, and as a beginner I ran into this myself (1984, probably february or march :-) I have not seen this kind of error since then, however. Before you invest time, let's see how many people have had students who stumbled over this. -- Matthias On Jun 2, 2009, at 5:36 PM, Jay McCarthy wrote: > Yes, that would work for Beginner. But for the syntax highlighter, I > don't think there's a nice way. My final sentence's "but" should only > apply to the right-hand side of the "and". > > I'd change Beginner to show ya'll, but from what I can tell it use > parameters to communicate the different syntax to the real C-reader. > So I'd need to muck with that and add a new parameter... very messy > and not sure its what the Powers That Be would prefer. > > Jay > > On Tue, Jun 2, 2009 at 3:33 PM, Carl Eastlund > wrote: >> On Tue, Jun 2, 2009 at 5:27 PM, Jay McCarthy >> wrote: >>> I just helped a student debug their program. It looked like this: >>> >>> (define (function1 arg) >>> ... >>> ) >>> `;;(html (body "Text")) >>> >>> (define (function2 arg) >>> ...) >>> >>> (function2 1) >>> >>> Naturally it is easy to tell that the problem is that ` finds the >>> next >>> s-expression, even if there are comments and whitespace between >>> it and >>> the next one; so function2 isn't really defined at all. >>> >>> Now, it seems reasonable for this to be a problem that the user >>> should >>> deal with in the Module and other higher languages. But you can get >>> the same problem in Beginner (w/ List Abbrevs): >>> >>> (define (foo bar) >>> 1) >>> `;; Example >>> >>> (define (zog zag) >>> 2) >>> >>> (zog 1) >>> >>> It would be nice, IMHO, if Beginner restricted ` and ' to be >>> adjacent >>> and the standard syntax Scheme highlighter in other languages made >>> quoted expression visually distinct, but it doesn't appear that that >>> is easy to do without trying to do a full parse, plus there is the >>> obvious macro problem. >>> >>> Jay >> >> This sounds like a custom reader problem to me, which avoids all >> issues of parsing in the editor and "macro problems". "Just" make it >> a read error to have whitespace, comments, etc. between ` or ' and >> their subsequent, implicitly-wrapped s-expression. >> >> --Carl >> > > > > -- > Jay McCarthy > Assistant Professor / Brigham Young University > http://teammccarthy.org/jay > > "The glory of God is Intelligence" - D&C 93 > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From carl.eastlund at gmail.com Tue Jun 2 18:55:01 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Tue Jun 2 18:55:39 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> References: <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> Message-ID: <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> I have had students run into the same problem with #; comments, that a #; before whitespace or another comment could be forgotten. I think all of the s-expression-eating reader forms should have the "no whitespace/comment" restriction in the student languages. --Carl On Tue, Jun 2, 2009 at 6:37 PM, Matthias Felleisen wrote: > > This is an interesting error, and as a beginner I ran into this myself > (1984, probably february or march :-) > > I have not seen this kind of error since then, however. Before you invest > time, let's see how many people have had students who stumbled over this. > > -- Matthias > > On Jun 2, 2009, at 5:36 PM, Jay McCarthy wrote: > >> Yes, that would work for Beginner. But for the syntax highlighter, I >> don't think there's a nice way. My final sentence's "but" should only >> apply to the right-hand side of the "and". >> >> I'd change Beginner to show ya'll, but from what I can tell it use >> parameters to communicate the different syntax to the real C-reader. >> So I'd need to muck with that and add a new parameter... very messy >> and not sure its what the Powers That Be would prefer. >> >> Jay >> >> On Tue, Jun 2, 2009 at 3:33 PM, Carl Eastlund >> wrote: >>> >>> On Tue, Jun 2, 2009 at 5:27 PM, Jay McCarthy >>> wrote: >>>> >>>> I just helped a student debug their program. It looked like this: >>>> >>>> (define (function1 arg) >>>> ?... >>>> ?) >>>> `;;(html (body "Text")) >>>> >>>> (define (function2 arg) >>>> ?...) >>>> >>>> (function2 1) >>>> >>>> Naturally it is easy to tell that the problem is that ` finds the next >>>> s-expression, even if there are comments and whitespace between it and >>>> the next one; so function2 isn't really defined at all. >>>> >>>> Now, it seems reasonable for this to be a problem that the user should >>>> deal with in the Module and other higher languages. But you can get >>>> the same problem in Beginner (w/ List Abbrevs): >>>> >>>> (define (foo bar) >>>> ?1) >>>> `;; Example >>>> >>>> (define (zog zag) >>>> ?2) >>>> >>>> (zog 1) >>>> >>>> It would be nice, IMHO, if Beginner restricted ` and ' to be adjacent >>>> and the standard syntax Scheme highlighter in other languages made >>>> quoted expression visually distinct, but it doesn't appear that that >>>> is easy to do without trying to do a full parse, plus there is the >>>> obvious macro problem. >>>> >>>> Jay >>> >>> This sounds like a custom reader problem to me, which avoids all >>> issues of parsing in the editor and "macro problems". ?"Just" make it >>> a read error to have whitespace, comments, etc. between ` or ' and >>> their subsequent, implicitly-wrapped s-expression. >>> >>> --Carl >> >> -- >> Jay McCarthy >> Assistant Professor / Brigham Young University >> http://teammccarthy.org/jay >> >> "The glory of God is Intelligence" - D&C 93 From matthias at ccs.neu.edu Tue Jun 2 18:58:17 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Tue Jun 2 18:59:32 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> References: <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> Message-ID: If there's evidence that students get bitten, I think we should do something about it. On Jun 2, 2009, at 6:55 PM, Carl Eastlund wrote: > I have had students run into the same problem with #; comments, that a > #; before whitespace or another comment could be forgotten. I think > all of the s-expression-eating reader forms should have the "no > whitespace/comment" restriction in the student languages. > > --Carl > > On Tue, Jun 2, 2009 at 6:37 PM, Matthias Felleisen > wrote: >> >> This is an interesting error, and as a beginner I ran into this >> myself >> (1984, probably february or march :-) >> >> I have not seen this kind of error since then, however. Before you >> invest >> time, let's see how many people have had students who stumbled >> over this. >> >> -- Matthias >> >> On Jun 2, 2009, at 5:36 PM, Jay McCarthy wrote: >> >>> Yes, that would work for Beginner. But for the syntax highlighter, I >>> don't think there's a nice way. My final sentence's "but" should >>> only >>> apply to the right-hand side of the "and". >>> >>> I'd change Beginner to show ya'll, but from what I can tell it use >>> parameters to communicate the different syntax to the real C-reader. >>> So I'd need to muck with that and add a new parameter... very messy >>> and not sure its what the Powers That Be would prefer. >>> >>> Jay >>> >>> On Tue, Jun 2, 2009 at 3:33 PM, Carl Eastlund >>> >>> wrote: >>>> >>>> On Tue, Jun 2, 2009 at 5:27 PM, Jay McCarthy >>>> >>>> wrote: >>>>> >>>>> I just helped a student debug their program. It looked like this: >>>>> >>>>> (define (function1 arg) >>>>> ... >>>>> ) >>>>> `;;(html (body "Text")) >>>>> >>>>> (define (function2 arg) >>>>> ...) >>>>> >>>>> (function2 1) >>>>> >>>>> Naturally it is easy to tell that the problem is that ` finds >>>>> the next >>>>> s-expression, even if there are comments and whitespace between >>>>> it and >>>>> the next one; so function2 isn't really defined at all. >>>>> >>>>> Now, it seems reasonable for this to be a problem that the user >>>>> should >>>>> deal with in the Module and other higher languages. But you can >>>>> get >>>>> the same problem in Beginner (w/ List Abbrevs): >>>>> >>>>> (define (foo bar) >>>>> 1) >>>>> `;; Example >>>>> >>>>> (define (zog zag) >>>>> 2) >>>>> >>>>> (zog 1) >>>>> >>>>> It would be nice, IMHO, if Beginner restricted ` and ' to be >>>>> adjacent >>>>> and the standard syntax Scheme highlighter in other languages made >>>>> quoted expression visually distinct, but it doesn't appear that >>>>> that >>>>> is easy to do without trying to do a full parse, plus there is the >>>>> obvious macro problem. >>>>> >>>>> Jay >>>> >>>> This sounds like a custom reader problem to me, which avoids all >>>> issues of parsing in the editor and "macro problems". "Just" >>>> make it >>>> a read error to have whitespace, comments, etc. between ` or ' and >>>> their subsequent, implicitly-wrapped s-expression. >>>> >>>> --Carl >>> >>> -- >>> Jay McCarthy >>> Assistant Professor / Brigham Young University >>> http://teammccarthy.org/jay >>> >>> "The glory of God is Intelligence" - D&C 93 From dvanhorn at ccs.neu.edu Tue Jun 2 19:15:19 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Tue Jun 2 19:15:57 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> References: <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> Message-ID: <4A25B287.6080906@ccs.neu.edu> Carl Eastlund wrote: > I have had students run into the same problem with #; comments, that a > #; before whitespace or another comment could be forgotten. I think > all of the s-expression-eating reader forms should have the "no > whitespace/comment" restriction in the student languages. I frequently use the pattern #; (define (f x) ...) in student language programs. It preserves the indentation of the definition and this program should be acceptable, IMO. David From matthias at ccs.neu.edu Tue Jun 2 19:47:09 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Tue Jun 2 19:47:47 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: <4A25B287.6080906@ccs.neu.edu> References: <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> <4A25B287.6080906@ccs.neu.edu> Message-ID: <4A5D06CE-3A1C-4050-8E7A-47F3B46EF912@ccs.neu.edu> Actually, I teach this pattern ... So the rules aren't trivial. On Jun 2, 2009, at 7:15 PM, David Van Horn wrote: > Carl Eastlund wrote: >> I have had students run into the same problem with #; comments, >> that a >> #; before whitespace or another comment could be forgotten. I think >> all of the s-expression-eating reader forms should have the "no >> whitespace/comment" restriction in the student languages. > > I frequently use the pattern > > #; > (define (f x) ...) > > in student language programs. It preserves the indentation of the > definition and this program should be acceptable, IMO. > > David From robby at eecs.northwestern.edu Tue Jun 2 20:02:40 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Tue Jun 2 20:03:04 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> References: <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> Message-ID: <932b2f1f0906021702k26bc6897h969df7d17c4f104b@mail.gmail.com> On Tue, Jun 2, 2009 at 5:37 PM, Matthias Felleisen wrote: > > This is an interesting error, and as a beginner I ran into this myself > (1984, probably february or march :-) > > I have not seen this kind of error since then, however. Before you invest > time, let's see how many people have had students who stumbled over this. This is one of those ones that is so hard to see, because the quote/quasiquote is so small and so far away that it seems to me it should only take a single example to consider some kind of fix (not necc. a whole reader, but something). Robby From pocmatos at gmail.com Tue Jun 2 20:10:16 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Jun 2 20:10:59 2009 Subject: [plt-scheme] Total Order on sets Message-ID: <11b141710906021710r4a715d3bta88be6f7113e9087@mail.gmail.com> Hi all, I am in the middle of a problem which is half mathematical, half scheming... I have three types of values to handle: integers, pairs of values and homogeneous sets of values so examples of values are: 1 (1 . 2) {1} {1, 2, 3} {(1 . 2), (1 . 3)} ({1,2} . {1,2}) I need to define a way to enumerate all the possible values just by knowing what kind of value it is... This seems to be equivalent has defining a total order on the values. I need an initial value and a next function that returns my next value. For integers the problem seems trivial, it consists in having a closure that keeps the current value and produces: Init = 0 Seq = 0, 1, -1, 2, -2, 3, -3 ... (let ([n 0]) (lambda () (cond [(= n 0) (set! n 1) n] [(> n 0) (set! n (+ n 1)) n] [else (set! n (+ (- n) 1)) n]))) For pairs, is more complicated but since we can assume the values of the pair have a total order: Init = (Init . Init) If to simplify we think of integers then we could draw a spiral in a 2d-axis by generating: (0 . 0), (1 . 0), (1 . 1), (0 . 1), (-1 . 1), (-1 . 0)... but the problem is that we have only a next function, not a previous so we can reduce everything to the first quadrant and do: (0 . 0), (1. 0), (0 . 1), (1 . 1), (2 . 0), (0 . 2), (2 . 1), (2 . 2), (1 . 2), ... And for each of these we intercalate with their counterparts on the other quadrants. However, this only seems to work for the case of numbers, not of pairs of sets since, there is not afaict, a counterpart in other quadrants. Now, set are even harder... It seems to be possible to do it by starting with the emptyset but I cannot tell a way to do it or implement it. One requirement is obviously in terms of sets of integers that it won't generate all sets with one element, then all with two elements and then all with 3 but that intercalates them all in the same sense that pairs of integers don't go: (0 . 0), (1 . 0), (2 . 0), (3 . 0)... (inf+ . 0) In regard to sets it would be good if the generator doesn't produce {1, 2} if it produced already {2, 1}, of course. If you have any idea on how to do this efficiently I would appreciate some input. Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From matthias at ccs.neu.edu Tue Jun 2 20:36:42 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Tue Jun 2 20:37:33 2009 Subject: [plt-scheme] Total Order on sets In-Reply-To: <11b141710906021710r4a715d3bta88be6f7113e9087@mail.gmail.com> References: <11b141710906021710r4a715d3bta88be6f7113e9087@mail.gmail.com> Message-ID: Here is an idea: #| Value is one of %% -- 'nat %% element of Nat -- (cons Value Value) %% pair of values -- (listof Value) %% setof values |# You can generate all possible shapes of a certain size or less if you ignore integers: 'nat, '(), (cons 'nat 'nat), (list 'nat), (list 'nat 'nat), (cons 'nat (cons 'nat 'nat)), (cons (cons 'nat 'nat) 'nat), ... Once you have all these shapes, you know that you can get all the elements of your class of data by replacing 'nat with integers, though you ,ay want to superimpose a uniqueness condition on the set representation. (Not needed, depending on how you look for and delete elements.) -- Matthias On Jun 2, 2009, at 8:10 PM, Paulo J. Matos wrote: > Hi all, > > I am in the middle of a problem which is half mathematical, half > scheming... > I have three types of values to handle: integers, pairs of values and > homogeneous sets of values so examples of values are: > 1 > (1 . 2) > {1} > {1, 2, 3} > {(1 . 2), (1 . 3)} > ({1,2} . {1,2}) > > > I need to define a way to enumerate all the possible values just by > knowing what kind of value it is... This seems to be equivalent has > defining a total order on the values. I need an initial value and a > next function that returns my next value. > > For integers the problem seems trivial, it consists in having a > closure that keeps the current value and produces: > Init = 0 > Seq = 0, 1, -1, 2, -2, 3, -3 ... > (let ([n 0]) > (lambda () > (cond [(= n 0) > (set! n 1) > n] > [(> n 0) > (set! n (+ n 1)) > n] > [else > (set! n (+ (- n) 1)) > n]))) > > For pairs, is more complicated but since we can assume the values of > the pair have a total order: > Init = (Init . Init) > > If to simplify we think of integers then we could draw a spiral in a > 2d-axis by generating: > (0 . 0), (1 . 0), (1 . 1), (0 . 1), (-1 . 1), (-1 . 0)... > > but the problem is that we have only a next function, not a previous > so we can reduce everything to the first quadrant and do: > (0 . 0), (1. 0), (0 . 1), (1 . 1), (2 . 0), (0 . 2), (2 . 1), (2 . 2), > (1 . 2), ... And for each of these we intercalate with their > counterparts on the other quadrants. > > However, this only seems to work for the case of numbers, not of pairs > of sets since, there is not afaict, a counterpart in other quadrants. > > Now, set are even harder... It seems to be possible to do it by > starting with the emptyset but I cannot tell a way to do it or > implement it. One requirement is obviously in terms of sets of > integers that it won't generate all sets with one element, then all > with two elements and then all with 3 but that intercalates them all > in the same sense that pairs of integers don't go: > (0 . 0), (1 . 0), (2 . 0), (3 . 0)... (inf+ . 0) > In regard to sets it would be good if the generator doesn't produce > {1, 2} if it produced already {2, 1}, of course. > > If you have any idea on how to do this efficiently I would appreciate > some input. > > Cheers, > > -- > Paulo Jorge Matos - pocmatos at gmail.com > http://www.pmatos.net > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From sk at cs.brown.edu Tue Jun 2 20:59:43 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Tue Jun 2 21:00:26 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: <904774730906021449u4d1222dm1633ee56af169520@mail.gmail.com> References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> <779bf2730906011211x1b622665r5acea2523a8a3045@mail.gmail.com> <18980.10863.548451.600306@winooski.ccs.neu.edu> <18980.61892.67525.128307@winooski.ccs.neu.edu> <20090602142941.GC23694@mantle.rutgers.edu> <18981.15519.148715.770669@winooski.ccs.neu.edu> <15AC064E-1F2A-4701-AB22-57E69259C8CE@adelphi.edu> <904774730906021449u4d1222dm1633ee56af169520@mail.gmail.com> Message-ID: Claw. On Tue, Jun 2, 2009 at 5:49 PM, Todd O'Bryan wrote: > When the only tool you have is a Dragon Book, everything looks like a .... > > I'm not sure how to finish that sentence, but I'm sure there's a > punchline in there somewhere. :-) > > On Tue, Jun 2, 2009 at 11:45 AM, Stephen Bloch wrote: >> >> On Jun 2, 2009, at 10:52 AM, Eli Barzilay wrote: >> >>> I think that a similar problem exists if someone reads the dragon book >>> (at least in the edition that I used) in an attempt to learn about >>> programming languages. >> >> Well, I already knew something about programming languages, but I read the >> dragon book the summer between high school and college to learn about >> compilers. ?It was pretty heavy going, and the Greek letters contributed to >> that, I have to admit :-) ?Two months later, in my first term in college, I >> was assigned to write a Roman-numeral-reading program. ?I wrote down a >> regular expression for Roman numerals, converted it by hand to a DFA, coded >> it in Pascal, and (since the dragon book hadn't said anything about >> attaching semantics to a DFA) made up a seat-of-the-pants way to add actions >> to compute the value of the Roman numeral. ?It was utterly incomprehensible, >> because all the states had integer names. ?The teaching assistant wrote on >> my printout "I'll assume this works...." >> >> Stephen Bloch >> sbloch@adelphi.edu >> >> >> >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From sbloch at adelphi.edu Tue Jun 2 23:45:30 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Tue Jun 2 23:46:32 2009 Subject: [plt-scheme] Re: Htdp chapter 12 insertion sort In-Reply-To: <73045cca0906021240y1606822dl9c86f4a32408fa73@mail.gmail.com> References: <73045cca0906012254y974c13fxc99daee1ccf5abec@mail.gmail.com> <9b1fff280906020447n6fc9fa43o89432cbe126fe7@mail.gmail.com> <67f9ebcd-b4f1-4bc4-8edd-a9f75e185dac@r13g2000vbr.googlegroups.com> <73045cca0906021240y1606822dl9c86f4a32408fa73@mail.gmail.com> Message-ID: On Jun 2, 2009, at 3:40 PM, aditya shukla wrote: > I thought there should be else in place of cons? and what's the use > of cons? here. One answer, as somebody else already said, is "the earlier you discover an error, the better." Another is that the cases "(empty? L)" and "(cons? L)" come directly from the data definition "a list is either empty or a cons". I prefer to use "else" only for "none of the above" situations, e.g. I want to respond in three different ways to three specific strings, and in a fourth way to "any other string". Yet another answer: if the questions in your cond-clauses are all mutually exclusive, they can be reordered without changing the correctness of the functions. If one of them might include another (e.g. "else" is equivalent to "true", which includes EVERYTHING), reordering the cond-clauses can break the program. Stephen Bloch sbloch@adelphi.edu From tomasz.skutnik at gmail.com Wed Jun 3 03:23:54 2009 From: tomasz.skutnik at gmail.com (Tomasz Skutnik) Date: Wed Jun 3 03:24:13 2009 Subject: [plt-scheme] Re: Style question In-Reply-To: <18981.36215.785959.900469@winooski.ccs.neu.edu> References: <8f7f1350-2735-416a-882b-7014db5ff228@x5g2000yqk.googlegroups.com> <4A21B4BB.6000901@ccs.neu.edu> <78c04168-dbee-48f0-98a9-4440b58d839d@h11g2000yqb.googlegroups.com> <18981.33229.855038.22018@winooski.ccs.neu.edu> <1195b3aa-dfe9-4eae-9a45-80e13b44af7a@r34g2000vba.googlegroups.com> <18981.36215.785959.900469@winooski.ccs.neu.edu> Message-ID: <533c96720906030023i97f6d95j358ad9f04f1f5cbf@mail.gmail.com> > > Well, if your concern is the end user, then the names that are used > internally are irrelevant. ?The debugging information is more > important to you, the author of the code, so in that sense it is even > better to get a "more correct" error message. ?In other words, if I > have this: > > ?#lang scheme > ?(provide foo) > ?(define (foo x) ...stuff...) > > then as the author, I can just as well change it to: > > ?#lang scheme > ?(provide foo) > ?(define (foo x) (bar x)) > ?(define (bar x) ...stuff...) > > without thinking about the fact that the tail call mean that now > errors will show `bar' -- the name is something that is relevant only > to me. ?In the same way, I think that there is no harm in > > ?#lang scheme > ?(provide (rename-out [create-foo make-foo])) > ?(define-struct foo (x y z)) > ?(define (create-foo ...) ... make-foo ...) > > since I could just as well do this: > > ?#lang scheme > ?(provide make-foo) > ?(define-struct internal-foo (x y z)) > ?(define (make-foo ...) ... make-internal-foo ...) > > There is a minor issue here with values printed as # > which is easily solved by either a custom writer, or some possible > future extension (which should really be implemented, IMO): > > ?#lang scheme > ?(provide make-foo) > ?(define-struct foo (x y z) #:constructor-name make-foo*) > ?(define (make-foo ...) ... make-foo* ...) > Thanks for clarification Eli. That expanded my understanding of the naming problem. However, as I see it, the main issue is not with error reporting during bug hunt (where "more correct" name is desirable). It's about signaling of missing keyword parameters on function invocation - which IMHO is rather common programming mistake. For me, the best option would be using procedure-rename, if it would retain keyword parameters. Otherwise, I'll stick with my original create-pool, because it's name/purpose is equally clear and error reporting is less conceptual burden for end-user (i.e. noticing at a glance what procedure is missing what parameters, even if that end-user is only me after 6 months into a project). Thanks anyway, all of you have been very helpful. Tomasz From noelwelsh at gmail.com Wed Jun 3 05:50:12 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Wed Jun 3 05:50:41 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: <904774730906020801k46a14d16hb08a58cc72ba69a0@mail.gmail.com> References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> <18979.56830.723396.281647@winooski.ccs.neu.edu> <779bf2730906011211x1b622665r5acea2523a8a3045@mail.gmail.com> <18980.10863.548451.600306@winooski.ccs.neu.edu> <904774730906020801k46a14d16hb08a58cc72ba69a0@mail.gmail.com> Message-ID: On Tue, Jun 2, 2009 at 4:01 PM, Todd O'Bryan wrote: > One of my computational linguistics professors said that the > statistical revolution of the 1990s was incredibly important, but he > worried that it was the result of competitive systems that encouraged > people to create something that worked, not necessarily something that > was based in good research. His view was that people had kind of hit a > wall and the field needed to go back to doing some basic research to > figure out how to get past the limitations people had hit. My opinion: Logic is very expressive but doesn't handle uncertainty Stats handles uncertainty but is not expressive (the most commonly used formalism is equivalent to propositional logic). The stats guys are slowly building more expressive representations. For example, various people are looking at first-order logic + probability. There are issues here that relate to PL. Current machine learning systems are built in matrix oriented languages like Matlab, with speed being a motivation. These languages make it hard to build complex systems (e.g. a type system doesn't help when, for example, every function is matrix -> matrix). Work like the Church system at MIT and Neil Toronto's work at BYU may provide the tools needed to build more expressive systems that have reasonable performance. N. From eli at barzilay.org Wed Jun 3 06:44:48 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Jun 3 06:45:11 2009 Subject: [plt-scheme] Re: Style question In-Reply-To: <533c96720906030023i97f6d95j358ad9f04f1f5cbf@mail.gmail.com> References: <8f7f1350-2735-416a-882b-7014db5ff228@x5g2000yqk.googlegroups.com> <4A21B4BB.6000901@ccs.neu.edu> <78c04168-dbee-48f0-98a9-4440b58d839d@h11g2000yqb.googlegroups.com> <18981.33229.855038.22018@winooski.ccs.neu.edu> <1195b3aa-dfe9-4eae-9a45-80e13b44af7a@r34g2000vba.googlegroups.com> <18981.36215.785959.900469@winooski.ccs.neu.edu> <533c96720906030023i97f6d95j358ad9f04f1f5cbf@mail.gmail.com> Message-ID: <18982.21536.975658.665408@winooski.ccs.neu.edu> On Jun 3, Tomasz Skutnik wrote: > > Thanks for clarification Eli. That expanded my understanding of the > naming problem. However, as I see it, the main issue is not with > error reporting during bug hunt (where "more correct" name is > desirable). It's about signaling of missing keyword parameters on > function invocation - which IMHO is rather common programming > mistake. Well, if you do what I suggested: > > ?#lang scheme > > ?(provide make-foo) > > ?(define-struct internal-foo (x y z)) > > ?(define (make-foo ...) ... make-internal-foo ...) then the error reports *will* talk about `make-foo'. > For me, the best option would be using procedure-rename, if it would > retain keyword parameters. [...] I think that the purpose of `procedure-rename' is unclear in this thread. Its intention is as a tool where the name is determined at run-time -- if you want to use a different name for your function definition, then this was always possible. Here's an easy way to do it: (define foo (let ([bar (lambda (x) x)]) bar)) or a possibly more convenient form: (define foo (let () (define (bar x) x) bar)) and it's easy to make a macro out of all of this: (define-syntax-rule (define/renamed external-name (internal-name . args) body ...) (define internal-name (let () (define (external-name . args) body ...) external-name))) or even directly provide the renamed version, and skip the internal name completely (making it inaccessible within the defining module): (define-syntax-rule (define/provide (external-name . args) body ...) (begin (define hidden-name (let () (define (external-name . args) body ...) external-name)) (provide (rename-out [hidden-name external-name])))) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From sbloch at adelphi.edu Tue Jun 2 23:45:30 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Wed Jun 3 06:48:41 2009 Subject: [plt-scheme] Re: Htdp chapter 12 insertion sort In-Reply-To: <73045cca0906021240y1606822dl9c86f4a32408fa73@mail.gmail.com> References: <73045cca0906012254y974c13fxc99daee1ccf5abec@mail.gmail.com> <9b1fff280906020447n6fc9fa43o89432cbe126fe7@mail.gmail.com> <67f9ebcd-b4f1-4bc4-8edd-a9f75e185dac@r13g2000vbr.googlegroups.com> <73045cca0906021240y1606822dl9c86f4a32408fa73@mail.gmail.com> Message-ID: On Jun 2, 2009, at 3:40 PM, aditya shukla wrote: > I thought there should be else in place of cons? and what's the use > of cons? here. One answer, as somebody else already said, is "the earlier you discover an error, the better." Another is that the cases "(empty? L)" and "(cons? L)" come directly from the data definition "a list is either empty or a cons". I prefer to use "else" only for "none of the above" situations, e.g. I want to respond in three different ways to three specific strings, and in a fourth way to "any other string". Yet another answer: if the questions in your cond-clauses are all mutually exclusive, they can be reordered without changing the correctness of the functions. If one of them might include another (e.g. "else" is equivalent to "true", which includes EVERYTHING), reordering the cond-clauses can break the program. Stephen Bloch sbloch@adelphi.edu From sbloch at adelphi.edu Wed Jun 3 10:17:17 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Wed Jun 3 10:17:37 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: <4A5D06CE-3A1C-4050-8E7A-47F3B46EF912@ccs.neu.edu> References: <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> <4A25B287.6080906@ccs.neu.edu> <4A5D06CE-3A1C-4050-8E7A-47F3B46EF912@ccs.neu.edu> Message-ID: > On Jun 2, 2009, at 7:15 PM, David Van Horn wrote: >> I frequently use the pattern >> >> #; >> (define (f x) ...) >> >> in student language programs. It preserves the indentation of the >> definition and this program should be acceptable, IMO. Umm... I didn't know about that one. Cool! That goes into the textbook.... Stephen Bloch sbloch@adelphi.edu From pocmatos at gmail.com Wed Jun 3 10:37:02 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Wed Jun 3 10:37:45 2009 Subject: [plt-scheme] Total Order on sets In-Reply-To: References: <11b141710906021710r4a715d3bta88be6f7113e9087@mail.gmail.com> Message-ID: <11b141710906030737q17f7034dhcccbebb87f7a3f3d@mail.gmail.com> On Wed, Jun 3, 2009 at 1:36 AM, Matthias Felleisen wrote: > > Here is an idea: > > #| > ?Value is one of ? ? ? ? ? ? %% > ?-- 'nat ? ? ? ? ? ? ? ? ? ?%% element of Nat > ?-- (cons Value Value) ? ? ?%% pair of values > ?-- (listof Value) ? ? ? ? ?%% setof values > |# > Hi Matthias, Thanks for the input but I guess I missed something. > You can generate all possible shapes of a certain size or less Not all shapes are possible. In fact sets are homogeneous so we can't have (listof (cons 1 2) 3). > if you ignore integers: > > ?'nat, '(), (cons 'nat 'nat), (list 'nat), (list 'nat 'nat), (cons 'nat > (cons 'nat 'nat)), (cons (cons 'nat 'nat) 'nat), ... > > Once you have all these shapes, you know that you can get all the elements > of your class of data by replacing 'nat with integers, though you ,ay want > to superimpose a uniqueness condition on the set representation. (Not > needed, depending on how you look for and delete elements.) > The problem is basically that I given a specification of the value: (cons (setof 'nat) 'nat) I need to generate a total order for the values of this type (pairs where the car is a set of integers and the cdr a nat). This seems to be intrinsically recursive where I assume that I have define total orders for the elements of the pair and I start the total order for the pair with the initial elements of the total order of its parts: (cons (set) 0), where (set) is the emptyset. The problem is always to know which should be the next element given the current one assuring that: - all elements are covered; - and there is enough 'dispersity' of data (don't really know how to put it) but I mean that when enumerating integers I cannot try to enumerate first all the positives and then all the negatives. Same with pairs, I cannot enumerate all the the pairs with the first element and then all the pairs with the second elements because i would never get there. With sets the same applies, I cannot enumerate all the sets with one element first. I need somehow to intersperse all this... Is this even theoretically possible? > -- Matthias > > > > > > On Jun 2, 2009, at 8:10 PM, Paulo J. Matos wrote: > >> Hi all, >> >> I am in the middle of a problem which is half mathematical, half >> scheming... >> I have three types of values to handle: integers, pairs of values and >> homogeneous sets of values so examples of values are: >> 1 >> (1 . 2) >> {1} >> {1, 2, 3} >> {(1 . 2), (1 . 3)} >> ({1,2} . {1,2}) >> >> >> I need to define a way to enumerate all the possible values just by >> knowing what kind of value it is... This seems to be equivalent has >> defining a total order on the values. I need an initial value and a >> next function that returns my next value. >> >> For integers the problem seems trivial, it consists in having a >> closure that keeps the current value and produces: >> Init = 0 >> Seq = 0, 1, -1, 2, -2, 3, -3 ... >> (let ([n 0]) >> ? ? ? ? ? (lambda () >> ? ? ? ? ? ? (cond [(= n 0) >> ? ? ? ? ? ? ? ? ? ?(set! n 1) >> ? ? ? ? ? ? ? ? ? ?n] >> ? ? ? ? ? ? ? ? ? [(> n 0) >> ? ? ? ? ? ? ? ? ? ?(set! n (+ n 1)) >> ? ? ? ? ? ? ? ? ? ?n] >> ? ? ? ? ? ? ? ? ? [else >> ? ? ? ? ? ? ? ? ? ?(set! n (+ (- n) 1)) >> ? ? ? ? ? ? ? ? ? ?n]))) >> >> For pairs, is more complicated but since we can assume the values of >> the pair have a total order: >> Init = (Init . Init) >> >> If to simplify we think of integers then we could draw a spiral in a >> 2d-axis by generating: >> (0 . 0), (1 . 0), (1 . 1), (0 . 1), (-1 . 1), (-1 . 0)... >> >> but the problem is that we have only a next function, not a previous >> so we can reduce everything to the first quadrant and do: >> (0 . 0), (1. 0), (0 . 1), (1 . 1), (2 . 0), (0 . 2), (2 . 1), (2 . 2), >> (1 . 2), ... And for each of these we intercalate with their >> counterparts on the other quadrants. >> >> However, this only seems to work for the case of numbers, not of pairs >> of sets since, there is not afaict, a counterpart in other quadrants. >> >> Now, set are even harder... It seems to be possible to do it by >> starting with the emptyset but I cannot tell a way to do it or >> implement it. One requirement is obviously in terms of sets of >> integers that it won't generate all sets with one element, then all >> with two elements and then all with 3 but that intercalates them all >> in the same sense that pairs of integers don't go: >> (0 . 0), (1 . 0), (2 . 0), (3 . 0)... (inf+ . 0) >> In regard to sets it would be good if the generator doesn't produce >> {1, 2} if it produced already {2, 1}, of course. >> >> If you have any idea on how to do this efficiently I would appreciate >> some input. >> >> Cheers, >> >> -- >> Paulo Jorge Matos - pocmatos at gmail.com >> http://www.pmatos.net >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From pltscheme at pnkfx.org Wed Jun 3 10:40:22 2009 From: pltscheme at pnkfx.org (Felix Klock's PLT scheme proxy) Date: Wed Jun 3 10:40:46 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> References: <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> Message-ID: <792494C1-A51C-4FB8-BF98-A83ACC55BD59@pnkfx.org> Matthias (cc'ing other participants)- On Jun 2, 2009, at 6:37 PM, Matthias Felleisen wrote: > This is an interesting error, and as a beginner I ran into this > myself (1984, probably february or march :-) > > I have not seen this kind of error since then, however. Before you > invest time, let's see how many people have had students who > stumbled over this. I have had masters students run into it. I believe I have seen undergraduates encounter it too. -Felix Klock From matthias at ccs.neu.edu Wed Jun 3 10:41:24 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Wed Jun 3 10:42:42 2009 Subject: [plt-scheme] Total Order on sets In-Reply-To: <11b141710906030737q17f7034dhcccbebb87f7a3f3d@mail.gmail.com> References: <11b141710906021710r4a715d3bta88be6f7113e9087@mail.gmail.com> <11b141710906030737q17f7034dhcccbebb87f7a3f3d@mail.gmail.com> Message-ID: Oops, I missed the homogeneous. If you can encode the sets you could use one of the numerous enumerations for pairs that domain theoreticians (for example) employ. -- Matthias On Jun 3, 2009, at 10:37 AM, Paulo J. Matos wrote: > On Wed, Jun 3, 2009 at 1:36 AM, Matthias Felleisen > wrote: >> >> Here is an idea: >> >> #| >> Value is one of %% >> -- 'nat %% element of Nat >> -- (cons Value Value) %% pair of values >> -- (listof Value) %% setof values >> |# >> > > Hi Matthias, > > Thanks for the input but I guess I missed something. > >> You can generate all possible shapes of a certain size or less > > Not all shapes are possible. In fact sets are homogeneous so we can't > have (listof (cons 1 2) 3). > >> if you ignore integers: >> >> 'nat, '(), (cons 'nat 'nat), (list 'nat), (list 'nat 'nat), (cons >> 'nat >> (cons 'nat 'nat)), (cons (cons 'nat 'nat) 'nat), ... >> >> Once you have all these shapes, you know that you can get all the >> elements >> of your class of data by replacing 'nat with integers, though >> you ,ay want >> to superimpose a uniqueness condition on the set representation. (Not >> needed, depending on how you look for and delete elements.) >> > > The problem is basically that I given a specification of the value: > (cons (setof 'nat) 'nat) I need to generate a total order for the > values of this type (pairs where the car is a set of integers and the > cdr a nat). > This seems to be intrinsically recursive where I assume that I have > define total orders for the elements of the pair and I start the total > order for the pair with the initial elements of the total order of its > parts: (cons (set) 0), where (set) is the emptyset. > The problem is always to know which should be the next element given > the current one assuring that: > - all elements are covered; > - and there is enough 'dispersity' of data (don't really know how to > put it) but I mean that when enumerating integers I cannot try to > enumerate first all the positives and then all the negatives. Same > with pairs, I cannot enumerate all the the pairs with the first > element and then all the pairs with the second elements because i > would never get there. With sets the same applies, I cannot enumerate > all the sets with one element first. I need somehow to intersperse all > this... > > Is this even theoretically possible? > > >> -- Matthias >> >> >> >> >> >> On Jun 2, 2009, at 8:10 PM, Paulo J. Matos wrote: >> >>> Hi all, >>> >>> I am in the middle of a problem which is half mathematical, half >>> scheming... >>> I have three types of values to handle: integers, pairs of values >>> and >>> homogeneous sets of values so examples of values are: >>> 1 >>> (1 . 2) >>> {1} >>> {1, 2, 3} >>> {(1 . 2), (1 . 3)} >>> ({1,2} . {1,2}) >>> >>> >>> I need to define a way to enumerate all the possible values just by >>> knowing what kind of value it is... This seems to be equivalent has >>> defining a total order on the values. I need an initial value and a >>> next function that returns my next value. >>> >>> For integers the problem seems trivial, it consists in having a >>> closure that keeps the current value and produces: >>> Init = 0 >>> Seq = 0, 1, -1, 2, -2, 3, -3 ... >>> (let ([n 0]) >>> (lambda () >>> (cond [(= n 0) >>> (set! n 1) >>> n] >>> [(> n 0) >>> (set! n (+ n 1)) >>> n] >>> [else >>> (set! n (+ (- n) 1)) >>> n]))) >>> >>> For pairs, is more complicated but since we can assume the values of >>> the pair have a total order: >>> Init = (Init . Init) >>> >>> If to simplify we think of integers then we could draw a spiral in a >>> 2d-axis by generating: >>> (0 . 0), (1 . 0), (1 . 1), (0 . 1), (-1 . 1), (-1 . 0)... >>> >>> but the problem is that we have only a next function, not a previous >>> so we can reduce everything to the first quadrant and do: >>> (0 . 0), (1. 0), (0 . 1), (1 . 1), (2 . 0), (0 . 2), (2 . 1), >>> (2 . 2), >>> (1 . 2), ... And for each of these we intercalate with their >>> counterparts on the other quadrants. >>> >>> However, this only seems to work for the case of numbers, not of >>> pairs >>> of sets since, there is not afaict, a counterpart in other >>> quadrants. >>> >>> Now, set are even harder... It seems to be possible to do it by >>> starting with the emptyset but I cannot tell a way to do it or >>> implement it. One requirement is obviously in terms of sets of >>> integers that it won't generate all sets with one element, then all >>> with two elements and then all with 3 but that intercalates them all >>> in the same sense that pairs of integers don't go: >>> (0 . 0), (1 . 0), (2 . 0), (3 . 0)... (inf+ . 0) >>> In regard to sets it would be good if the generator doesn't produce >>> {1, 2} if it produced already {2, 1}, of course. >>> >>> If you have any idea on how to do this efficiently I would >>> appreciate >>> some input. >>> >>> Cheers, >>> >>> -- >>> Paulo Jorge Matos - pocmatos at gmail.com >>> http://www.pmatos.net >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> > > > > -- > Paulo Jorge Matos - pocmatos at gmail.com > http://www.pmatos.net From pocmatos at gmail.com Wed Jun 3 10:45:59 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Wed Jun 3 10:46:42 2009 Subject: [plt-scheme] Total Order on sets In-Reply-To: References: <11b141710906021710r4a715d3bta88be6f7113e9087@mail.gmail.com> <11b141710906030737q17f7034dhcccbebb87f7a3f3d@mail.gmail.com> Message-ID: <11b141710906030745n29e86b4ax15e66d8b9e46b558@mail.gmail.com> On Wed, Jun 3, 2009 at 3:41 PM, Matthias Felleisen wrote: > > Oops, I missed the homogeneous. > > If you can encode the sets you could use one of the numerous enumerations > for pairs that domain theoreticians (for example) employ. > By encoding the sets you mean, encoding it as lists, right [a pair where the second element is a pair or null]? Paulo Matos > -- Matthias > > > > On Jun 3, 2009, at 10:37 AM, Paulo J. Matos wrote: > >> On Wed, Jun 3, 2009 at 1:36 AM, Matthias Felleisen >> wrote: >>> >>> Here is an idea: >>> >>> #| >>> ?Value is one of ? ? ? ? ? ? %% >>> ?-- 'nat ? ? ? ? ? ? ? ? ? ?%% element of Nat >>> ?-- (cons Value Value) ? ? ?%% pair of values >>> ?-- (listof Value) ? ? ? ? ?%% setof values >>> |# >>> >> >> Hi Matthias, >> >> Thanks for the input but I guess I missed something. >> >>> You can generate all possible shapes of a certain size or less >> >> Not all shapes are possible. In fact sets are homogeneous so we can't >> have (listof (cons 1 2) 3). >> >>> if you ignore integers: >>> >>> ?'nat, '(), (cons 'nat 'nat), (list 'nat), (list 'nat 'nat), (cons 'nat >>> (cons 'nat 'nat)), (cons (cons 'nat 'nat) 'nat), ... >>> >>> Once you have all these shapes, you know that you can get all the >>> elements >>> of your class of data by replacing 'nat with integers, though you ,ay >>> want >>> to superimpose a uniqueness condition on the set representation. (Not >>> needed, depending on how you look for and delete elements.) >>> >> >> The problem is basically that I given a specification of the value: >> (cons (setof 'nat) 'nat) I need to generate a total order for the >> values of this type (pairs where the car is a set of integers and the >> cdr a nat). >> This seems to be intrinsically recursive where I assume that I have >> define total orders for the elements of the pair and I start the total >> order for the pair with the initial elements of the total order of its >> parts: (cons (set) 0), where (set) is the emptyset. >> The problem is always to know which should be the next element given >> the current one assuring that: >> - all elements are covered; >> - and there is enough 'dispersity' of data (don't really know how to >> put it) but I mean that when enumerating integers I cannot try to >> enumerate first all the positives and then all the negatives. Same >> with pairs, I cannot enumerate all the the pairs with the first >> element and then all the pairs with the second elements because i >> would never get there. With sets the same applies, I cannot enumerate >> all the sets with one element first. I need somehow to intersperse all >> this... >> >> Is this even theoretically possible? >> >> >>> -- Matthias >>> >>> >>> >>> >>> >>> On Jun 2, 2009, at 8:10 PM, Paulo J. Matos wrote: >>> >>>> Hi all, >>>> >>>> I am in the middle of a problem which is half mathematical, half >>>> scheming... >>>> I have three types of values to handle: integers, pairs of values and >>>> homogeneous sets of values so examples of values are: >>>> 1 >>>> (1 . 2) >>>> {1} >>>> {1, 2, 3} >>>> {(1 . 2), (1 . 3)} >>>> ({1,2} . {1,2}) >>>> >>>> >>>> I need to define a way to enumerate all the possible values just by >>>> knowing what kind of value it is... This seems to be equivalent has >>>> defining a total order on the values. I need an initial value and a >>>> next function that returns my next value. >>>> >>>> For integers the problem seems trivial, it consists in having a >>>> closure that keeps the current value and produces: >>>> Init = 0 >>>> Seq = 0, 1, -1, 2, -2, 3, -3 ... >>>> (let ([n 0]) >>>> ? ? ? ? ?(lambda () >>>> ? ? ? ? ? ?(cond [(= n 0) >>>> ? ? ? ? ? ? ? ? ? (set! n 1) >>>> ? ? ? ? ? ? ? ? ? n] >>>> ? ? ? ? ? ? ? ? ?[(> n 0) >>>> ? ? ? ? ? ? ? ? ? (set! n (+ n 1)) >>>> ? ? ? ? ? ? ? ? ? n] >>>> ? ? ? ? ? ? ? ? ?[else >>>> ? ? ? ? ? ? ? ? ? (set! n (+ (- n) 1)) >>>> ? ? ? ? ? ? ? ? ? n]))) >>>> >>>> For pairs, is more complicated but since we can assume the values of >>>> the pair have a total order: >>>> Init = (Init . Init) >>>> >>>> If to simplify we think of integers then we could draw a spiral in a >>>> 2d-axis by generating: >>>> (0 . 0), (1 . 0), (1 . 1), (0 . 1), (-1 . 1), (-1 . 0)... >>>> >>>> but the problem is that we have only a next function, not a previous >>>> so we can reduce everything to the first quadrant and do: >>>> (0 . 0), (1. 0), (0 . 1), (1 . 1), (2 . 0), (0 . 2), (2 . 1), (2 . 2), >>>> (1 . 2), ... And for each of these we intercalate with their >>>> counterparts on the other quadrants. >>>> >>>> However, this only seems to work for the case of numbers, not of pairs >>>> of sets since, there is not afaict, a counterpart in other quadrants. >>>> >>>> Now, set are even harder... It seems to be possible to do it by >>>> starting with the emptyset but I cannot tell a way to do it or >>>> implement it. One requirement is obviously in terms of sets of >>>> integers that it won't generate all sets with one element, then all >>>> with two elements and then all with 3 but that intercalates them all >>>> in the same sense that pairs of integers don't go: >>>> (0 . 0), (1 . 0), (2 . 0), (3 . 0)... (inf+ . 0) >>>> In regard to sets it would be good if the generator doesn't produce >>>> {1, 2} if it produced already {2, 1}, of course. >>>> >>>> If you have any idea on how to do this efficiently I would appreciate >>>> some input. >>>> >>>> Cheers, >>>> >>>> -- >>>> Paulo Jorge Matos - pocmatos at gmail.com >>>> http://www.pmatos.net >>>> _________________________________________________ >>>> ?For list-related administrative tasks: >>>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >>> >> >> >> >> -- >> Paulo Jorge Matos - pocmatos at gmail.com >> http://www.pmatos.net > > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From pltscheme at pnkfx.org Wed Jun 3 11:25:24 2009 From: pltscheme at pnkfx.org (Felix Klock's PLT scheme proxy) Date: Wed Jun 3 11:25:46 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: <4A25B287.6080906@ccs.neu.edu> References: <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> <4A25B287.6080906@ccs.neu.edu> Message-ID: David (cc'ing other parcipants)- On Jun 2, 2009, at 7:15 PM, David Van Horn wrote: > Carl Eastlund wrote: >> I have had students run into the same problem with #; comments, >> that a >> #; before whitespace or another comment could be forgotten. I think >> all of the s-expression-eating reader forms should have the "no >> whitespace/comment" restriction in the student languages. > > I frequently use the pattern > > #; > (define (f x) ...) > > in student language programs. It preserves the indentation of the > definition and this program should be acceptable, IMO. I think a reasonable middle-ground that would catch the majority of the cases would be that no *comments* should split a { ` ' #; } from the s-exp it is acting on, but white space is allowed. That is, when there is just a (potentially large) swath of whitespace separating the two, then is usually not so hard to puzzle out the problem. The times that I have been flummoxed by this (as in when I have been looking over students' shoulders and been mystified) is when the students have written a huge block of comments before their function, and then at the very top comment they have an accidentally typed: `;; This is our great code. ;;; We spent twenty-six hour debugging ;;; and we do not know what is wrong and ;;; why we cannot run our function and ;;; we are very tired. ;;; ;;; ... or #;; This is our great code. ;;; ... This kind of thing is much harder to spot. (The first case is the one that I have actually run into in practice; I have not seen the second in the wild.) -Felix Klock From eli at barzilay.org Wed Jun 3 11:40:10 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Jun 3 11:40:31 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: References: <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> <4A25B287.6080906@ccs.neu.edu> Message-ID: <18982.39258.448744.582220@winooski.ccs.neu.edu> On Jun 3, Felix Klock's PLT scheme proxy wrote: > [...] I find it hard to justify either comments or whitespace after quotes etc even in "hacker mode" -- the only reason would be to conveniently comment out an expression, which is redundant when there's `#;' now. But: > #;; This is our great code. > ;;; ... I *do* find mixing comments useful -- either `;' in a `#;' or the other way. For example: (define (foo x) ...) #; ; this definition doesn't work because blah blah blah (define (foo x) ...) and: (define (foo x) #; (printf "foo(~s)\n" x) ...) which makes it easy to enable the debugging output with a single `;': (define (foo x) ;#; (printf "foo(~s)\n" x) ...) and it works with multiple expressions too: (define (foo x) ;#;#; (printf "foo\n") (printf " x = ~s\n" x) ...) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From plragde at uwaterloo.ca Wed Jun 3 11:49:39 2009 From: plragde at uwaterloo.ca (Prabhakar Ragde) Date: Wed Jun 3 11:50:07 2009 Subject: [plt-scheme] Total Order on sets In-Reply-To: <11b141710906030737q17f7034dhcccbebb87f7a3f3d@mail.gmail.com> Message-ID: <4A269B93.5030809@uwaterloo.ca> Paulo wrote: > Is this even theoretically possible? It's certainly theoretically possible, but there's a tradeoff between space and time. I thought of a solution which might be reasonable, but may not be optimal. Suppose you want all pairs generated by two iterators (one for the first dimension and one for the second). The state will be the iterator for the first dimension and an integer representing the number of times it's been applied. To generate pairs, apply the first-dimension iterator and then start the second-dimension iterator from scratch and apply it as many times as you've applied the first one, outputting all pairs along the way. If the iterator are on integers, this results in (0,0) (1,0) (1,1) (2,0) (2,1) (2,2) It's not hard to see how to generate the missing triangle separately. Then intersperse the two to get all pairs. This generalizes to k dimensions. The space required is for one entry in each dimension, plus k integers. To generate all tuples of any length, apply 1D, 2D, 3D, 4D... iterators in this pattern: 1 - 1 2 - 1 2 3 - 1 2 3 4 ... The space required is the square of the maximum dimension reached. You can probably get this down to linear in the maximum dimension reached. It might even be possible to do better -- I bet this is a well-studied problem. For sets, all the iterators are the same, and you don't want to generate any tuple where a later entry has "index" smaller than an earlier entry. Not too hard to see how to do that with the triangle idea above. Of course, you probably have other considerations as well -- some orders are better than others, and may lead to nicer implementations. But it is certainly doable. --PR From pltscheme at pnkfx.org Wed Jun 3 11:48:12 2009 From: pltscheme at pnkfx.org (Felix Klock's PLT scheme proxy) Date: Wed Jun 3 11:53:55 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: <18982.39258.448744.582220@winooski.ccs.neu.edu> References: <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> <4A25B287.6080906@ccs.neu.edu> <18982.39258.448744.582220@winooski.ccs.neu.edu> Message-ID: Eli (cc'ing plt-scheme)- On Jun 3, 2009, at 11:40 AM, Eli Barzilay wrote: > ... > and it works with multiple expressions too: > > (define (foo x) > ;#;#; > (printf "foo\n") > (printf " x = ~s\n" x) > ...) I find the amount of time my brain needs to lex and parse this to be an argument *for* the rule I suggested (which disallows the #;#; pattern). Do you really think the #;#; pattern is that useful, compared to the alternative below (which is compatible with the rule I suggested): (define (foo x) ;#; (begin (printf "foo\n") (printf " x = ~s\n" x)) ...) -Felix From sbloch at adelphi.edu Wed Jun 3 11:59:59 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Wed Jun 3 12:00:24 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: <18982.39258.448744.582220@winooski.ccs.neu.edu> References: <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> <4A25B287.6080906@ccs.neu.edu> <18982.39258.448744.582220@winooski.ccs.neu.edu> Message-ID: <7F1012FB-71E1-4430-875B-5A19A8563227@adelphi.edu> On Jun 3, 2009, at 11:40 AM, Eli Barzilay wrote: > On Jun 3, Felix Klock's PLT scheme proxy wrote: >> [...] > > I find it hard to justify either comments or whitespace after quotes > etc even in "hacker mode" -- the only reason would be to conveniently > comment out an expression, which is redundant when there's `#;' now. Eli, you're quite right for comments or whitespace immediately after an INTENTIONAL quote. But it's really easy to type a quote or a backquote accidentally and not notice it because it's only a few pixels, and possibly many lines away from the code you're paying attention to. As I understand it, the student problems that triggered this thread were exactly such typoes. I'm reminded of a similar bug I ran into in college: I was writing in Pascal, compiling and running on an IBM mainframe, and about twenty lines of my program were mysteriously not happening. It turned out that I had a comment whose closing delimiter was in character positions 73-74 of the line, and since the compiler had originally been written to work with punch cards, it reserved character positions 73-80 for card serial numbers. So it blithely kept commenting for the next twenty lines until it saw a close-comment delimiter in the part of the line that it liked. > But: > >> #;; This is our great code. >> ;;; ... > > I *do* find mixing comments useful -- either `;' in a `#;' or the > other way. For example: I've been using #| (define (function-for-lon numbers) ; numbers lon (cond [(empty? numbers) ...] [(cons? numbers) ; numbers nelon ; (first numbers) number ; (rest numbers) lon ; (function-for-lon (rest numbers)) whatever ... ) |# in my textbook. The idea is that you can copy-and-paste the stuff between the #|...|# every time you want to write a new function on lists of numbers, and it comes complete with commented-out inventory. Now that I know about #;, I think I have some rewriting to do.... Stephen Bloch sbloch@adelphi.edu From eli at barzilay.org Wed Jun 3 12:04:30 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Jun 3 12:04:54 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: References: <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> <4A25B287.6080906@ccs.neu.edu> <18982.39258.448744.582220@winooski.ccs.neu.edu> Message-ID: <18982.40718.457572.514388@winooski.ccs.neu.edu> On Jun 3, Felix Klock's PLT scheme proxy wrote: > Eli (cc'ing plt-scheme)- > > On Jun 3, 2009, at 11:40 AM, Eli Barzilay wrote: > > > ... > > and it works with multiple expressions too: > > > > (define (foo x) > > ;#;#; > > (printf "foo\n") > > (printf " x = ~s\n" x) > > ...) > > I find the amount of time my brain needs to lex and parse this to be > an argument *for* the rule I suggested (which disallows the #;#; > pattern). Strange. All you need is to look at the single `;' that starts the line and ignore it. > Do you really think the #;#; pattern is that useful, compared to the > alternative below (which is compatible with the rule I suggested): > > (define (foo x) > ;#; > (begin > (printf "foo\n") > (printf " x = ~s\n" x)) > ...) Yes I do. But that's irrelevant to the utility of composing `;' and `#;'. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From eli at barzilay.org Wed Jun 3 12:09:20 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Jun 3 12:09:42 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: <7F1012FB-71E1-4430-875B-5A19A8563227@adelphi.edu> References: <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> <4A25B287.6080906@ccs.neu.edu> <18982.39258.448744.582220@winooski.ccs.neu.edu> <7F1012FB-71E1-4430-875B-5A19A8563227@adelphi.edu> Message-ID: <18982.41008.885756.284846@winooski.ccs.neu.edu> On Jun 3, Stephen Bloch wrote: > > On Jun 3, 2009, at 11:40 AM, Eli Barzilay wrote: > > > On Jun 3, Felix Klock's PLT scheme proxy wrote: > >> [...] > > > > I find it hard to justify either comments or whitespace after quotes > > etc even in "hacker mode" -- the only reason would be to conveniently > > comment out an expression, which is redundant when there's `#;' now. > > Eli, you're quite right for comments or whitespace immediately after > an INTENTIONAL quote. But it's really easy to type a quote or a > backquote accidentally and not notice it because it's only a few > pixels, and possibly many lines away from the code you're paying > attention to. As I understand it, the student problems that > triggered this thread were exactly such typoes. To clarify: I *agree* with this. I meant that I don't think that much harm will done if no whitespace or comments are allowed after quotations even in the usual language. Even at the technical level, at least on a conventional keyboard it's easy to hit a single quote instead of a semicolon and end up with: '; foo ;; bar and the resulting typo is difficult to see. (But these points don't apply to `#;'.) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From pltscheme at pnkfx.org Wed Jun 3 12:12:34 2009 From: pltscheme at pnkfx.org (Felix Klock's PLT scheme proxy) Date: Wed Jun 3 12:12:59 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: <18982.40718.457572.514388@winooski.ccs.neu.edu> References: <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> <4A25B287.6080906@ccs.neu.edu> <18982.39258.448744.582220@winooski.ccs.neu.edu> <18982.40718.457572.514388@winooski.ccs.neu.edu> Message-ID: <179C8187-C38C-4BC9-B7A9-18159A5121C2@pnkfx.org> Eli- On Jun 3, 2009, at 12:04 PM, Eli Barzilay wrote: > On Jun 3, Felix Klock's PLT scheme proxy wrote: >> >> On Jun 3, 2009, at 11:40 AM, Eli Barzilay wrote: >> >>> ... >>> and it works with multiple expressions too: >>> >>> (define (foo x) >>> ;#;#; >>> (printf "foo\n") >>> (printf " x = ~s\n" x) >>> ...) >> >> I find the amount of time my brain needs to lex and parse this to be >> an argument *for* the rule I suggested (which disallows the #;#; >> pattern). > > Strange. All you need is to look at the single `;' that starts the > line and ignore it. Okay, if my email client had source code highlighting (as DrScheme does), I probably would have discarded the ";#;#;" as well and not thought twice about it. The real problem for me is whether the "#;#;" pattern should be considered good practice. That is the core of what I was objecting to. Sam has pointed out to me that my preferred form (wrapping the sexp's in a begin and using a single "#;") would not work for when he comments out multiple cond clauses via repeated "#;". So I do not have a solution that would work in all cases; but repeated "#;" still strikes me as having a bad code smell, especially for Student Language code. -Felix From eli at barzilay.org Wed Jun 3 12:26:03 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Jun 3 12:26:25 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: <179C8187-C38C-4BC9-B7A9-18159A5121C2@pnkfx.org> References: <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> <4A25B287.6080906@ccs.neu.edu> <18982.39258.448744.582220@winooski.ccs.neu.edu> <18982.40718.457572.514388@winooski.ccs.neu.edu> <179C8187-C38C-4BC9-B7A9-18159A5121C2@pnkfx.org> Message-ID: <18982.42011.698481.886262@winooski.ccs.neu.edu> On Jun 3, Felix Klock's PLT scheme proxy wrote: > Eli- > > On Jun 3, 2009, at 12:04 PM, Eli Barzilay wrote: > > > On Jun 3, Felix Klock's PLT scheme proxy wrote: > >> > >> On Jun 3, 2009, at 11:40 AM, Eli Barzilay wrote: > >> > >>> ... > >>> and it works with multiple expressions too: > >>> > >>> (define (foo x) > >>> ;#;#; > >>> (printf "foo\n") > >>> (printf " x = ~s\n" x) > >>> ...) > >> > >> I find the amount of time my brain needs to lex and parse this to be > >> an argument *for* the rule I suggested (which disallows the #;#; > >> pattern). > > > > Strange. All you need is to look at the single `;' that starts the > > line and ignore it. > > Okay, if my email client had source code highlighting (as DrScheme > does), I probably would have discarded the ";#;#;" as well and not > thought twice about it. I don't think that it's difficult even without highlighting. The question is whether there's a simple set of rules that you use when you read the line. In this case, if your line is made of just `#;'s and `;'s, then all you need is to count `#;'s and stop at the first `;', the count is the number of following expressions to ignore. It's even simpler than a line with `#;('. > The real problem for me is whether the "#;#;" pattern should be > considered good practice. That is the core of what I was objecting > to. I don't see any big deal here -- `#;' ignores the next sexpr, and `#;#;' ignores the next two sexprs. But that's still irrelevant to the point of the thread. (As I wrote in the other reply, it's also much less likely to write this by accident.) > Sam has pointed out to me that my preferred form (wrapping the > sexp's in a begin and using a single "#;") would not work for when > he comments out multiple cond clauses via repeated "#;". It doesn't work for any context that is not an expression. (In the same way that '(begin ...) was bad back before `#;'.) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From clements at brinckerhoff.org Wed Jun 3 12:44:14 2009 From: clements at brinckerhoff.org (John Clements) Date: Wed Jun 3 12:46:43 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: <18982.39258.448744.582220@winooski.ccs.neu.edu> References: <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> <4A25B287.6080906@ccs.neu.edu> <18982.39258.448744.582220@winooski.ccs.neu.edu> Message-ID: <458426FE-4A1A-4FD3-9959-3B533D1C60E8@brinckerhoff.org> On Jun 3, 2009, at 8:40 AM, Eli Barzilay wrote: > and it works with multiple expressions too: > > (define (foo x) > ;#;#; > (printf "foo\n") > (printf " x = ~s\n" x) > ...) This is the most frightening idea I've heard today. It did make me smile, though. If only we had a macro system where expressions could expand into reader macros. John -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2484 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090603/3f192cdc/smime.bin From eli at barzilay.org Wed Jun 3 13:14:17 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Jun 3 13:14:39 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: <458426FE-4A1A-4FD3-9959-3B533D1C60E8@brinckerhoff.org> References: <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> <4A25B287.6080906@ccs.neu.edu> <18982.39258.448744.582220@winooski.ccs.neu.edu> <458426FE-4A1A-4FD3-9959-3B533D1C60E8@brinckerhoff.org> Message-ID: <18982.44905.680989.68007@winooski.ccs.neu.edu> On Jun 3, John Clements wrote: > > On Jun 3, 2009, at 8:40 AM, Eli Barzilay wrote: > > and it works with multiple expressions too: > > > > (define (foo x) > > ;#;#; > > (printf "foo\n") > > (printf " x = ~s\n" x) > > ...) > > This is the most frightening idea I've heard today. I *seriously* don't see what would be frightening about it. > It did make me smile, though. If only we had a macro system where > expressions could expand into reader macros. We can do that with reader macros. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From acowley at seas.upenn.edu Wed Jun 3 13:30:28 2009 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Wed Jun 3 13:30:50 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: <18982.44905.680989.68007@winooski.ccs.neu.edu> References: <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> <4A25B287.6080906@ccs.neu.edu> <18982.39258.448744.582220@winooski.ccs.neu.edu> <458426FE-4A1A-4FD3-9959-3B533D1C60E8@brinckerhoff.org> <18982.44905.680989.68007@winooski.ccs.neu.edu> Message-ID: <81addec70906031030h33fd318cm737d106ea82ec8b2@mail.gmail.com> On Wed, Jun 3, 2009 at 1:14 PM, Eli Barzilay wrote: > On Jun ?3, John Clements wrote: >> >> On Jun 3, 2009, at 8:40 AM, Eli Barzilay wrote: >> > and it works with multiple expressions too: >> > >> > ?(define (foo x) >> > ? ?;#;#; >> > ? ?(printf "foo\n") >> > ? ?(printf " ?x = ~s\n" x) >> > ? ?...) >> >> This is the most frightening idea I've heard today. > > I *seriously* don't see what would be frightening about it. FWIW, I reflexively looked away from the screen in horror when I saw that, too. In my case, at least, it's not simply the leading semicolon, but an unfamiliarity with using #; in such a manner. My reaction to the ;#;#; combination is a wooks-ian aversion to opaque notation whose far-reaching semantics are not immediately obvious, "Oh, this is a commented out notation that, if uncommented, would comment out the next two (count 'em!) S-expressions!" My real aversion was to the stacking of the #;, commenting them out is just the kicker. I'm now going to mentally prepare myself for the day when I come across code with #;#;#;;#;;#; in front of some vertically-long expressions. Anthony From hendrik at topoi.pooq.com Wed Jun 3 13:25:54 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Wed Jun 3 13:32:22 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: <904774730906021449u4d1222dm1633ee56af169520@mail.gmail.com> References: <20090602090716.GA20342@mantle.rutgers.edu> <779bf2730906011211x1b622665r5acea2523a8a3045@mail.gmail.com> <18980.10863.548451.600306@winooski.ccs.neu.edu> <18980.61892.67525.128307@winooski.ccs.neu.edu> <20090602142941.GC23694@mantle.rutgers.edu> <18981.15519.148715.770669@winooski.ccs.neu.edu> <15AC064E-1F2A-4701-AB22-57E69259C8CE@adelphi.edu> <904774730906021449u4d1222dm1633ee56af169520@mail.gmail.com> Message-ID: <20090603172554.GB7016@topoi.pooq.com> On Tue, Jun 02, 2009 at 05:49:12PM -0400, Todd O'Bryan wrote: > When the only tool you have is a Dragon Book, everything looks like a .... like an opportunity to track down Modern Compiler Design, by Dick Grune et al. It's readable, and it's very, very practical. > > I'm not sure how to finish that sentence, but I'm sure there's a > punchline in there somewhere. :-) Sorry it wan't a punch line, but it is good advice. -- hendrik From jay.mccarthy at gmail.com Wed Jun 3 13:34:15 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Wed Jun 3 13:34:36 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: <18982.44905.680989.68007@winooski.ccs.neu.edu> References: <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> <4A25B287.6080906@ccs.neu.edu> <18982.39258.448744.582220@winooski.ccs.neu.edu> <458426FE-4A1A-4FD3-9959-3B533D1C60E8@brinckerhoff.org> <18982.44905.680989.68007@winooski.ccs.neu.edu> Message-ID: On Wed, Jun 3, 2009 at 11:14 AM, Eli Barzilay wrote: > On Jun ?3, John Clements wrote: >> >> On Jun 3, 2009, at 8:40 AM, Eli Barzilay wrote: >> > and it works with multiple expressions too: >> > >> > ?(define (foo x) >> > ? ?;#;#; >> > ? ?(printf "foo\n") >> > ? ?(printf " ?x = ~s\n" x) >> > ? ?...) >> >> This is the most frightening idea I've heard today. > > I *seriously* don't see what would be frightening about it. I was frightened too, but I expect as much from the earth-shattering Eli. It never occurred to me that #;s would stack like that, but it makes sense now. Jay -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From hendrik at topoi.pooq.com Wed Jun 3 13:31:10 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Wed Jun 3 13:37:39 2009 Subject: [plt-scheme] Natural Language parsing in CS1 In-Reply-To: References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> <18979.56830.723396.281647@winooski.ccs.neu.edu> <779bf2730906011211x1b622665r5acea2523a8a3045@mail.gmail.com> <18980.10863.548451.600306@winooski.ccs.neu.edu> <904774730906020801k46a14d16hb08a58cc72ba69a0@mail.gmail.com> Message-ID: <20090603173109.GC7016@topoi.pooq.com> On Wed, Jun 03, 2009 at 10:50:12AM +0100, Noel Welsh wrote: > On Tue, Jun 2, 2009 at 4:01 PM, Todd O'Bryan wrote: > > One of my computational linguistics professors said that the > > statistical revolution of the 1990s was incredibly important, but he > > worried that it was the result of competitive systems that encouraged > > people to create something that worked, not necessarily something that > > was based in good research. His view was that people had kind of hit a > > wall and the field needed to go back to doing some basic research to > > figure out how to get past the limitations people had hit. > > My opinion: > > Logic is very expressive but doesn't handle uncertainty > Stats handles uncertainty but is not expressive (the most commonly > used formalism is equivalent to propositional logic). > > The stats guys are slowly building more expressive representations. > For example, various people are looking at first-order logic + > probability. There are issues here that relate to PL. Current machine > learning systems are built in matrix oriented languages like Matlab, > with speed being a motivation. These languages make it hard to build > complex systems (e.g. a type system doesn't help when, for example, > every function is matrix -> matrix). Work like the Church system at > MIT and Neil Toronto's work at BYU may provide the tools needed to > build more expressive systems that have reasonable performance. > > N. Lamba calculus gives a Scott domain for its interpretation. With structure imposed on it, we get an interpretation for typed lambda calculus. Would the same kind of type-imposition work on some of the Scott domains modelling nondeterminism? Would that suggest a higher-level language that these matrices could be considered the assembly-language for? -- hendrik > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From eli at barzilay.org Wed Jun 3 13:52:19 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Jun 3 13:52:42 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: <81addec70906031030h33fd318cm737d106ea82ec8b2@mail.gmail.com> References: <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> <4A25B287.6080906@ccs.neu.edu> <18982.39258.448744.582220@winooski.ccs.neu.edu> <458426FE-4A1A-4FD3-9959-3B533D1C60E8@brinckerhoff.org> <18982.44905.680989.68007@winooski.ccs.neu.edu> <81addec70906031030h33fd318cm737d106ea82ec8b2@mail.gmail.com> Message-ID: <18982.47187.524290.114159@winooski.ccs.neu.edu> On Jun 3, Anthony Cowley wrote: > On Wed, Jun 3, 2009 at 1:14 PM, Eli Barzilay wrote: > > On Jun ?3, John Clements wrote: > >> > >> On Jun 3, 2009, at 8:40 AM, Eli Barzilay wrote: > >> > and it works with multiple expressions too: > >> > > >> > ?(define (foo x) > >> > ? ?;#;#; > >> > ? ?(printf "foo\n") > >> > ? ?(printf " ?x = ~s\n" x) > >> > ? ?...) > >> > >> This is the most frightening idea I've heard today. > > > > I *seriously* don't see what would be frightening about it. > > FWIW, I reflexively looked away from the screen in horror when I saw > that, too. In my case, at least, it's not simply the leading > semicolon, but an unfamiliarity with using #; in such a manner. My > reaction to the ;#;#; combination is a wooks-ian aversion to opaque > notation whose far-reaching semantics are not immediately obvious, > "Oh, this is a commented out notation that, if uncommented, would > comment out the next two (count 'em!) S-expressions!" There are two concepts here: the use of `;' as a line comment, which is nothing new, and stacking `#;'s, which seems to be more, uh, "radical" -- to my surprise. So, ignoring `;' for now, what I'm saying is that stacking `#;' makes sense if you look at it in this light: 1. We want a convenient way to comment the next sexpr, even when not in an expression position. 2. Solution: `#;' does that. 3. Just like it's convenient to comment out the next *single* sexpr, it can be convenient to comment out the next two sexprs. 4. A point of objection might be the ability to `#;' each of the two. A counter point to this is the convenience of uncommenting a single construct -- in exactly the same way that `#;' is more convenient than `#|...|#'. 5. Now, if you do agree that there's a utility in commenting out two expressions, what would be a convenient syntax for that? - `#2;' means that you'll also need to add `#1;' - `#;;' is ambiguous with using `;' as a line comment - `##;' doesn't follow the normal convention of `#' as a dispatch character. - `#;#;' works, and doesn't require any change to readers that support `#;'. Problem solved. 6. And here is my surprise: I think that the last item is natural, and works well in the "spirit of scheme" of a minimal solution that generalizes elegantly. So my conclusion is that what people find intimidating is the need for a syntax to "comment the next two sexprs" -- and that surprises me: why would "comment the next sexpr" be less radical than "comment the next two sexprs"? > My real aversion was to the stacking of the #;, commenting them out is > just the kicker. I'm now going to mentally prepare myself for the day > when I come across code with #;#;#;;#;;#; in front of some > vertically-long expressions. When you parse the meaning of this line in the same way you did above, then you get to a way to control how many expressions in the tail are being ignored -- and this seems to be way less useful as a concept, since you'd probably want those control points to be close to the expressions that get disabled. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From jensaxel at soegaard.net Wed Jun 3 13:54:17 2009 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Wed Jun 3 13:54:39 2009 Subject: [plt-scheme] How Hacker News was hacked Message-ID: <4A26B8C9.3010705@soegaard.net> http://news.ycombinator.com/item?id=639976 -- Jens Axel S?gaard From clements at brinckerhoff.org Wed Jun 3 14:04:31 2009 From: clements at brinckerhoff.org (John Clements) Date: Wed Jun 3 14:05:43 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: <18982.47187.524290.114159@winooski.ccs.neu.edu> References: <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> <4A25B287.6080906@ccs.neu.edu> <18982.39258.448744.582220@winooski.ccs.neu.edu> <458426FE-4A1A-4FD3-9959-3B533D1C60E8@brinckerhoff.org> <18982.44905.680989.68007@winooski.ccs.neu.edu> <81addec70906031030h33fd318cm737d106ea82ec8b2@mail.gmail.com> <18982.47187.524290.114159@winooski.ccs.neu.edu> Message-ID: <509FE9E6-C7EA-4921-8381-6EE965DED278@brinckerhoff.org> On Jun 3, 2009, at 10:52 AM, Eli Barzilay wrote: > On Jun 3, Anthony Cowley wrote: >> On Wed, Jun 3, 2009 at 1:14 PM, Eli Barzilay wrote: >>> On Jun 3, John Clements wrote: >>>> >>>> On Jun 3, 2009, at 8:40 AM, Eli Barzilay wrote: >>>>> and it works with multiple expressions too: >>>>> >>>>> (define (foo x) >>>>> ;#;#; >>>>> (printf "foo\n") >>>>> (printf " x = ~s\n" x) >>>>> ...) >>>> >>>> This is the most frightening idea I've heard today. >>> >>> I *seriously* don't see what would be frightening about it. >> >> FWIW, I reflexively looked away from the screen in horror when I saw >> that, too. In my case, at least, it's not simply the leading >> semicolon, but an unfamiliarity with using #; in such a manner. My >> reaction to the ;#;#; combination is a wooks-ian aversion to opaque >> notation whose far-reaching semantics are not immediately obvious, >> "Oh, this is a commented out notation that, if uncommented, would >> comment out the next two (count 'em!) S-expressions!" > > There are two concepts here: the use of `;' as a line comment, which > is nothing new, and stacking `#;'s, which seems to be more, uh, > "radical" -- to my surprise. So, ignoring `;' for now, what I'm > saying is that stacking `#;' makes sense if you look at it in this > light: > > 1. We want a convenient way to comment the next sexpr, even when not > in an expression position. > > 2. Solution: `#;' does that. I think the basic fear arises from the fact that #; textually breaks the tree structure of the language. Put differently, imagine that (zap) is an expression which comments out the following expression. What would (zap) (zap) (my-long-sexp ...) (my-next-long-sexp) mean? Would the first zap zap the zap, or would it instead zap the second sexpression? John -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2484 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090603/2e2a5cff/smime-0001.bin From robby at eecs.northwestern.edu Wed Jun 3 14:05:05 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Wed Jun 3 14:05:49 2009 Subject: [plt-scheme] How Hacker News was hacked In-Reply-To: <4A26B8C9.3010705@soegaard.net> References: <4A26B8C9.3010705@soegaard.net> Message-ID: <932b2f1f0906031105o5dfbbc6akbfbcbd28def939db@mail.gmail.com> Does this mean that mzscheme should not be using the current seconds to initialize the random seed? Robby On Wed, Jun 3, 2009 at 12:54 PM, Jens Axel Soegaard wrote: > http://news.ycombinator.com/item?id=639976 > > -- > Jens Axel S?gaard > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From acowley at seas.upenn.edu Wed Jun 3 14:11:08 2009 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Wed Jun 3 14:12:06 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: <18982.47187.524290.114159@winooski.ccs.neu.edu> References: <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> <4A25B287.6080906@ccs.neu.edu> <18982.39258.448744.582220@winooski.ccs.neu.edu> <458426FE-4A1A-4FD3-9959-3B533D1C60E8@brinckerhoff.org> <18982.44905.680989.68007@winooski.ccs.neu.edu> <81addec70906031030h33fd318cm737d106ea82ec8b2@mail.gmail.com> <18982.47187.524290.114159@winooski.ccs.neu.edu> Message-ID: <81addec70906031111x2978450wcec0ea74e0fff264@mail.gmail.com> On Wed, Jun 3, 2009 at 1:52 PM, Eli Barzilay wrote: > 1. We want a convenient way to comment the next sexpr, even when not > ? in an expression position. > > 2. Solution: `#;' does that. > > 3. Just like it's convenient to comment out the next *single* sexpr, > ? it can be convenient to comment out the next two sexprs. My opinion is that #; as a way to comment out an expression is justifiable because it's easier to toggle than #| |# *and* it is syntactically adjacent to the expression it affects (this is a not-so-subtle callback to the origins of this thread). I agree that it is convenient to comment out multiple sexprs, but I think that, at this point, one falls back to the #| |# syntax because the alternatives, from which you make a strong case for the one you've chosen, require a more complicated mental parse. It's not a binary toggle ("I'm in a commented out region now") and the syntax in front of me might not indicate that it is commented out. It's adding an unusual stack component to the parsing that requires more than one bit of state to understand. Your derivation of the form is appreciated and does make sense, so it is certainly understandable, it just doesn't feel like Scheme (trees and lists) to me, but that's subjective. Anthony From clements at brinckerhoff.org Wed Jun 3 14:28:09 2009 From: clements at brinckerhoff.org (John Clements) Date: Wed Jun 3 14:28:32 2009 Subject: syntax of commenting (was: Re: [plt-scheme] Student parsing problem) In-Reply-To: <81addec70906031111x2978450wcec0ea74e0fff264@mail.gmail.com> References: <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> <4A25B287.6080906@ccs.neu.edu> <18982.39258.448744.582220@winooski.ccs.neu.edu> <458426FE-4A1A-4FD3-9959-3B533D1C60E8@brinckerhoff.org> <18982.44905.680989.68007@winooski.ccs.neu.edu> <81addec70906031030h33fd318cm737d106ea82ec8b2@mail.gmail.com> <18982.47187.524290.114159@winooski.ccs.neu.edu> <81addec70906031111x2978450wcec0ea74e0fff264@mail.gmail.com> Message-ID: <0B7DAAA6-5059-4C2F-946B-4152BB13E9BE@brinckerhoff.org> On Jun 3, 2009, at 11:11 AM, Anthony Cowley wrote: > On Wed, Jun 3, 2009 at 1:52 PM, Eli Barzilay wrote: >> 1. We want a convenient way to comment the next sexpr, even when not >> in an expression position. >> >> 2. Solution: `#;' does that. >> >> 3. Just like it's convenient to comment out the next *single* sexpr, >> it can be convenient to comment out the next two sexprs. > > My opinion is that #; as a way to comment out an expression is > justifiable because it's easier to toggle than #| |# *and* it is > syntactically adjacent to the expression it affects (this is a > not-so-subtle callback to the origins of this thread). Thinking about this more, I think what I'd like more than stacked #:#: would just be a parenthesized comment-out form, e.g.: (COMMENT (big sexpression one) (big sexpression two)) You could pretty much get what you want by just defining a macro that discards its argument, though I'm sure there would be situations where this wouldn't behave the same as the reader macro. Also, you probably want everyone using the same convention. As to the convenience of this form: You can use C-c C-e to strip a pair of matched parens, so commenting it back in doesn't require complex machinations. I agree that this isn't quite as convenient as the insertion and removal of a single semicolon. If this became an accepted form, you could also define an XCOMMENT macro that *doesn't* comment out its argument (and in fact splices them into the parent sexp) so that you could do the semicolon trick with an X instead. In short: I claim that something like this would greatly simplify the task of determining whether a particular expression is commented out or not. Naturally, so would simply forbidding the double #; . Namby-pambily yours, John -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2484 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090603/438be450/smime.bin From eli at barzilay.org Wed Jun 3 14:30:09 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Jun 3 14:30:36 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: <509FE9E6-C7EA-4921-8381-6EE965DED278@brinckerhoff.org> References: <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> <4A25B287.6080906@ccs.neu.edu> <18982.39258.448744.582220@winooski.ccs.neu.edu> <458426FE-4A1A-4FD3-9959-3B533D1C60E8@brinckerhoff.org> <18982.44905.680989.68007@winooski.ccs.neu.edu> <81addec70906031030h33fd318cm737d106ea82ec8b2@mail.gmail.com> <18982.47187.524290.114159@winooski.ccs.neu.edu> <81addec70906031111x2978450wcec0ea74e0fff264@mail.gmail.com> <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> <509FE9E6-C7EA-4921-8381-6EE965DED278@brinckerhoff.org> Message-ID: <18982.49457.314998.488564@winooski.ccs.neu.edu> On Jun 3, John Clements wrote: > > I think the basic fear arises from the fact that #; textually breaks > the tree structure of the language. Put differently, imagine that > (zap) is an expression which comments out the following expression. > What would > > (zap) (zap) (my-long-sexp ...) (my-next-long-sexp) > > mean? Would the first zap zap the zap, or would it instead zap the > second sexpression? But since it's at the reader level, then the first (zap) wouldn't even see the second one, and the zapped expression. In any case, my conclusion from this is that people find the way the reader works confusing (at least this is my best guess at what was so difficult about it). On Jun 3, Anthony Cowley wrote: > > My opinion is that #; as a way to comment out an expression is > justifiable because it's easier to toggle than #| |# *and* it is > syntactically adjacent to the expression it affects (this is a > not-so-subtle callback to the origins of this thread). > > I agree that it is convenient to comment out multiple sexprs, but I > think that, at this point, one falls back to the #| |# syntax Well, that still has the same problem of two points that needs editing if you want to uncomment the two expressions back in. (BTW, just the word "uncomment" is a strong hint that this kind of convenience is needed...) > because the alternatives, from which you make a strong case for the > one you've chosen, require a more complicated mental parse. It's not > a binary toggle ("I'm in a commented out region now") and the syntax > in front of me might not indicate that it is commented out. It's > adding an unusual stack component to the parsing that requires more > than one bit of state to understand. One thing that I will agree with is that this is not a good thing to do when the expressions are longer than a few lines. Certainly, scrolling back your code just to count the number of `#;'s at the top would be absolutely horrible. > Your derivation of the form is appreciated and does make sense, so > it is certainly understandable, it just doesn't feel like Scheme > (trees and lists) to me, but that's subjective. Yes, it's a subjective point -- and one that applies to just plain `#;' too. For example: ' #; (a b c) (x y z) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From acowley at seas.upenn.edu Wed Jun 3 14:41:29 2009 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Wed Jun 3 14:41:47 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: <18982.49457.314998.488564@winooski.ccs.neu.edu> References: <458426FE-4A1A-4FD3-9959-3B533D1C60E8@brinckerhoff.org> <18982.44905.680989.68007@winooski.ccs.neu.edu> <81addec70906031030h33fd318cm737d106ea82ec8b2@mail.gmail.com> <18982.47187.524290.114159@winooski.ccs.neu.edu> <81addec70906031111x2978450wcec0ea74e0fff264@mail.gmail.com> <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> <509FE9E6-C7EA-4921-8381-6EE965DED278@brinckerhoff.org> <18982.49457.314998.488564@winooski.ccs.neu.edu> Message-ID: <81addec70906031141n1bc99a3ndea2c2f4988c4c65@mail.gmail.com> On Wed, Jun 3, 2009 at 2:30 PM, Eli Barzilay wrote: >> I agree that it is convenient to comment out multiple sexprs, but I >> think that, at this point, one falls back to the #| |# syntax > > Well, that still has the same problem of two points that needs editing > if you want to uncomment the two expressions back in. ?(BTW, just the > word "uncomment" is a strong hint that this kind of convenience is > needed...) But that seems like something that can be handled at the editor level: a keystroke that strips an enclosing #| |# pair. It's still not perfect because you need to select a region to comment out, rather than just visually counting the sexprs, but the "uncomment" action can be addressed without new syntax. One could take the idea further and have an emacs-ish chord that takes an argument to indicate how many sexprs to comment out. Put the cursor before an sexpr, hit C-whatever, then a number to indicate how many sexprs, and the editor can insert the #| |# pair around the region. Anthony From eli at barzilay.org Wed Jun 3 14:41:48 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Jun 3 14:42:13 2009 Subject: syntax of commenting (was: Re: [plt-scheme] Student parsing problem) In-Reply-To: <0B7DAAA6-5059-4C2F-946B-4152BB13E9BE@brinckerhoff.org> References: <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> <4A25B287.6080906@ccs.neu.edu> <18982.39258.448744.582220@winooski.ccs.neu.edu> <458426FE-4A1A-4FD3-9959-3B533D1C60E8@brinckerhoff.org> <18982.44905.680989.68007@winooski.ccs.neu.edu> <81addec70906031030h33fd318cm737d106ea82ec8b2@mail.gmail.com> <18982.47187.524290.114159@winooski.ccs.neu.edu> <81addec70906031111x2978450wcec0ea74e0fff264@mail.gmail.com> <0B7DAAA6-5059-4C2F-946B-4152BB13E9BE@brinckerhoff.org> Message-ID: <18982.50156.951897.31339@winooski.ccs.neu.edu> On Jun 3, John Clements wrote: > > Thinking about this more, I think what I'd like more than stacked > #:#: would just be a parenthesized comment-out form, e.g.: > > (COMMENT > (big > sexpression > one) > > (big > sexpression > two)) > > You could pretty much get what you want by just defining a macro > that discards its argument, though I'm sure there would be > situations where this wouldn't behave the same as the reader > macro. Yes, there would be such situations -- many of them, and Scheme being Scheme, you don't get any way of doing this. You could think about a macro system where some code expands to a `special-comment' value, and hook the macro expander to discard such values -- but that's a borderline confusion of the reader level and the macro level. You could just the same imagine a macro system that allows expanding to a single double quote, forcing the expander to reparse the code... and at this point you need to stick your head just a little higher (or maybe lower, depending on your POV) and you'll be able to see that you're almost in TeX world. IOW, such things break exactly the point where Scheme draws a lot of power from: the separation of concrete syntax and AST manipulation. (This is a point that Shriram describes nicely at the beginning of PLAI.) This power comes from the *separation* of the two worlds, whereas technically TeX gives you more power which results in ...uh... TeX. [And BTW, there *is* some point in being able to express things close to that -- I ran into this with the scribble reader, so this is still in the concrete parsing world.] -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From eli at barzilay.org Wed Jun 3 14:44:10 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Jun 3 14:44:33 2009 Subject: [plt-scheme] Student parsing problem In-Reply-To: <81addec70906031141n1bc99a3ndea2c2f4988c4c65@mail.gmail.com> References: <458426FE-4A1A-4FD3-9959-3B533D1C60E8@brinckerhoff.org> <18982.44905.680989.68007@winooski.ccs.neu.edu> <81addec70906031030h33fd318cm737d106ea82ec8b2@mail.gmail.com> <18982.47187.524290.114159@winooski.ccs.neu.edu> <81addec70906031111x2978450wcec0ea74e0fff264@mail.gmail.com> <990e0c030906021433y282cbde1l2d282899e88f710d@mail.gmail.com> <509FE9E6-C7EA-4921-8381-6EE965DED278@brinckerhoff.org> <18982.49457.314998.488564@winooski.ccs.neu.edu> <81addec70906031141n1bc99a3ndea2c2f4988c4c65@mail.gmail.com> Message-ID: <18982.50298.379246.817572@winooski.ccs.neu.edu> On Jun 3, Anthony Cowley wrote: > On Wed, Jun 3, 2009 at 2:30 PM, Eli Barzilay wrote: > >> I agree that it is convenient to comment out multiple sexprs, but > >> I think that, at this point, one falls back to the #| |# syntax > > > > Well, that still has the same problem of two points that needs > > editing if you want to uncomment the two expressions back > > in. ?(BTW, just the word "uncomment" is a strong hint that this > > kind of convenience is needed...) > > But that seems like something that can be handled at the editor > level: a keystroke that strips an enclosing #| |# pair. It's still > not perfect because you need to select a region to comment out, > rather than just visually counting the sexprs, but the "uncomment" > action can be addressed without new syntax. One could take the idea > further and have an emacs-ish chord that takes an argument to > indicate how many sexprs to comment out. Put the cursor before an > sexpr, hit C-whatever, then a number to indicate how many sexprs, > and the editor can insert the #| |# pair around the region. [That's a valid point, and again -- it works against `#;' too.] -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From clements at brinckerhoff.org Wed Jun 3 14:52:59 2009 From: clements at brinckerhoff.org (John Clements) Date: Wed Jun 3 14:53:24 2009 Subject: syntax of commenting (was: Re: [plt-scheme] Student parsing problem) In-Reply-To: <18982.50156.951897.31339@winooski.ccs.neu.edu> References: <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> <4A25B287.6080906@ccs.neu.edu> <18982.39258.448744.582220@winooski.ccs.neu.edu> <458426FE-4A1A-4FD3-9959-3B533D1C60E8@brinckerhoff.org> <18982.44905.680989.68007@winooski.ccs.neu.edu> <81addec70906031030h33fd318cm737d106ea82ec8b2@mail.gmail.com> <18982.47187.524290.114159@winooski.ccs.neu.edu> <81addec70906031111x2978450wcec0ea74e0fff264@mail.gmail.com> <0B7DAAA6-5059-4C2F-946B-4152BB13E9BE@brinckerhoff.org> <18982.50156.951897.31339@winooski.ccs.neu.edu> Message-ID: <44BDD524-48FA-494F-8F51-AA95345D3C7E@brinckerhoff.org> On Jun 3, 2009, at 11:41 AM, Eli Barzilay wrote: > On Jun 3, John Clements wrote: >> >> Thinking about this more, I think what I'd like more than stacked >> #:#: would just be a parenthesized comment-out form, e.g.: >> >> (COMMENT >> (big >> sexpression >> one) >> >> (big >> sexpression >> two)) >> >> You could pretty much get what you want by just defining a macro >> that discards its argument, though I'm sure there would be >> situations where this wouldn't behave the same as the reader >> macro. > > Yes, there would be such situations -- many of them, and Scheme being > Scheme, you don't get any way of doing this. You could think about a > macro system where some code expands to a `special-comment' value, and > hook the macro expander to discard such values -- but that's a > borderline confusion of the reader level and the macro level. You > could just the same imagine a macro system that allows expanding to a > single double quote, forcing the expander to reparse the code... and > at this point you need to stick your head just a little higher (or > maybe lower, depending on your POV) and you'll be able to see that > you're almost in TeX world. I think you're misunderstanding me; what I'm pointing out is that for a COMMENT form to work correctly, it would have to be a reader form-- like #; , and like #| |#--and not a macro. It just happens to be a reader form that our textual editors can already handle conveniently. John -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2484 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090603/a1aaba97/smime.bin From eli at barzilay.org Wed Jun 3 15:04:15 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Jun 3 15:04:37 2009 Subject: syntax of commenting (was: Re: [plt-scheme] Student parsing problem) In-Reply-To: <44BDD524-48FA-494F-8F51-AA95345D3C7E@brinckerhoff.org> References: <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> <4A25B287.6080906@ccs.neu.edu> <18982.39258.448744.582220@winooski.ccs.neu.edu> <458426FE-4A1A-4FD3-9959-3B533D1C60E8@brinckerhoff.org> <18982.44905.680989.68007@winooski.ccs.neu.edu> <81addec70906031030h33fd318cm737d106ea82ec8b2@mail.gmail.com> <18982.47187.524290.114159@winooski.ccs.neu.edu> <81addec70906031111x2978450wcec0ea74e0fff264@mail.gmail.com> <0B7DAAA6-5059-4C2F-946B-4152BB13E9BE@brinckerhoff.org> <18982.50156.951897.31339@winooski.ccs.neu.edu> <44BDD524-48FA-494F-8F51-AA95345D3C7E@brinckerhoff.org> Message-ID: <18982.51503.951487.90529@winooski.ccs.neu.edu> On Jun 3, John Clements wrote: > > I think you're misunderstanding me; what I'm pointing out is that > for a COMMENT form to work correctly, it would have to be a reader > form-- like #; , and like #| |#--and not a macro. It just happens > to be a reader form that our textual editors can already handle > conveniently. This only gets you deeper into the quicksand. What about: (parameterize ([read-case-sensitive #f]) (read (open-input-string "(comment ...)"))) or any of these: [COMMENT ...] (\COMMENT ...) #(COMMENT ...) (COMMENT...) for example (COMMENTARY ...) And I didn't even begin to talk about confusions like > (list-ref '(COMMENT 3) 0) list-ref: expects 2 arguments, given 1: 0 -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From ryanc at ccs.neu.edu Wed Jun 3 15:05:17 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Wed Jun 3 15:05:42 2009 Subject: [plt-scheme] Re: Style question In-Reply-To: <18982.21536.975658.665408@winooski.ccs.neu.edu> References: <8f7f1350-2735-416a-882b-7014db5ff228@x5g2000yqk.googlegroups.com> <4A21B4BB.6000901@ccs.neu.edu> <78c04168-dbee-48f0-98a9-4440b58d839d@h11g2000yqb.googlegroups.com> <18981.33229.855038.22018@winooski.ccs.neu.edu> <1195b3aa-dfe9-4eae-9a45-80e13b44af7a@r34g2000vba.googlegroups.com> <18981.36215.785959.900469@winooski.ccs.neu.edu> <533c96720906030023i97f6d95j358ad9f04f1f5cbf@mail.gmail.com> <18982.21536.975658.665408@winooski.ccs.neu.edu> Message-ID: On Jun 3, 2009, at 6:44 AM, Eli Barzilay wrote: > On Jun 3, Tomasz Skutnik wrote: >> >> Thanks for clarification Eli. That expanded my understanding of the >> naming problem. However, as I see it, the main issue is not with >> error reporting during bug hunt (where "more correct" name is >> desirable). It's about signaling of missing keyword parameters on >> function invocation - which IMHO is rather common programming >> mistake. > > Well, if you do what I suggested: > >>> #lang scheme >>> (provide make-foo) >>> (define-struct internal-foo (x y z)) >>> (define (make-foo ...) ... make-internal-foo ...) > > then the error reports *will* talk about `make-foo'. > > >> For me, the best option would be using procedure-rename, if it would >> retain keyword parameters. [...] > > I think that the purpose of `procedure-rename' is unclear in this > thread. Its intention is as a tool where the name is determined at > run-time -- if you want to use a different name for your function > definition, then this was always possible. Here's an easy way to do > it: It permits the new name to be determined at run time, and that makes it more useful, but that doesn't mean that it's a bad thing to use it when the name is statically known. It seems reasonable to prefer 'procedure-rename' to some contortion of bindings designed to drop the right name on the right lambda form. I think we should just make 'procedure-rename' (as exported from scheme/base, anyway) handle keyword procedures. > (define foo (let ([bar (lambda (x) x)]) bar)) > > or a possibly more convenient form: > > (define foo > (let () > (define (bar x) x) > bar)) That's a bad idea if the procedure's body needs to refer to the outer binding of the name you want to give it. (define create-pool (let ([make-pool (lambda () (make-pool ))]) make-pool)) works, but (define create-pool (let () (define (make-pool) (make-pool )) make-pool)) doesn't, because the "real" make-pool is shadowed. Only use let to do procedure renaming. Ryan From eli at barzilay.org Wed Jun 3 15:12:06 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Jun 3 15:12:29 2009 Subject: [plt-scheme] Re: Style question In-Reply-To: References: <8f7f1350-2735-416a-882b-7014db5ff228@x5g2000yqk.googlegroups.com> <4A21B4BB.6000901@ccs.neu.edu> <78c04168-dbee-48f0-98a9-4440b58d839d@h11g2000yqb.googlegroups.com> <18981.33229.855038.22018@winooski.ccs.neu.edu> <1195b3aa-dfe9-4eae-9a45-80e13b44af7a@r34g2000vba.googlegroups.com> <18981.36215.785959.900469@winooski.ccs.neu.edu> <533c96720906030023i97f6d95j358ad9f04f1f5cbf@mail.gmail.com> <18982.21536.975658.665408@winooski.ccs.neu.edu> Message-ID: <18982.51974.746619.568602@winooski.ccs.neu.edu> On Jun 3, Ryan Culpepper wrote: > It permits the new name to be determined at run time, and that makes > it more useful, but that doesn't mean that it's a bad thing to use > it when the name is statically known. It seems reasonable to prefer > 'procedure-rename' to some contortion of bindings designed to drop > the right name on the right lambda form. (Another possible problem here is that there is currently an overhead for functions that are renamed that way.) > I think we should just make 'procedure-rename' (as exported from > scheme/base, anyway) handle keyword procedures. I completely agree. > That's a bad idea if the procedure's body needs to refer to the > outer binding of the name you want to give it. > [...] > > Only use let to do procedure renaming. Yes, sorry. (I was trying to make it "look nicer".) Tomasz, in case you tried to use the macro I wrote and found that it's broken -- this is how it should be implemented instead: (define-syntax-rule (define/provide (external-name . args) body ...) (begin (define hidden-name (let ([external-name (lambda args body ...)]) external-name)) (provide (rename-out [hidden-name external-name])))) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From adityashukla1983 at gmail.com Wed Jun 3 15:08:05 2009 From: adityashukla1983 at gmail.com (aditya shukla) Date: Wed Jun 3 15:13:27 2009 Subject: [plt-scheme] htdp exercise 12.2.2 Message-ID: <73045cca0906031208g4129a4b1gdf1611776ee3ea7c@mail.gmail.com> The exercise 12.2.2 illustrates the concept of search and then asks to implement search-sorted.It says that search-sorted takes the advantage that the list is sorted. My question is then what's the difference between search and search-sorted. Because for both we can check for the first and do recursion on the rest of the list? Thanks, Aditya -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090603/39209e5d/attachment.html From sbloch at adelphi.edu Wed Jun 3 15:28:28 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Wed Jun 3 15:28:48 2009 Subject: [plt-scheme] htdp exercise 12.2.2 In-Reply-To: <73045cca0906031208g4129a4b1gdf1611776ee3ea7c@mail.gmail.com> References: <73045cca0906031208g4129a4b1gdf1611776ee3ea7c@mail.gmail.com> Message-ID: <7DD83618-5C15-4D1D-905D-11508B972AB5@adelphi.edu> On Jun 3, 2009, at 3:08 PM, aditya shukla wrote: > The exercise 12.2.2 illustrates the concept of search and then asks > to implement search-sorted.It says that search-sorted takes the > advantage that the list is sorted. My question is then what's the > difference between search and search-sorted. Because for both we > can check for the first and do recursion on the rest of the list? What does "take advantage of" mean? Since the original search function works on ANY list, it will obviously still work on a sorted list. The "search-sorted" function therefore can't be any more CORRECT than the original function, so it must be better in some other way, like speed. How could you use the assumption that the list is sorted to make the function run faster? (There's a simple way that makes the function slightly faster, and another way that makes the function much faster but requires a different data structure instead of a list. I assume HtDP expects the former....) Stephen Bloch sbloch@adelphi.edu From dvanhorn at ccs.neu.edu Wed Jun 3 15:34:59 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Wed Jun 3 15:35:40 2009 Subject: [plt-scheme] htdp exercise 12.2.2 In-Reply-To: <73045cca0906031208g4129a4b1gdf1611776ee3ea7c@mail.gmail.com> References: <73045cca0906031208g4129a4b1gdf1611776ee3ea7c@mail.gmail.com> Message-ID: <4A26D063.5010000@ccs.neu.edu> aditya shukla wrote: > My question is then what's the difference > between search and search-sorted. Because for both we can check for the > first and do recursion on the rest of the list? Try making some examples -- then ask this question of the examples. David From yinso.chen at gmail.com Wed Jun 3 15:34:49 2009 From: yinso.chen at gmail.com (YC) Date: Wed Jun 3 15:41:29 2009 Subject: [plt-scheme] How Hacker News was hacked In-Reply-To: <932b2f1f0906031105o5dfbbc6akbfbcbd28def939db@mail.gmail.com> References: <4A26B8C9.3010705@soegaard.net> <932b2f1f0906031105o5dfbbc6akbfbcbd28def939db@mail.gmail.com> Message-ID: <779bf2730906031234w3edf73f4x1d92c29a6d5ce3e7@mail.gmail.com> On Wed, Jun 3, 2009 at 11:05 AM, Robby Findler wrote: > Does this mean that mzscheme should not be using the current seconds > to initialize the random seed? > Other languages I have used (Perl, C#, Java, etc) also default to using current seconds, but allow you to change the seed manually. They also advised not to use PRNG for cryptographic purposes in the docs, and provide other means of obtaining cryptographic random number. If PLT has all of the above, IMHO it would be a developer's responsibility to ensure their app is secure. Cheers, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090603/d5516eda/attachment.htm From adityashukla1983 at gmail.com Wed Jun 3 16:00:48 2009 From: adityashukla1983 at gmail.com (aditya shukla) Date: Wed Jun 3 16:01:21 2009 Subject: [plt-scheme] htdp exercise 12.2.2 In-Reply-To: <4A26D063.5010000@ccs.neu.edu> References: <73045cca0906031208g4129a4b1gdf1611776ee3ea7c@mail.gmail.com> <4A26D063.5010000@ccs.neu.edu> Message-ID: <73045cca0906031300s2d9ec874q6332ce9bd4e2ada9@mail.gmail.com> Ok .I think I got the difference now. For the search-sorted we can check for the first and then if the number is greater than the first then the number is not in the list only otherwise we can check for the first and do the recursion on the rest. This is how I have done it. ;; search : number list-of-numbers -> boolean (define (search n alon) (cond [(empty? alon) false] [else (cond [(> n (first alon)) false] [else (or (= (first alon) n) (search n (rest alon)))])])) (define num (cons 3 (cons 2 (cons 1 empty)))) (search -1 num) (search 1 empty) (search 10 num) (search 3 num) (search 2 num) Thanks Aditya -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090603/c60a0082/attachment.html From clements at brinckerhoff.org Wed Jun 3 16:08:54 2009 From: clements at brinckerhoff.org (John Clements) Date: Wed Jun 3 16:09:39 2009 Subject: syntax of commenting (was: Re: [plt-scheme] Student parsing problem) In-Reply-To: <18982.51503.951487.90529@winooski.ccs.neu.edu> References: <89355AD4-8DBA-43A8-A679-64256ECEC896@ccs.neu.edu> <990e0c030906021555la83d4a2t58021f9b49a8b06d@mail.gmail.com> <4A25B287.6080906@ccs.neu.edu> <18982.39258.448744.582220@winooski.ccs.neu.edu> <458426FE-4A1A-4FD3-9959-3B533D1C60E8@brinckerhoff.org> <18982.44905.680989.68007@winooski.ccs.neu.edu> <81addec70906031030h33fd318cm737d106ea82ec8b2@mail.gmail.com> <18982.47187.524290.114159@winooski.ccs.neu.edu> <81addec70906031111x2978450wcec0ea74e0fff264@mail.gmail.com> <0B7DAAA6-5059-4C2F-946B-4152BB13E9BE@brinckerhoff.org> <18982.50156.951897.31339@winooski.ccs.neu.edu> <44BDD524-48FA-494F-8F51-AA95345D3C7E@brinckerhoff.org> <18982.51503.951487.90529@winooski.ccs.neu.edu> Message-ID: <378F614D-36E3-4EC2-8CB3-C307A27E2C58@brinckerhoff.org> On Jun 3, 2009, at 12:04 PM, Eli Barzilay wrote: > On Jun 3, John Clements wrote: >> >> I think you're misunderstanding me; what I'm pointing out is that >> for a COMMENT form to work correctly, it would have to be a reader >> form-- like #; , and like #| |#--and not a macro. It just happens >> to be a reader form that our textual editors can already handle >> conveniently. > > This only gets you deeper into the quicksand. What about: I think I'm already over my head in quicksand, so there's no point in stopping now. > (parameterize ([read-case-sensitive #f]) > (read (open-input-string "(comment ...)"))) > > or any of these: > > [COMMENT ...] > (\COMMENT ...) > #(COMMENT ...) > (COMMENT...) for example (COMMENTARY ...) > > And I didn't even begin to talk about confusions like > >> (list-ref '(COMMENT 3) 0) > list-ref: expects 2 arguments, given 1: 0 I suspect that most of these have naive solutions at the reader level that work pretty well BUT I realize that there's really no need to add anything to the language, because you can already have what I'm proposing (except for the convenient swap-out) by using #;( (my sexp here) (my other sexp)) ... and in fact that's what I already do. So, I guess my observation boils down to this: I think that forbidding sequenced #;'s would not significantly impact the expressiveness of the editor experience. It _is_ an argument for the more widespread use of C-c C-e, though. :) John -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2484 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090603/53fb9d44/smime.bin From tomasz.skutnik at gmail.com Wed Jun 3 16:11:53 2009 From: tomasz.skutnik at gmail.com (Tomasz Skutnik) Date: Wed Jun 3 16:12:12 2009 Subject: [plt-scheme] Re: Style question In-Reply-To: <18982.51974.746619.568602@winooski.ccs.neu.edu> References: <8f7f1350-2735-416a-882b-7014db5ff228@x5g2000yqk.googlegroups.com> <78c04168-dbee-48f0-98a9-4440b58d839d@h11g2000yqb.googlegroups.com> <18981.33229.855038.22018@winooski.ccs.neu.edu> <1195b3aa-dfe9-4eae-9a45-80e13b44af7a@r34g2000vba.googlegroups.com> <18981.36215.785959.900469@winooski.ccs.neu.edu> <533c96720906030023i97f6d95j358ad9f04f1f5cbf@mail.gmail.com> <18982.21536.975658.665408@winooski.ccs.neu.edu> <18982.51974.746619.568602@winooski.ccs.neu.edu> Message-ID: <533c96720906031311k1e396270j6eb4971b5a37ad6c@mail.gmail.com> On Wed, Jun 3, 2009 at 9:12 PM, Eli Barzilay wrote: > > Tomasz, in case you tried to use the macro I wrote and found that it's > broken -- this is how it should be implemented instead: > Thanks guys for all your help. This discussion is very interesting and I'm learning from it a lot. As Ryan pointed I try to avoid "contortion of bindings". For me it's a simple engineering trade off: every line of code is a cost (testing, maintenance, documentation). I thought that changing function name will be "one-form-no-brainer" (procedure-rename seemed like so), but that didn't work. I don't complain. It's just a minor nuisance (if at all). So leaving function name as is (create-pool) have negligible cost - it's still perfectly clear what function does and I don't have to "pollute" my code for unclear purpose (to provide negligibly "nicer" name). Thanks for help. I appreciate it a lot. Tomasz From thecodewitch at gmail.com Wed Jun 3 19:28:34 2009 From: thecodewitch at gmail.com (Greg Santucci) Date: Wed Jun 3 19:28:53 2009 Subject: [plt-scheme] Repl during animation or simulation Message-ID: <66c9435a0906031628v79be3d74hc5b78a9d54b4eb91@mail.gmail.com> Does PLT Scheme support using the REPL during program execution? During a simulation, I'd like to change parameters or function definitions at runtime. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090604/e0bebd66/attachment.html From ryanc at ccs.neu.edu Wed Jun 3 21:51:08 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Wed Jun 3 21:51:40 2009 Subject: [plt-scheme] Repl during animation or simulation In-Reply-To: <66c9435a0906031628v79be3d74hc5b78a9d54b4eb91@mail.gmail.com> References: <66c9435a0906031628v79be3d74hc5b78a9d54b4eb91@mail.gmail.com> Message-ID: <4A27288C.90707@ccs.neu.edu> Greg Santucci wrote: > Does PLT Scheme support using the REPL during program execution? During a > simulation, I'd like to change parameters or function definitions at > runtime. Do you mean you want to affect a long-running program during its execution? That is, as opposed to a series of shorter interactions where you run, change parameters and definitions, run again, change again, and so on. If so, there are two ways to do it. If there are fixed points at which you want to change things, you can actually have your program ask for input at those points. You can use 'read' or a similar function to get input and interpret it yourself, or you can call 'read-eval-print-loop' to start up a REPL that will return to your program when it's finished. (In that case, you might want to set up the 'exit-handler' parameter so that calling 'exit' quits the REPL.) The alternative is to create a separate thread for your program's execution. While it's running in the other thread, you can execute commands in the REPL that change its behavior. PLT Scheme has many options for managing concurrency and communication, from semaphores to channels (synchronous and asynchronous) and synchronizable events. Be aware, if you take the concurrent approach, that parameters (as in 'make-parameter') are like thread-local storage. You won't be able to affect your program running in thread B by changing the parameter values through the REPL in thread A. Ryan From thecodewitch at gmail.com Wed Jun 3 22:08:17 2009 From: thecodewitch at gmail.com (Greg Santucci) Date: Wed Jun 3 22:08:43 2009 Subject: [plt-scheme] Repl during animation or simulation In-Reply-To: <4A27288C.90707@ccs.neu.edu> References: <66c9435a0906031628v79be3d74hc5b78a9d54b4eb91@mail.gmail.com> <4A27288C.90707@ccs.neu.edu> Message-ID: <66c9435a0906031908l1c98c280g34b5020047c511b2@mail.gmail.com> On Thu, Jun 4, 2009 at 12:51 PM, Ryan Culpepper wrote: > > The alternative is to create a separate thread for your program's > execution. While it's running in the other thread, you can execute commands > in the REPL that change its behavior. PLT Scheme has many options for > managing concurrency and communication, from semaphores to channels > (synchronous and asynchronous) and synchronizable events. > > That's good to hear. How do you launch your app in a separate thread from the REPL? Is there an example of what you're describing? Greg -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090604/143661a9/attachment.html From ryanc at ccs.neu.edu Wed Jun 3 22:48:39 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Wed Jun 3 22:49:11 2009 Subject: [plt-scheme] Repl during animation or simulation In-Reply-To: <66c9435a0906031908l1c98c280g34b5020047c511b2@mail.gmail.com> References: <66c9435a0906031628v79be3d74hc5b78a9d54b4eb91@mail.gmail.com> <4A27288C.90707@ccs.neu.edu> <66c9435a0906031908l1c98c280g34b5020047c511b2@mail.gmail.com> Message-ID: <4A273607.8030901@ccs.neu.edu> Greg Santucci wrote: > On Thu, Jun 4, 2009 at 12:51 PM, Ryan Culpepper wrote: > >> The alternative is to create a separate thread for your program's >> execution. While it's running in the other thread, you can execute commands >> in the REPL that change its behavior. PLT Scheme has many options for >> managing concurrency and communication, from semaphores to channels >> (synchronous and asynchronous) and synchronizable events. >> >> > That's good to hear. How do you launch your app in a separate thread from > the REPL? Is there an example of what you're describing? It's easiest if you've already created a main function that starts all the work. Suppose it's called 'run-simulation'. Then instead of something like this (run-simulation some-arguments) to start it in a new thread, write this instead: (thread (lambda () (run-simulation some-arguments))) There are some distantly related examples of threads in "More: Systems Programming with PLT Scheme" in the help desk: http://docs.plt-scheme.org/more/ Ryan From thecodewitch at gmail.com Wed Jun 3 23:26:31 2009 From: thecodewitch at gmail.com (Greg Santucci) Date: Wed Jun 3 23:26:55 2009 Subject: [plt-scheme] Repl during animation or simulation In-Reply-To: <4A273607.8030901@ccs.neu.edu> References: <66c9435a0906031628v79be3d74hc5b78a9d54b4eb91@mail.gmail.com> <4A27288C.90707@ccs.neu.edu> <66c9435a0906031908l1c98c280g34b5020047c511b2@mail.gmail.com> <4A273607.8030901@ccs.neu.edu> Message-ID: <66c9435a0906032026s7a806253p6fda3173d9f2a0f9@mail.gmail.com> Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed... Name: gears.ss Type: application/octet-stream Size: 13414 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090604/d3e3b060/gears.obj From campbell at mumble.net Wed Jun 3 23:09:39 2009 From: campbell at mumble.net (Taylor R Campbell) Date: Wed Jun 3 23:32:47 2009 Subject: [plt-scheme] composable continuations and dynamic state Message-ID: <20090604030941.2B9439828B@pluto.mumble.net> In the following test of the interaction between dynamic state and composable continuations, I observed a difference between dynamic bindings established through parameters and PARAMETRIZE, and dynamic bindings established through DYNAMIC-WIND. With DYNAMIC-WIND the test behaves as I expect; with PARAMETRIZE it does not. (define (test make-parameter parameter-value with-parametrization) (let ((a (make-parameter 'initial-a)) (b (make-parameter 'initial-b)) (prompt-tag (make-continuation-prompt-tag))) (define (show n) (write `(,n ,(parameter-value a) ,(parameter-value b))) (newline)) (let ((f (with-parametrization a 'a0 (lambda () (call-with-continuation-prompt (lambda () (show 1) (with-parametrization b 'b0 (lambda () (show (call-with-composable-continuation (lambda (continuation) (show 2) (abort-current-continuation prompt-tag (lambda () (show 3) continuation))) prompt-tag))))) prompt-tag))))) (show 4) (f 5) (with-parametrization a 'a1 (lambda () (f 6))) (with-parametrization b 'b1 (lambda () (f 7)))))) Below are the implementations of the arguments MAKE-PARAMETER, PARAMETER-VALUE, and WITH-PARAMETRIZATION, but first, a summary of results: parametrize dynamic-wind (1 a0 initial-b) (1 a0 initial-b) (2 a0 b0) (2 a0 b0) (3 a0 initial-b) (3 a0 initial-b) (4 initial-a initial-b) (4 initial-a initial-b) (5 a0 b0) (5 initial-a b0) (6 a0 b0) (6 a1 b0) (7 a0 b0) (7 initial-a b0) The following definitions are all obvious. Both naive and sensible DYNAMIC-WIND implementations yield identical output. I am aware that there is an extra layer of indirection in the use of parameters, since continuation marks map parameters to thread cells, which threads map to values, and PARAMETRIZE only binds the parameters to fresh thread cells in the continuation marks. However, since there is only dynamic binding and no mutation in the above TEST procedure, I think that every thread cell in question will only ever have a single value. (This is the same reason for why the naive and sensible DYNAMIC-WIND implementations yield identical output.) (define (make-parameter/parametrize initial-value) (make-parameter initial-value)) (define (parameter-value/parametrize parameter) (parameter)) (define (with-parametrization/parametrize parameter value thunk) (parameterize ((parameter value)) (thunk))) (define (test/parametrize) (test make-parameter/parametrize parameter-value/parametrize with-parametrization/parametrize)) (define (make-parameter/dynamic-wind initial-value) (box initial-value)) (define (parameter-value/dynamic-wind parameter) (unbox parameter)) (define (with-parametrization/dynamic-wind-naive parameter value thunk) (let ((original (unbox parameter))) (dynamic-wind (lambda () (set-box! parameter value)) thunk (lambda () (set-box! parameter original))))) (define (with-parametrization/dynamic-wind-sensible parameter value thunk) (let ((cache #f)) (dynamic-wind (lambda () (set! cache (unbox parameter)) (set-box! parameter value) (set! value #f)) thunk (lambda () (set! value (unbox parameter)) (set-box! parameter cache) (set! cache #f))))) (define (test/dynamic-wind-naive) (test make-parameter/dynamic-wind parameter-value/dynamic-wind with-parametrization/dynamic-wind-naive)) (define (test/dynamic-wind-sensible) (test make-parameter/dynamic-wind parameter-value/dynamic-wind with-parametrization/dynamic-wind-sensible)) From smade4 at gmail.com Wed Jun 3 23:36:46 2009 From: smade4 at gmail.com (Glauber Alex Dias Prado) Date: Wed Jun 3 23:37:28 2009 Subject: [plt-scheme] Repl during animation or simulation In-Reply-To: <4A273607.8030901@ccs.neu.edu> (Ryan Culpepper's message of "Wed, 03 Jun 2009 22:48:39 -0400") References: <66c9435a0906031628v79be3d74hc5b78a9d54b4eb91@mail.gmail.com> <4A27288C.90707@ccs.neu.edu> <66c9435a0906031908l1c98c280g34b5020047c511b2@mail.gmail.com> <4A273607.8030901@ccs.neu.edu> Message-ID: <87k53shdpt.fsf@gmail.com> Ryan Culpepper writes: > Greg Santucci wrote: >> On Thu, Jun 4, 2009 at 12:51 PM, Ryan Culpepper wrote: >> >>> The alternative is to create a separate thread for your program's >>> execution. While it's running in the other thread, you can execute commands >>> in the REPL that change its behavior. PLT Scheme has many options for >>> managing concurrency and communication, from semaphores to channels >>> (synchronous and asynchronous) and synchronizable events. >>> >>> >> That's good to hear. How do you launch your app in a separate thread from >> the REPL? Is there an example of what you're describing? > > It's easiest if you've already created a main function that starts all > the work. Suppose it's called 'run-simulation'. Then instead of > something like this > > (run-simulation some-arguments) > > to start it in a new thread, write this instead: > > (thread (lambda () (run-simulation some-arguments))) > > There are some distantly related examples of threads in "More: Systems > Programming with PLT Scheme" in the help desk: > > http://docs.plt-scheme.org/more/ > > Ryan > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme Fluxus use this feature to enable live-coding "in the loop" :), you can take a look at it and maybe borrow some ideas or even "ab"use it. Take a look at it from www.pawfal.org/fluxus. cheers, glauber. From mellowfish at gmail.com Thu Jun 4 00:04:02 2009 From: mellowfish at gmail.com (Christopher Coleman) Date: Thu Jun 4 00:12:42 2009 Subject: [plt-scheme] first request Message-ID: Hey all, I've been dabbling in scheme for a while now and have decided to start a bigger project now that I am comfortable with the basics. As part of a natural language processing AI I am working on, I'd like to have the AI edit its own code on the fly as needed. (yes I know this is not a very good idea, but it fits with what I am trying to accomplish with this iteration). While the program is running, this is easy: just set! the new definitions over the old ones, but how would I go about saving all these new definitions into a new module file for a subsequent run to use? Is there an easier way to export a loaded module than just writing the definition expressions as strings to a file? It seems like I would need to know at least all the definition labels, which is going to be problematic if the program makes new ones that it names itself. Sorry if this has an obvious solution, I have been searching help files across the net for a few days and cant seem to come up with a good idea myself. From thecodewitch at gmail.com Thu Jun 4 00:21:08 2009 From: thecodewitch at gmail.com (Greg Santucci) Date: Thu Jun 4 00:21:30 2009 Subject: [plt-scheme] Repl during animation or simulation In-Reply-To: <4A273607.8030901@ccs.neu.edu> References: <66c9435a0906031628v79be3d74hc5b78a9d54b4eb91@mail.gmail.com> <4A27288C.90707@ccs.neu.edu> <66c9435a0906031908l1c98c280g34b5020047c511b2@mail.gmail.com> <4A273607.8030901@ccs.neu.edu> Message-ID: <66c9435a0906032121p452ca0d9y1dcafb67e15ed0cf@mail.gmail.com> Resending: Thank you very much for that! After RTFM, I found it there as well: http://docs.plt-scheme.org/reference/threads.html#(part._.Creating_.Threads) http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090604/d3e3b060/gears.objis a version of gears.ss I tried to attach to my previous post. It allows you to do things like this at the REPL: (send c move-left) (send c run) Regards, Greg -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090604/f9412ba6/attachment.htm From thecodewitch at gmail.com Thu Jun 4 00:24:25 2009 From: thecodewitch at gmail.com (Greg Santucci) Date: Thu Jun 4 00:24:48 2009 Subject: [plt-scheme] Repl during animation or simulation In-Reply-To: <87k53shdpt.fsf@gmail.com> References: <66c9435a0906031628v79be3d74hc5b78a9d54b4eb91@mail.gmail.com> <4A27288C.90707@ccs.neu.edu> <66c9435a0906031908l1c98c280g34b5020047c511b2@mail.gmail.com> <4A273607.8030901@ccs.neu.edu> <87k53shdpt.fsf@gmail.com> Message-ID: <66c9435a0906032124g17aa3a67nee647fa5d483dbf2@mail.gmail.com> > Fluxus use this feature to enable live-coding "in the loop" :), you can > take a look at it and maybe borrow some ideas or even "ab"use it. Take a > look at it from www.pawfal.org/fluxus. > > cheers, > glauber. > A Win32 version became available recently, and its excellent. I'm glad I'm able to do the same thing in PLT Scheme. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090604/2fed7430/attachment.html From ryanc at ccs.neu.edu Thu Jun 4 02:04:43 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Thu Jun 4 02:05:13 2009 Subject: [plt-scheme] composable continuations and dynamic state In-Reply-To: <20090604030941.2B9439828B@pluto.mumble.net> References: <20090604030941.2B9439828B@pluto.mumble.net> Message-ID: <4A2763FB.5000209@ccs.neu.edu> Taylor R Campbell wrote: > In the following test of the interaction between dynamic state and > composable continuations, I observed a difference between dynamic > bindings established through parameters and PARAMETRIZE, and dynamic > bindings established through DYNAMIC-WIND. With DYNAMIC-WIND the test > behaves as I expect; with PARAMETRIZE it does not. > > [snip definition of test] > > Below are the implementations of the arguments MAKE-PARAMETER, > PARAMETER-VALUE, and WITH-PARAMETRIZATION, but first, a summary of > results: > > parametrize dynamic-wind > > (1 a0 initial-b) (1 a0 initial-b) > (2 a0 b0) (2 a0 b0) > (3 a0 initial-b) (3 a0 initial-b) > (4 initial-a initial-b) (4 initial-a initial-b) > (5 a0 b0) (5 initial-a b0) > (6 a0 b0) (6 a1 b0) > (7 a0 b0) (7 initial-a b0) > > The following definitions are all obvious. Both naive and sensible > DYNAMIC-WIND implementations yield identical output. I am aware that > there is an extra layer of indirection in the use of parameters, since > continuation marks map parameters to thread cells, which threads map > to values, and PARAMETRIZE only binds the parameters to fresh thread > cells in the continuation marks. However, since there is only dynamic > binding and no mutation in the above TEST procedure, I think that > every thread cell in question will only ever have a single value. > (This is the same reason for why the naive and sensible DYNAMIC-WIND > implementations yield identical output.) The thread cell indirection is, as you surmised, totally irrelevant to the results. You're seeing the effects of another indirection, the "parameterization". Parameter-value associations are not stored individually in the continuation. Instead, the continuation contains "parameterizations", or mappings of all parameters to their current values (really, to their currently associated thread-cells). Consequently, when you separate a continuation into parts, you do *not* separate the parameter updates belonging to those parts. Here's a re-implementation of parameters, without the mutation/thread-cell behavior. You'll need to know about PLT Scheme's continuation marks to follow; they're basically special annotation frames that you can drop onto your context (using 'with-continuation-mark') and read (here, using 'continuation-mark-set-first'). Note that 'hash-set' is a functional update on an immutable mapping. ;; A (Param-of X) is (make-param X) (define-struct param (init)) ;; A Parameterization is (hash-of (exists X) (Param-of X) => X) ;; param-value : (Param-of X) -> X (define (param-value p) (let ([paramz (get-paramz)]) (hash-ref paramz p (lambda () (param-init p))))) ;; get-paramz : -> Parameterization (define (get-paramz) (or (continuation-mark-set-first #f 'paramz) (make-immutable-hasheq null))) ;; call-with-param : (Param-of X) X (-> Y) -> Y (define (call-with-param p v k) (with-continuation-mark 'paramz (hash-set (get-paramz) p v) (k))) (display "-- parameters\n") (test make-param param-value call-with-param) Here's an implementation of individually-varying "dynamic variables". They have the same behavior as 'dynamic-wind' in your tests. ;; A (Dynamic-of X) is (make-dynamic X) (define-struct dynamic (init)) ;; dynamic-value : (Dynamic-of X) -> X (define (dynamic-value d) (let ([v (continuation-mark-set-first #f d)]) (if v (car v) (dynamic-init d)))) ;; call-with-dynamic : (Dynamic-of X) X (-> Y) -> Y (define (call-with-dynamic d v k) (with-continuation-mark d (list v) (k))) (display "-- dynamic variables\n") (test make-dynamic dynamic-value call-with-dynamic) Ryan From DekuDekuplex at Yahoo.com Thu Jun 4 04:09:01 2009 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Thu Jun 4 04:09:40 2009 Subject: [plt-scheme] some progress in identifying cause of DrScheme file explorer intermittent freezing problem on Japanese version of Windows XP Pro, Service Pack 3 Message-ID: Yesterday and today, I was able to make some headway in identifying a possible cause of the DrScheme file explorer intermittent freezing problem on the Japanese version of Windows XP Professional, Service Pack 3. (For those of you unfamiliar with this problem, this is a bug that occurs apparently only on the Japanese version of Windows XP Professional in which the file explorer dialog box in DrScheme (the dialog box that displays whenever a file is opened or saved) freezes for about five seconds intermittently every ten seconds or so, and makes it almost impossible to concentrate on Scheme programming when using DrScheme.) Up to now, I had thought that the cause of this problem was multiple mapped network drives, independent of the language for the operating system. However, yesterday I accidentally came across a Japanese-language blog for installing an alternative implementation of Scheme (see http://kayui.blog38.fc2.com/blog-entry-45.html (in Japanese)) in which the author apparently wrote about the same problem, as follows (in Japanese, followed by my translation into English): original Japanese text: >DrSchemeはすぐに固まっていい加減うっとおしいのでlinuxでemacs+gaucheな環境で >schemeの勉強をしていたんだけどいちいちlinuxを立ち上げるのもこれまたうっとおしい! >というわけで何とかwindows上でemacs+gaucheライクな環境を築けないかともにょ >もにょ試してみた。 my translation into English: >DrScheme quickly freezes and is becoming too annoying, so I've been >studying Scheme in an Emacs+Gauche environment on Linux, but it's also >annoying having to start up Linux each time! >Therefore, I've been fiddling around in somehow trying to set up an >Emacs+Gauche-like environment on Windows. Apparently, I'm not the only one troubled by this problem. Just now, I also discovered another reference to a freezing problem for DrScheme on the Japanese version of Windows XP (see Comment #117 at "Lisp Scheme Part21" at http://www.bookshelf.jp/2ch/tech/1207300697.html (also in Japanese, followed by my translation into English): original Japanese text: >117デフォルトの名無しさんsage2008/04/12(土) 05:42:17 > XPなんですがDr.Schemeを放置しておくと勝手にメモリがんがん食ってフリーズします。 my translation into English: >Comment #117 By Default Nameless follow-up April 12, 2008 (Sat.) 05:42:17 > Regarding XP, if Dr.Scheme is left unattended, it eats up memory at >breakneck speed on its own and freezes. In addition, earlier today I discovered an essary, written by Shiro Kawai, the developer of Gauche, who used to work at Square USA (now Square-Enix, a game development company), that described incompatibilities between the English and Japanese versions of Windows (see "Tracking Assets in the Production of 'Final Fantasy : The Spirits Within'" at http://www.lava.net/~shiro/Private/essay/gdc2002.html): >2.3 Multilingual environment > >Our staff came from over 20 different countries, but most people spoke >English and/or Japanese, so those two were the 'official' communication >languages. This environment affected our choice of software platforms; >for example, we had to develop tools and web CGI programs that could >handle both language (or at least not to break while dealing with >Japanese). Some off-the-shelf software packages were excluded from >the options because of this. For client side programs we had to make the >tools run on both English OS and Japanese OS. Back then, Windows had >some nasty incompatibilities between those two versions that bit us many >times. It seems that DrScheme, in its present state, is incompatible with the Japanese version of Windows XP, and is plagued with freezing problems specifically on that language-platform. Therefore, unless these problems are tested specifically on the Japanese version of Windows XP, as opposed to the English version, they are unlikely to be solved, and at least some Japanese users who would otherwise use DrScheme will continue to migrate to such alternative implementations as Gauche. -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ From eli at barzilay.org Thu Jun 4 04:54:50 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Jun 4 04:55:30 2009 Subject: [plt-scheme] some progress in identifying cause of DrScheme file explorer intermittent freezing problem on Japanese version of Windows XP Pro, Service Pack 3 In-Reply-To: References: Message-ID: <18983.35802.660708.154227@winooski.ccs.neu.edu> On Jun 4, Benjamin L.Russell wrote: > > It seems that DrScheme, in its present state, is incompatible with > the Japanese version of Windows XP, and is plagued with freezing > problems specifically on that language-platform. Therefore, unless > these problems are tested specifically on the Japanese version of > Windows XP, as opposed to the English version, they are unlikely to > be solved, and at least some Japanese users who would otherwise use > DrScheme will continue to migrate to such alternative > implementations as Gauche. Unfortunately, we are far from having the kind of resources for testing and/or debugging problems that are specific to an OS/language. In the department of "exotic languages" there are active people on the group who might use German, Thai, Chinese, and Hebrew -- yet I don't believe that anyone have seen the problem you're talking about. (I'm saying "might" because even if I'm in Israel, I'm likely to use machines that have an English OS installed, since many developers prefer it.) It would therefore be very helpful if anyone can provide some useful information about the source of the problem. I remember that you've written detailed explanations on how to get the problem, and what happens, but I'm talking about something more concrete, like identifying the system call that causes the delay. (I think that I talked about how `strace' on linux is very effective in finding out sources of such delays -- and I still don't know about any Windows utility that does the same thing.) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From DekuDekuplex at Yahoo.com Thu Jun 4 05:52:41 2009 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Thu Jun 4 05:53:38 2009 Subject: [plt-scheme] Re: some progress in identifying cause of DrScheme file explorer intermittent freezing problem on Japanese version of Windows XP Pro, Service Pack 3 References: <18983.35802.660708.154227@winooski.ccs.neu.edu> Message-ID: On Thu, 4 Jun 2009 04:54:50 -0400, Eli Barzilay wrote: >[...] > >It would therefore be very helpful if anyone can provide some useful >information about the source of the problem. I remember that you've >written detailed explanations on how to get the problem, and what >happens, but I'm talking about something more concrete, like >identifying the system call that causes the delay. (I think that I >talked about how `strace' on linux is very effective in finding out >sources of such delays -- and I still don't know about any Windows >utility that does the same thing.) Actually, there is StraceNT, which actually works on Windows XP (see http://www.intellectualheaven.com/default.asp?BH=projects&H=strace.htm). I had already downloaded and unzipped the application some while ago, but had not used it much yet. If someone can tell me what to do with it, I'll be happy to attach it to a DrScheme process on my Japanese version of Windows XP to help diagnose this bug. -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ From eli at barzilay.org Thu Jun 4 06:05:53 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Jun 4 06:06:13 2009 Subject: [plt-scheme] Re: some progress in identifying cause of DrScheme file explorer intermittent freezing problem on Japanese version of Windows XP Pro, Service Pack 3 In-Reply-To: References: <18983.35802.660708.154227@winooski.ccs.neu.edu> Message-ID: <18983.40065.134100.631725@winooski.ccs.neu.edu> On Jun 4, Benjamin L.Russell wrote: > > Actually, there is StraceNT, which actually works on Windows XP (see > http://www.intellectualheaven.com/default.asp?BH=projects&H=strace.htm). > > I had already downloaded and unzipped the application some while > ago, but had not used it much yet. If someone can tell me what to > do with it, I'll be happy to attach it to a DrScheme process on my > Japanese version of Windows XP to help diagnose this bug. Well, that looks very close to the linux strace. The way I use it is to run an application with it (or attach to an already running process), and keep the output window visible -- there will be a stream of printouts going fast there but when there's something stuck then usually the output will be also stuck showing the last system call that causes the delay. At this point you can glance through the last few lines and see if there are any system calls that look suspicious. [For example, the first time I used it successfully (a long time ago) was with Emacs -- it would occasionally freeze in an annoying way. When I ran it under strace, I noticed that it was doing stuff with lock files, which were in my home directory, mounted from the department NFS server (Emacs will create a lock file every time a file is modified, and remove it when you save the file). Since I didn't need these locks to work across multiple machines, the simple solution was to set things up so the lockfiles would be saved in a directory local to the machine, and things worked fine with that.] -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From noelwelsh at gmail.com Thu Jun 4 06:10:03 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Jun 4 06:10:35 2009 Subject: [plt-scheme] Repl during animation or simulation In-Reply-To: <66c9435a0906032124g17aa3a67nee647fa5d483dbf2@mail.gmail.com> References: <66c9435a0906031628v79be3d74hc5b78a9d54b4eb91@mail.gmail.com> <4A27288C.90707@ccs.neu.edu> <66c9435a0906031908l1c98c280g34b5020047c511b2@mail.gmail.com> <4A273607.8030901@ccs.neu.edu> <87k53shdpt.fsf@gmail.com> <66c9435a0906032124g17aa3a67nee647fa5d483dbf2@mail.gmail.com> Message-ID: On Thu, Jun 4, 2009 at 5:24 AM, Greg Santucci wrote: > A Win32 version became available recently, and its excellent. I'm glad I'm > able to do the same thing in PLT Scheme. Just in case: Fluxus is written in PLT Scheme. Your statement above suggests you aren't aware of this. N. From DekuDekuplex at Yahoo.com Thu Jun 4 06:24:31 2009 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Thu Jun 4 06:25:17 2009 Subject: [plt-scheme] Re: some progress in identifying cause of DrScheme file explorer intermittent freezing problem on Japanese version of Windows XP Pro, Service Pack 3 References: <18983.35802.660708.154227@winooski.ccs.neu.edu> <18983.40065.134100.631725@winooski.ccs.neu.edu> Message-ID: <1j7f251mfqobjo1699ss95l8mmdjat3d79@4ax.com> On Thu, 4 Jun 2009 06:05:53 -0400, Eli Barzilay wrote: >On Jun 4, Benjamin L.Russell wrote: >> >> Actually, there is StraceNT, which actually works on Windows XP (see >> http://www.intellectualheaven.com/default.asp?BH=projects&H=strace.htm). >> >> I had already downloaded and unzipped the application some while >> ago, but had not used it much yet. If someone can tell me what to >> do with it, I'll be happy to attach it to a DrScheme process on my >> Japanese version of Windows XP to help diagnose this bug. > >Well, that looks very close to the linux strace. The way I use it is >to run an application with it (or attach to an already running >process), and keep the output window visible -- there will be a stream >of printouts going fast there but when there's something stuck then >usually the output will be also stuck showing the last system call >that causes the delay. At this point you can glance through the last >few lines and see if there are any system calls that look suspicious. > >[For example, the first time I used it successfully (a long time ago) >was with Emacs -- it would occasionally freeze in an annoying way. >When I ran it under strace, I noticed that it was doing stuff with >lock files, which were in my home directory, mounted from the >department NFS server (Emacs will create a lock file every time a file >is modified, and remove it when you save the file). Since I didn't >need these locks to work across multiple machines, the simple solution >was to set things up so the lockfiles would be saved in a directory >local to the machine, and things worked fine with that.] Splendid! That makes sense. Okay, I just attached StraceNT to the DrScheme.exe process after navigating to the File -> Open... menu item in DrScheme, and as soon as DrScheme froze in the "Select a file" dialog box, stopped the trace. Here is what the trace showed just before the trace was stopped: ----- beginning of traced portion begins here ----- [T3164] GetCurrentPositionEx(33010fda, 12b594, 12b804, 73fd0250, ...) = 1 [T3164] SetTextAlign(33010fda, 0, 12b804, 73fd0250, ...) = 1 [T2948] ReadProcessMemory(2f0, 253f80, 1abbcf2c, 50, ...) [T3164] MoveToEx(33010fda, 0, 0, 0, ...) = 1 [T3164] SetTextAlign(33010fda, 0, 12b804, 73fd0250, ...) = 0 [T3164] SetBkMode(33010fda, 2, 12b804, 73fd0250, ...) = 1 = 0 [T3164] ScriptStringFree(12be30, 0, 12c520, 12be78, ...) [T3164] InterlockedExchange(73fc5020, 1, 12b7b4, 73f942e8, ...) = 0 = 0 = 1 [T2948] ReadProcessMemory(2f0, 254028, 1abbcf2c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2540d0, 1abbcf2c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 254178, 1abbcf2c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 254218, 1abbcf2c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2542c0, 1abbcf2c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2543c0, 1abbcf2c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf58, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf5c, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 21306, 1abbcfe8, 1a, ...) = 1 [T3164] ExtTextOutW(55010e51, 7, 3, 0, ...) [T3164] GetTextAlign(55010e51, 0, 10000, 0, ...) = 0 [T3164] GetLayout(55010e51, 0, 10000, 0, ...) = 0 [T3164] ScriptIsComplex(12beb0, 4, 1, 0, ...) = 1 [T3164] GdiRealizationInfo(55010e51, 12b6f8, 0, 0, ...) [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf24, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf28, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf58, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf5c, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 7c962178, 1abbcfe8, 14, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf24, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf28, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf58, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf5c, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251fc0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f98, 1abbcfe8, 1a, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf24, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf28, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251fc0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf58, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf5c, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251fc0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252068, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252040, 1abbcfe8, 1a, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf24, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf28, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251fc0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252068, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf58, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf5c, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251fc0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252068, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252108, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2520e8, 1abbcfe8, 16, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf24, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf28, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251fc0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252068, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252108, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf58, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf5c, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251fc0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252068, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252108, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2521a8, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252188, 1abbcfe8, 18, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf24, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf28, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251fc0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252068, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252108, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2521a8, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf58, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf5c, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251fc0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252068, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252108, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2521a8, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252248, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252228, 1abbcfe8, 16, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf24, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf28, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251fc0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252068, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252108, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2521a8, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252248, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf58, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf5c, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251fc0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252068, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252108, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2521a8, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252248, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2522e8, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2522c8, 1abbcfe8, 14, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf24, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf28, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251fc0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252068, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252108, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2521a8, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252248, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2522e8, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf58, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf5c, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251fc0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252068, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252108, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2521a8, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252248, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2522e8, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252388, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252368, 1abbcfe8, 14, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf24, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf28, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251fc0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252068, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252108, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2521a8, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252248, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2522e8, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252388, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf58, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf5c, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251fc0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252068, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252108, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2521a8, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252248, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2522e8, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252388, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252420, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252408, 1abbcfe8, 10, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf24, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf28, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251fc0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252068, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252108, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2521a8, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252248, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2522e8, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252388, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252420, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf58, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf5c, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251fc0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252068, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252108, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2521a8, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252248, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2522e8, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252388, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252420, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2524c0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2524a0, 1abbcfe8, 14, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf24, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf28, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251fc0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252068, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252108, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2521a8, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252248, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2522e8, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252388, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252420, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2524c0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf58, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf5c, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251fc0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252068, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252108, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2521a8, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252248, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2522e8, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252388, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252420, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2524c0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252578, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 25253e, 1abbcfe8, 2c, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf24, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf28, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251fc0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252068, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252108, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2521a8, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252248, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2522e8, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252388, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252420, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2524c0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252578, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf58, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf5c, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251fc0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252068, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252108, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2521a8, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252248, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2522e8, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252388, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252420, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2524c0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252578, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252618, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2525f8, 1abbcfe8, 16, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf24, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf28, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251fc0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252068, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252108, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2521a8, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252248, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2522e8, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252388, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252420, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2524c0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252578, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252618, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf58, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf5c, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251fc0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252068, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252108, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2521a8, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252248, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2522e8, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252388, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252420, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2524c0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252578, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252618, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2526b8, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252698, 1abbcfe8, 16, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf24, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf28, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251fc0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252068, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252108, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2521a8, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252248, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2522e8, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252388, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252420, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2524c0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252578, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252618, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2526b8, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf58, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf5c, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251fc0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252068, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252108, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2521a8, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252248, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2522e8, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252388, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252420, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2524c0, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252578, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252618, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2526b8, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252758, 1abbcf74, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252738, 1abbcfe8, 18, ...) = 1 [T2948] ReadProcessMemory(2f0, 7ffdf00c, 1abbcf24, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ea4, 1abbcf28, 4, ...) = 1 [T2948] ReadProcessMemory(2f0, 251ec0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251f18, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 251fc0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252068, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252108, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2521a8, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252248, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2522e8, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252388, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252420, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2524c0, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252578, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 252618, 1abbcf4c, 50, ...) = 1 [T2948] ReadProcessMemory(2f0, 2526b8, 1abbcf4c, 50, ...) Tracing of the process stopped. ----- end of traced portion ends here ----- Apparently, a call to "ReadProcessMemory(2f0, 252618, 1abbcf4c, 50, ...) = 1" is being repeatedly executed, during which time the DrScheme.exe process freezes in the "Select a file" dialog box. Mysteriously, after about 5 seconds, the repetition stops, and the user is able to navigate freely for about 10 seconds until the next freeze, which again lasts for about 5 seconds. Would you like me to put up the entire trace file on some file server so that you can download it? -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ From eli at barzilay.org Thu Jun 4 06:33:55 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Jun 4 06:34:16 2009 Subject: [plt-scheme] Re: some progress in identifying cause of DrScheme file explorer intermittent freezing problem on Japanese version of Windows XP Pro, Service Pack 3 In-Reply-To: <1j7f251mfqobjo1699ss95l8mmdjat3d79@4ax.com> References: <18983.35802.660708.154227@winooski.ccs.neu.edu> <18983.40065.134100.631725@winooski.ccs.neu.edu> <1j7f251mfqobjo1699ss95l8mmdjat3d79@4ax.com> Message-ID: <18983.41747.372099.756720@winooski.ccs.neu.edu> On Jun 4, Benjamin L.Russell wrote: > On Thu, 4 Jun 2009 06:05:53 -0400, Eli Barzilay > > Here is what the trace showed just before the trace was stopped: > [...] > > Apparently, a call to "ReadProcessMemory(2f0, 252618, 1abbcf4c, 50, > ...) = 1" is being repeatedly executed, during which time the > DrScheme.exe process freezes in the "Select a file" dialog box. > > Mysteriously, after about 5 seconds, the repetition stops, and the > user is able to navigate freely for about 10 seconds until the next > freeze, which again lasts for about 5 seconds. Yes, that's *much* better than a description of how it gets stuck -- for example, it's unlikely that the cause is a networked filesystem. (And something that looks strange to me is that the address that is read is low.) > Would you like me to put up the entire trace file on some file server > so that you can download it? At this point I'll let Matthew see if there's anything that looks suspicious and/or see if a complete log will be helpful. One thing that might help as well is adding timestamps or something similar to the log so it is visible exactly where things get stuck. (But I'd wait for Matthew's input before putting up a huge log file.) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From thecodewitch at gmail.com Thu Jun 4 06:54:55 2009 From: thecodewitch at gmail.com (Greg Santucci) Date: Thu Jun 4 06:55:14 2009 Subject: [plt-scheme] Repl during animation or simulation In-Reply-To: References: <66c9435a0906031628v79be3d74hc5b78a9d54b4eb91@mail.gmail.com> <4A27288C.90707@ccs.neu.edu> <66c9435a0906031908l1c98c280g34b5020047c511b2@mail.gmail.com> <4A273607.8030901@ccs.neu.edu> <87k53shdpt.fsf@gmail.com> <66c9435a0906032124g17aa3a67nee647fa5d483dbf2@mail.gmail.com> Message-ID: <66c9435a0906040354w4af2fe69w6dde707d0ed754e@mail.gmail.com> On Thu, Jun 4, 2009 at 8:10 PM, Noel Welsh wrote: > On Thu, Jun 4, 2009 at 5:24 AM, Greg Santucci > wrote: > > A Win32 version became available recently, and its excellent. I'm glad > I'm > > able to do the same thing in PLT Scheme. > > Just in case: Fluxus is written in PLT Scheme. Your statement above > suggests you aren't aware of this. > > N. > When I say PLT Scheme, I am referring to the "DrScheme" repl, built on the same PLT Scheme fluxus uses. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090604/32cd6e11/attachment.htm From noelwelsh at gmail.com Thu Jun 4 08:03:04 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Jun 4 08:03:29 2009 Subject: [plt-scheme] first request In-Reply-To: References: Message-ID: On Thu, Jun 4, 2009 at 5:04 AM, Christopher Coleman wrote: > Is there an easier way to export a > loaded module than just writing the definition expressions as strings > to a file? Not that I know of. For most values you can use write and read as inverse operations. This won't work for functions. > It seems like I would need to know at least all the > definition labels, which is going to be problematic if the program > makes new ones that it names itself. How can you write a Scheme program that refers to bindings that are not present in the source code? You can't. [Actually you can but it is generally a very bad idea so I don't think it will be productive for you to do so while learning more Scheme.] N. From jay.mccarthy at gmail.com Thu Jun 4 08:17:39 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Jun 4 08:18:01 2009 Subject: [plt-scheme] first request In-Reply-To: References: Message-ID: On Thu, Jun 4, 2009 at 6:03 AM, Noel Welsh wrote: > On Thu, Jun 4, 2009 at 5:04 AM, Christopher Coleman > wrote: >> Is there an easier way to export a >> loaded module than just writing the definition expressions as strings >> to a file? > > Not that I know of. For most values you can use write and read as > inverse operations. This won't work for functions. If you write it in the web-server language (which really isn't that tied to the web-server) then functions you author can be written and read with scheme/serialize. Jay -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From tilde at naver.com Thu Jun 4 08:29:31 2009 From: tilde at naver.com (=?US-ASCII?B?Sm9v?=) Date: Thu Jun 4 08:36:38 2009 Subject: [plt-scheme] String port prodecure comparison between R6RS and SRFI Message-ID: There are too much peformance differences between srfi-6 and R6RS string port library in comparison with other R6RS conforming implementation. I'd like to know whether they result from R6RS library itself or Mzscheme. Welcome to MzScheme v4.2 [3m], Copyright (c) 2004-2009 PLT Scheme Inc. > (define-syntax dotimes (syntax-rules () ((dotimes (i count) b d ...) (do ((i 0 (+ i 1))) ((= i count)) b d ...)) ((dotimes count b d ...) (dotimes (i count) b d ...)))) > (time (dotimes 1000000 (get-output-string (let ((port (open-output-string))) (write "abc" port) port)))) cpu time: 1343 real time: 1343 gc time: 126 > (require rnrs) > (time (dotimes 1000000 (call-with-string-output-port (lambda (port) (write "abc" port) port)))) cpu time: 21109 real time: 21109 gc time: 4519 > (time (dotimes 1000000 (call-with-values (lambda () (open-string-output-port)) (lambda (port proc) (write "abc" port) proc)))) cpu time: 22625 real time: 22625 gc time: 7346 > (time (dotimes 1000000 (get-output-string (let ((port (open-output-string))) (write "abc" port) port)))) put-datum: expected argument of type ; given # Ypsilon 0.9.6-update3 Copyright (c) 2008 Y.Fujita, LittleWing Company Limited. > (import (time)) > (import (srfi srfi-6)) > (time (dotimes 1000000 (get-output-string (let ((port (open-output-string))) (write "abc" port) port)))) ;; 2.375 real 4.28125 user 0.015625 sys > (time (dotimes 1000000 (call-with-string-output-port (lambda (port) (write "abc" port) port)))) ;; 3.656252 real 5.8125 user 0.03125 sys > (time (dotimes 1000000 (call-with-values (lambda () (open-string-output-port)) (lambda (port proc) (write "abc" port) proc)))) ;; 2.546875 real 4.4375 user 0.0625 sys -- -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090604/34890684/attachment.html From mellowfish at gmail.com Thu Jun 4 09:37:43 2009 From: mellowfish at gmail.com (Christopher Coleman) Date: Thu Jun 4 09:38:23 2009 Subject: [plt-scheme] first request In-Reply-To: References: Message-ID: I'll give that a try Jay, thanks. Also, Noel: I realised how stupid I was to say that I couldn't keep track of dynamically created functions as soon as the email went out. Lack of experience thinking in scheme. Sorry. From matthias at ccs.neu.edu Thu Jun 4 10:10:58 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Jun 4 10:12:14 2009 Subject: [plt-scheme] composable continuations and dynamic state In-Reply-To: <20090604030941.2B9439828B@pluto.mumble.net> References: <20090604030941.2B9439828B@pluto.mumble.net> Message-ID: <1EC70ABD-CE55-4A9C-8F4D-5146D2733BB9@ccs.neu.edu> On Jun 3, 2009, at 11:09 PM, Taylor R Campbell wrote: > However, since there is only dynamic binding and no mutation in the > above TEST procedure, Just in case this isn't clear: dynamic binding is a complete, total misnomer in Scheme. We don't have dynamic binding in the classical Lisp sense, never had since 1986. A dynamic binding in Scheme is _temporary assignment_. So your sentence doesn't make sense. Perhaps it's clear to you, in that case ignore it. -- Matthias From erich at snafu.de Thu Jun 4 10:25:17 2009 From: erich at snafu.de (Erich Rast) Date: Thu Jun 4 10:18:20 2009 Subject: [plt-scheme] Repl during animation or simulation In-Reply-To: <66c9435a0906032124g17aa3a67nee647fa5d483dbf2@mail.gmail.com> References: <66c9435a0906031628v79be3d74hc5b78a9d54b4eb91@mail.gmail.com> <4A27288C.90707@ccs.neu.edu> <66c9435a0906031908l1c98c280g34b5020047c511b2@mail.gmail.com> <4A273607.8030901@ccs.neu.edu> <87k53shdpt.fsf@gmail.com> <66c9435a0906032124g17aa3a67nee647fa5d483dbf2@mail.gmail.com> Message-ID: <1244125517.6645.7.camel@darkstar> > Fluxus use this feature to enable live-coding "in the loop" :), I know I should be asking this on the fluxus mailing list, but while we're at it...Fluxus own scratchpad is just not usable for developing larger programs. The docs on the fluxus page say you should compile your own binary, but with all the dependencies I'll likely never get this to work. So is there any downloadable OS X binary for DrScheme with Fluxus built-in? Best, Erich From chaguidiao at gmail.com Thu Jun 4 10:24:46 2009 From: chaguidiao at gmail.com (chaguidiao) Date: Thu Jun 4 11:25:35 2009 Subject: [plt-scheme] Preventing built-in functions to be redefined Message-ID: <6143744d-d070-4eed-ac13-a22842ebe5fc@e24g2000vbe.googlegroups.com> Hi I am fairly new in Scheme. May I know if it is possible to restrict the redefinition of the built-in function, or if possible, make any other user-defined functions non-writable? Pardon me for being a little paranoid, but the fact that (define define 5) actually making "define" equals to 5 is just somewhat alarming to me. Thanks. nandehutu From campbell at mumble.net Thu Jun 4 11:21:46 2009 From: campbell at mumble.net (Taylor R Campbell) Date: Thu Jun 4 11:26:01 2009 Subject: [plt-scheme] composable continuations and dynamic state In-Reply-To: <4A2763FB.5000209@ccs.neu.edu> (ryanc@ccs.neu.edu) Message-ID: <20090604152148.94EFB9828B@pluto.mumble.net> [By the way, thanks for cc'ing me -- I forgot to mention in my first message that I am not subscribed to the list.] Date: Thu, 04 Jun 2009 02:04:43 -0400 From: Ryan Culpepper The thread cell indirection is, as you surmised, totally irrelevant to the results. You're seeing the effects of another indirection, the "parameterization". Parameter-value associations are not stored individually in the continuation. Instead, the continuation contains "parameterizations", or mappings of all parameters to their current values (really, to their currently associated thread-cells). Consequently, when you separate a continuation into parts, you do *not* separate the parameter updates belonging to those parts. OK, thanks: now I understand the mechanism yielding the output shown. My next question is about the rationale: Why are DYNAMIC-WIND state points only partially preserved, whereas parametrizations are fully preserved? I did a couple more tests, with some surprising results, showing that `fully preserved' is not quite right in the previous question, and actually I mean `fully preserved or not preserved at all'. The first test is to compare the values of the following two expressions: (let ((parameter (make-parameter 'foo)) (prompt-tag (make-continuation-prompt-tag))) (let ((f (parameterize ((parameter 'bar)) (call-with-continuation-prompt (lambda () (call-with-composable-continuation (lambda (continuation) (abort-current-continuation prompt-tag (lambda () continuation))) prompt-tag) (parameter)) prompt-tag)))) (f))) ;Value: foo (let ((parameter (make-parameter 'foo)) (prompt-tag (make-continuation-prompt-tag))) (let ((f (parameterize ((parameter 'bar)) (call-with-continuation-prompt (lambda () ;** Here is the only difference. (parameterize (((make-parameter 'mumble) 'frotz)) (call-with-composable-continuation (lambda (continuation) (abort-current-continuation prompt-tag (lambda () continuation))) prompt-tag) (parameter))) prompt-tag)))) (f))) ;Value: bar In lieu of the way parametrizations are implemented, I think I understand the mechanism that yields this result (simply putting a parametrization in the continuation of CWCompC has the effect of saving all the parameters in the composable continuation), but I don't think that makes the high-level behaviour any less surprising. Now, the current semantics of composable continuations and dynamic state suggest to me that a naive user (such as me) might attempt to mix DYNAMIC-WIND and PARAMETRIZE with disastrous results. I don't have a good example of this right now, but here's a pathological one to keep you occupied. Consider a naive recursive mutex in terms of a semaphore and a parameter that tells us whether we already have the mutex locked: (define-struct recursive-mutex (semaphore parameter)) (define (new-recursive-mutex) (make-recursive-mutex (make-semaphore 1) (make-parameter #f))) (define (with-recursive-mutex-locked recursive-mutex thunk) (let ((parameter (recursive-mutex-parameter recursive-mutex))) (if (parameter) ; We own the mutex already. (thunk) (let ((semaphore (recursive-mutex-semaphore recursive-mutex))) (dynamic-wind (lambda () (semaphore-wait semaphore)) (lambda () (parametrize ((parameter #t)) (thunk))) (lambda () (semaphore-post semaphore))))))) We can check whether we actually have it locked by asking the semaphore whether it agrees, using SEMAPHORE-TRY-WAIT? like so: (let ((recursive-mutex (new-recursive-mutex))) (define (test) (write (let ((semaphore (recursive-mutex-semaphore recursive-mutex))) (if (semaphore-try-wait? semaphore) (begin (semaphore-post semaphore) 'no-we-doesnt) 'we-has-it-my-precious))) (newline)) (with-recursive-mutex-locked recursive-mutex test) (test)) As expected, the output is: we-has-it-my-precious no-we-doesnt Now consider the following program using recursive mutexes, and also SEMAPHORE-TRY-WAIT? to discern whether we actually have the mutex locked: (let ((recursive-mutex (new-recursive-mutex)) (prompt-tag (make-continuation-prompt-tag))) (let ((f (with-recursive-mutex-locked recursive-mutex (lambda () (call-with-continuation-prompt (lambda () (parameterize (((make-parameter 'foo) 'bar)) (call-with-composable-continuation (lambda (continuation) (abort-current-continuation prompt-tag (lambda () continuation))) prompt-tag) (with-recursive-mutex-locked recursive-mutex (lambda () (write (let ((semaphore (recursive-mutex-semaphore recursive-mutex))) (if (semaphore-try-wait? semaphore) (begin (semaphore-post semaphore) 'no-we-doesnt) 'we-has-it-my-precious))) (newline))))) prompt-tag))))) (f))) In the call to F at the end, we don't have the recursive mutex locked, and if we call F, it will not attempt to lock the recursive mutex because the composable continuation did not capture the DYNAMIC-WIND in-thunk to do that. But F will nevertheless have the recursive mutex's parameter bound to #T (i.e., it will have continuation marks with a parametrization that maps the recursive mutex's parameter to a thread cell whose value in the current thread is #T), making it think that we have the recursive mutex locked, so that it will not wait for the semaphore when it tries to lock the recursive mutex. Using CALL-WITH-SEMAPHORE rather than DYNAMIC-WIND, SEMAPHORE-WAIT, and SEMAPHORE-POST, has the same effect, by the way. In either case, the output indicates that F failed to lock the mutex. Also, you may observe the curious (parametrize (((make-parameter 'foo) 'bar)) ...) construction. If you take that out, F succeeds in locking the mutex. From matthias at ccs.neu.edu Thu Jun 4 11:32:49 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Jun 4 11:33:19 2009 Subject: [plt-scheme] composable continuations and dynamic state In-Reply-To: <20090604152857.DAC189828B@pluto.mumble.net> References: <20090604152857.DAC189828B@pluto.mumble.net> Message-ID: <7B71BBD1-FD4B-4CC9-878E-1CAD55A0F35B@ccs.neu.edu> No need to apologize. Sadly terminology matters when one tries to clarify things. It's not just semantics as they like to say. -- Matthias On Jun 4, 2009, at 11:28 AM, Taylor R Campbell wrote: > Date: Thu, 4 Jun 2009 10:10:58 -0400 > From: Matthias Felleisen > > On Jun 3, 2009, at 11:09 PM, Taylor R Campbell wrote: > >> However, since there is only dynamic binding and no mutation in the >> above TEST procedure, > > Just in case this isn't clear: dynamic binding is a complete, total > misnomer in Scheme. We don't have dynamic binding in the classical > Lisp sense, never had since 1986. A dynamic binding in Scheme is > _temporary assignment_. So your sentence doesn't make sense. > Perhaps > it's clear to you, in that case ignore it. -- Matthias > > When I said `mutation', I meant `permanent assignment', or at least > the converse of `temporary assignment', i.e. a SET-BOX!, a parameter > assignment, &c., not made temporary by DYNAMIC-WIND, PARAMETRIZE, &c. > I apologize if I caused any confusion by this misuse of terminology. From campbell at mumble.net Thu Jun 4 11:28:55 2009 From: campbell at mumble.net (Taylor R Campbell) Date: Thu Jun 4 11:34:40 2009 Subject: [plt-scheme] composable continuations and dynamic state In-Reply-To: <1EC70ABD-CE55-4A9C-8F4D-5146D2733BB9@ccs.neu.edu> (matthias@ccs.neu.edu) Message-ID: <20090604152857.DAC189828B@pluto.mumble.net> Date: Thu, 4 Jun 2009 10:10:58 -0400 From: Matthias Felleisen On Jun 3, 2009, at 11:09 PM, Taylor R Campbell wrote: > However, since there is only dynamic binding and no mutation in the > above TEST procedure, Just in case this isn't clear: dynamic binding is a complete, total misnomer in Scheme. We don't have dynamic binding in the classical Lisp sense, never had since 1986. A dynamic binding in Scheme is _temporary assignment_. So your sentence doesn't make sense. Perhaps it's clear to you, in that case ignore it. -- Matthias When I said `mutation', I meant `permanent assignment', or at least the converse of `temporary assignment', i.e. a SET-BOX!, a parameter assignment, &c., not made temporary by DYNAMIC-WIND, PARAMETRIZE, &c. I apologize if I caused any confusion by this misuse of terminology. From noelwelsh at gmail.com Thu Jun 4 11:48:17 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Jun 4 11:48:37 2009 Subject: [plt-scheme] Preventing built-in functions to be redefined In-Reply-To: <6143744d-d070-4eed-ac13-a22842ebe5fc@e24g2000vbe.googlegroups.com> References: <6143744d-d070-4eed-ac13-a22842ebe5fc@e24g2000vbe.googlegroups.com> Message-ID: I don't remember if there is a parameter to change this behaviour. One way to get the effect you want is to require the language your module is written. Try this and you'll get an error about redefinition #lang scheme (require scheme) (define define 5) In the years I've been writing Scheme this has never caused a problem for me. N. On Thu, Jun 4, 2009 at 3:24 PM, chaguidiao wrote: > Hi > > I am fairly new in Scheme. ?May I know if it is possible to restrict > the redefinition of the built-in function, or if possible, make any > other user-defined functions non-writable? ?Pardon me for being a > little paranoid, but the fact that (define define 5) actually making > "define" equals to 5 is just somewhat alarming to me. > > Thanks. > nandehutu From morazanm at gmail.com Thu Jun 4 11:53:23 2009 From: morazanm at gmail.com (Marco Morazan) Date: Thu Jun 4 11:54:21 2009 Subject: [plt-scheme] Sad news regarding Peter Landin Message-ID: <9b1fff280906040853t4329d48el5801a24560eed4e0@mail.gmail.com> Dear All, FYI just in case you had not heard. He was one of the great pioneers. Begin forwarded message: > From: Edmund Robinson > Date: 4 June 2009 09:10:11 GMT+00:00 > To: cphc-members@JISCMAIL.AC.UK > Subject: Peter Landin > Reply-To: Edmund Robinson > > I am very sorry to inform you that Peter Landin died yesterday of > natural causes. > > For those members who are several generations away from Peter's > early contributions, he was one of the major figures in the UK at > the time that Computer Science was beginning to establish itself as > a discipline. Some of his papers from 40 years ago are essential > reading for any serious student of programming languages as still > the simplest and clearest exposition of ideas that remain > fundamental. The ideas in his papers were truly original and > beautiful, but Peter never had a simplistic approach to scientific > progress, and would scoff at the idea of individual personal > contribution. Some of his own greatest contribution to the field > was as part of a golden nexus of work on programming languages in > the UK in the late 60's and early 70's, containing Dana Scott and > Christopher Strachey and others as well as Peter. The ideas they > developed through their discussions truly lifted the study of > programming languages to another level, and are now part of the > bedrock of the subject. > > Funeral arrangements are being made by David Bunnett: > replies@booktracker.net > , or if you wish to contact me, I will pass on details. > > all best wishes > Edmund Robinson ------- End of forwarded message ------- Marco From ryanc at ccs.neu.edu Thu Jun 4 12:29:03 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Thu Jun 4 12:29:32 2009 Subject: [plt-scheme] composable continuations and dynamic state In-Reply-To: <20090604152148.94EFB9828B@pluto.mumble.net> References: <20090604152148.94EFB9828B@pluto.mumble.net> Message-ID: <4A27F64F.8030507@ccs.neu.edu> Taylor R Campbell wrote: > [By the way, thanks for cc'ing me -- I forgot to mention in my first > message that I am not subscribed to the list.] > > Date: Thu, 04 Jun 2009 02:04:43 -0400 > From: Ryan Culpepper > > The thread cell indirection is, as you surmised, totally irrelevant to > the results. You're seeing the effects of another indirection, the > "parameterization". Parameter-value associations are not stored > individually in the continuation. Instead, the continuation contains > "parameterizations", or mappings of all parameters to their current > values (really, to their currently associated thread-cells). > Consequently, when you separate a continuation into parts, you do *not* > separate the parameter updates belonging to those parts. > > OK, thanks: now I understand the mechanism yielding the output shown. > My next question is about the rationale: Why are DYNAMIC-WIND state > points only partially preserved, whereas parametrizations are fully > preserved? I suspect the behavior comes from the early days when parameters were first added, when it seemed like first-class parameterizations were a useful feature: capture a parameterization over here, ship it somewhere else and reinstate it there. I thought that they were no longer used, but a search for 'parameterization' in the source tree does turn up a number of hits. It also seems like storing parameterizations might make parameter lookups faster, but I haven't tried to test that conjecture. Perhaps Matthew has? > [...] > > In lieu of the way parametrizations are implemented, I think I > understand the mechanism that yields this result (simply putting a > parametrization in the continuation of CWCompC has the effect of > saving all the parameters in the composable continuation), but I don't > think that makes the high-level behaviour any less surprising. > > Now, the current semantics of composable continuations and dynamic > state suggest to me that a naive user (such as me) might attempt to > mix DYNAMIC-WIND and PARAMETRIZE with disastrous results. I don't > have a good example of this right now, but here's a pathological one > to keep you occupied. Consider a naive recursive mutex in terms of a > semaphore and a parameter that tells us whether we already have the > mutex locked: > [...] In fact, I got bitten by the parameter issue the last time I played with delimited continuations. If you're using delimited continuations, I'd recommend avoiding parameters and using continuation marks or a light abstraction thereof (like the "dynamics" I sent in my previous message). More precisely, avoid using 'parameterize' in code that may be appear in a composable continuation. Ryan From eric.hanchrow at gmail.com Thu Jun 4 13:21:44 2009 From: eric.hanchrow at gmail.com (Eric Hanchrow) Date: Thu Jun 4 13:27:38 2009 Subject: [plt-scheme] composable continuations and dynamic state In-Reply-To: <1EC70ABD-CE55-4A9C-8F4D-5146D2733BB9@ccs.neu.edu> References: <20090604030941.2B9439828B@pluto.mumble.net> <1EC70ABD-CE55-4A9C-8F4D-5146D2733BB9@ccs.neu.edu> Message-ID: <36366a980906041021i88046f5q4d7babfa5768bdf7@mail.gmail.com> On Thu, Jun 4, 2009 at 7:10 AM, Matthias Felleisen wrote: > > We don't have dynamic binding in the classical Lisp sense, never > had since 1986. A dynamic binding in Scheme is _temporary assignment_. Oops. I'd always thought they were the same thing. What's the difference? From namekuseijin at gmail.com Thu Jun 4 13:33:10 2009 From: namekuseijin at gmail.com (namekuseijin) Date: Thu Jun 4 13:39:20 2009 Subject: [plt-scheme] Sad news regarding Peter Landin In-Reply-To: <9b1fff280906040853t4329d48el5801a24560eed4e0@mail.gmail.com> References: <9b1fff280906040853t4329d48el5801a24560eed4e0@mail.gmail.com> Message-ID: <67d0527e0906041033o2b4432f6tc6fbf722752a1305@mail.gmail.com> I remember him. Well, his name a few thing related to this name, that is. Including the coining of the term "syntatic sugar". :) On Thu, Jun 4, 2009 at 12:53 PM, Marco Morazan wrote: > Dear All, > > FYI just in case you had not heard. He was one of the great pioneers. > > Begin forwarded message: > >> From: Edmund Robinson >> Date: 4 June 2009 09:10:11 GMT+00:00 >> To: cphc-members@JISCMAIL.AC.UK >> Subject: Peter Landin >> Reply-To: Edmund Robinson >> >> I am very sorry to inform you that Peter Landin died yesterday of >> natural causes. >> >> For those members who are several generations away from Peter's >> early contributions, he was one of the major figures in the UK at >> the time that Computer Science was beginning to establish itself as >> a discipline. Some of his papers from 40 years ago are essential >> reading for any serious student of programming languages as still >> the simplest and clearest exposition of ideas that remain >> fundamental. The ideas in his papers were truly original and >> beautiful, but Peter never had a simplistic approach to scientific >> progress, and would scoff at the idea of individual personal >> contribution. Some of his own ?greatest contribution to the field >> was as part of a golden nexus of work on programming languages in >> the UK in the late 60's and early 70's, containing Dana Scott and >> Christopher Strachey and others as well as Peter. The ideas they >> developed through their discussions truly lifted the study of >> programming languages to another level, and are now part of the >> bedrock of the subject. >> >> Funeral arrangements are being made by David Bunnett: >> replies@booktracker.net >> , or if you wish to contact me, I will pass on details. >> >> all best wishes >> Edmund Robinson > ------- End of forwarded message ------- > > > Marco > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From mflatt at cs.utah.edu Thu Jun 4 14:13:09 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Jun 4 14:13:28 2009 Subject: [plt-scheme] composable continuations and dynamic state In-Reply-To: <4A27F64F.8030507@ccs.neu.edu> References: <20090604152148.94EFB9828B@pluto.mumble.net> <4A27F64F.8030507@ccs.neu.edu> Message-ID: <20090604181309.E83266500C7@mail-svr1.cs.utah.edu> At Thu, 04 Jun 2009 12:29:03 -0400, Ryan Culpepper wrote: > Taylor R Campbell wrote: > > [By the way, thanks for cc'ing me -- I forgot to mention in my first > > message that I am not subscribed to the list.] > > > > Date: Thu, 04 Jun 2009 02:04:43 -0400 > > From: Ryan Culpepper > > > > The thread cell indirection is, as you surmised, totally irrelevant to > > the results. You're seeing the effects of another indirection, the > > "parameterization". Parameter-value associations are not stored > > individually in the continuation. Instead, the continuation contains > > "parameterizations", or mappings of all parameters to their current > > values (really, to their currently associated thread-cells). > > Consequently, when you separate a continuation into parts, you do *not* > > separate the parameter updates belonging to those parts. > > > > OK, thanks: now I understand the mechanism yielding the output shown. > > My next question is about the rationale: Why are DYNAMIC-WIND state > > points only partially preserved, whereas parametrizations are fully > > preserved? > > I suspect the behavior comes from the early days when parameters were > first added, when it seemed like first-class parameterizations were a > useful feature: capture a parameterization over here, ship it somewhere > else and reinstate it there. I thought that they were no longer used, > but a search for 'parameterization' in the source tree does turn up a > number of hits. Roughly, yes. We had them in a bad form (shared mutation among threads), threw them out, and then brought them back in a better form to solve some context-switching problems for DrScheme. But, with the advent of delimited continuations, the revised form still creates trouble. > It also seems like storing parameterizations might make parameter > lookups faster, but I haven't tried to test that conjecture. Perhaps > Matthew has? The last time I looked at this problem, I didn't find the right data structure to get both parameterization values and acceptable algorithmic complexity for parameter operations. It needs another look; the solution may involve throwing out parameterizations (again) and finding a different solution for the problem switching back and forth between different contexts (e.g., DrScheme versus the program that it runs). > In fact, I got bitten by the parameter issue the last time I played with > delimited continuations. If you're using delimited continuations, I'd > recommend avoiding parameters and using continuation marks or a light > abstraction thereof (like the "dynamics" I sent in my previous message). > More precisely, avoid using 'parameterize' in code that may be appear in > a composable continuation. Agreed. From jos.koot at telefonica.net Thu Jun 4 16:04:00 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Jun 4 16:04:28 2009 Subject: [plt-scheme] Preventing built-in functions to be redefined References: <6143744d-d070-4eed-ac13-a22842ebe5fc@e24g2000vbe.googlegroups.com> Message-ID: <748E19F13F07449985F5BBE9CF0CCD1B@uw2b2dff239c4d> Define is not a function (nor a procedure). define (redefining it as a variable) , define-syntax , define-for-syntax and similar forms are treated specially, because they may alter the meaning of what is yet to come within a module. However, you can freely write #lang scheme (define add1 sub1) (add1 3) --> 2 To great extent this possibility also exist for the redifinition of syntaxes, but the redefinition of define and define-syntax and related forms are exceptions. They are also mentioned as exceptions in RnRS. Allowing them would create inconsistencies when compiling/interpretering programs containing such forms.. One of the consequences is that a syntax-case-form cannot refer to compile time procedures that have not yet been defined-for-syntax. It is puzzling, I agree, but after some thinking it makes sense after all. In earlier versions of PLT scheme #lang scheme did not allow any redifinition of syntax or variable. I asked to change that and I am glad my question was honoured. And I am also glad that the restriction to redefining define and define-syntax was excepted. BTW you can redefine all syntaxes, all define and define-syntax forms includes, by putting their definitions in a separate module (defining them under a different name and exporting them by any name tou want) Jos ----- Original Message ----- From: "Noel Welsh" To: "chaguidiao" Cc: Sent: Thursday, June 04, 2009 5:48 PM Subject: Re: [plt-scheme] Preventing built-in functions to be redefined I don't remember if there is a parameter to change this behaviour. One way to get the effect you want is to require the language your module is written. Try this and you'll get an error about redefinition #lang scheme (require scheme) (define define 5) In the years I've been writing Scheme this has never caused a problem for me. N. On Thu, Jun 4, 2009 at 3:24 PM, chaguidiao wrote: > Hi > > I am fairly new in Scheme. May I know if it is possible to restrict > the redefinition of the built-in function, or if possible, make any > other user-defined functions non-writable? Pardon me for being a > little paranoid, but the fact that (define define 5) actually making > "define" equals to 5 is just somewhat alarming to me. > > Thanks. > nandehutu _________________________________________________ For list-related administrative tasks: http://list.cs.brown.edu/mailman/listinfo/plt-scheme From noelwelsh at gmail.com Thu Jun 4 16:31:32 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Jun 4 16:31:50 2009 Subject: [plt-scheme] Linking unit Message-ID: Hello, I have the following units: binary-cluster: #lang scheme/unit ... (import (tag a [prefix a: cluster^]) (tag b [prefix b: cluster^])) (export cluster^) ... cluster: #lang scheme/unit ... (import cluster-config^) (export cluster^) ... I want to link two instances of cluster to one binary cluster to create a new compound unit. I've read the docs (ref and guide), I've grepped through the PLT collects, and I can't for the life of me get this to work. One bogus attempt is this: (define-compound-unit/infer c@ (import cluster-config^) (export cluster^) (link (((BC : cluster^)) binary-cluster@ A B) (((A : (tag a cluster^))) cluster@) (((B : (tag b cluster^))) cluster@))) How do I do this? Thanks, N. From jadudm at gmail.com Thu Jun 4 18:40:02 2009 From: jadudm at gmail.com (Matt Jadud) Date: Thu Jun 4 18:48:40 2009 Subject: [plt-scheme] first request In-Reply-To: References: Message-ID: On Thu, Jun 4, 2009 at 9:37 AM, Christopher Coleman wrote: > Also, Noel: I realised how stupid I was to say that I couldn't keep > track of dynamically created functions as soon as the email went out. > Lack of experience thinking in scheme. ?Sorry. No need to apologize. Noel wasn't harshing on you... he was mostly worried that it would be difficult to write unit tests for functions that aren't defined at compile-time. This upsets him, and sometimes it shows. .) (Noel poked me in the eye with a stick for that one...) Cheers, Matt From matthias at ccs.neu.edu Thu Jun 4 21:26:15 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Jun 4 21:26:55 2009 Subject: [plt-scheme] Linking unit In-Reply-To: References: Message-ID: <14363313-EAE7-4D71-9FD9-CC5FFE50998C@ccs.neu.edu> Would this help? #lang scheme (define-signature mt^ ()) (define-signature cluster^ (f)) (define cluster@ (unit (import) (export cluster^) (define (f x) (printf "cluster ~s\n" x)))) (define binary-cluster@ (unit (import (tag a [prefix a: cluster^]) (tag b [prefix b: cluster^])) (export cluster^) (define (f x) (a:f (string-append "a:" x)) (b:f (string-append "b:" x))))) (define client@ (unit (import cluster^) (export mt^) (f "client"))) (define link@ (compound-unit (import) (export) (link (((A : cluster^)) cluster@) (((C : cluster^)) binary-cluster@ (tag a A) (tag b A)) (((B : mt^)) client@ C)))) (invoke-unit link@) On Jun 4, 2009, at 4:31 PM, Noel Welsh wrote: > Hello, > > I have the following units: > > binary-cluster: > > #lang scheme/unit > ... > (import (tag a [prefix a: cluster^]) > (tag b [prefix b: cluster^])) > (export cluster^) > ... > > cluster: > > #lang scheme/unit > ... > (import cluster-config^) > (export cluster^) > ... > > I want to link two instances of cluster to one binary cluster to > create a new compound unit. I've read the docs (ref and guide), I've > grepped through the PLT collects, and I can't for the life of me get > this to work. > > One bogus attempt is this: > > (define-compound-unit/infer c@ > (import cluster-config^) > (export cluster^) > (link (((BC : cluster^)) binary-cluster@ A B) > (((A : (tag a cluster^))) cluster@) > (((B : (tag b cluster^))) cluster@))) > > How do I do this? > > Thanks, > N. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From noelwelsh at gmail.com Fri Jun 5 03:29:15 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri Jun 5 03:29:35 2009 Subject: Documentation error and Re: [plt-scheme] Linking unit Message-ID: Thanks works. Thanks! The documentation is, I think, incorrect. It states, for compound-unit/infer: (link infer-linkage-decl ...)) ... infer-linkage-decl = ((link-binding ...) unit-id tagged-link-id) | unit-id where tagged-link-id (defined at compound-unit) is: tagged-link-id = (tag id link-id) | link-id I think there should be ellipses after tagged-link-id. So: infer-linkage-decl = ((link-binding ...) unit-id tagged-link-id ...) | unit-id for both compound-unit and compound-unit/infer N. On Fri, Jun 5, 2009 at 2:26 AM, Matthias Felleisen wrote: > (define link@ > ?(compound-unit > ? ?(import) > ? ?(export) > ? ?(link (((A : cluster^)) cluster@) > ? ? ? ? ?(((C : cluster^)) binary-cluster@ (tag a A) (tag b A)) > ? ? ? ? ?(((B : mt^)) ? ? ?client@ C)))) From smade4 at gmail.com Fri Jun 5 10:00:44 2009 From: smade4 at gmail.com (Glauber Alex Dias Prado) Date: Fri Jun 5 10:07:03 2009 Subject: [plt-scheme] Repl during animation or simulation In-Reply-To: <1244125517.6645.7.camel@darkstar> (Erich Rast's message of "Thu, 04 Jun 2009 15:25:17 +0100") References: <66c9435a0906031628v79be3d74hc5b78a9d54b4eb91@mail.gmail.com> <4A27288C.90707@ccs.neu.edu> <66c9435a0906031908l1c98c280g34b5020047c511b2@mail.gmail.com> <4A273607.8030901@ccs.neu.edu> <87k53shdpt.fsf@gmail.com> <66c9435a0906032124g17aa3a67nee647fa5d483dbf2@mail.gmail.com> <1244125517.6645.7.camel@darkstar> Message-ID: <8763fakcfn.fsf@gmail.com> Erich Rast writes: >> Fluxus use this feature to enable live-coding "in the loop" :), > > I know I should be asking this on the fluxus mailing list, but while > we're at it...Fluxus own scratchpad is just not usable for developing > larger programs. The docs on the fluxus page say you should compile your > own binary, but with all the dependencies I'll likely never get this to > work. > > So is there any downloadable OS X binary for DrScheme with Fluxus > built-in? I guess you can use the OSX binary from the download page and your already installed DrScheme i think, as long as DrScheme can recognize fluxus paths for libs nothing will prevent it from working afaik, but then im not a OSX user so i may be missing something. In the worst scenario you will have to install all dependencies trough OSX ports system which might not be so difficult, and compile fluxus so it will be installed where PLT wants it to be so nothing hard for it to recognize it. > > Best, > > Erich > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From pocmatos at gmail.com Fri Jun 5 12:26:37 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Fri Jun 5 12:27:21 2009 Subject: [plt-scheme] Empty Symbol Message-ID: <11b141710906050926p3be8708ei38de6126381b47da@mail.gmail.com> Hi all, In 4.1.900 I am getting: > (string->symbol "") compile: unbound identifier (and no #%app syntax transformer is bound) in: #%top-interaction I would think this is a bug, right? Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From pocmatos at gmail.com Fri Jun 5 12:28:47 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Fri Jun 5 12:29:31 2009 Subject: [plt-scheme] Re: Empty Symbol In-Reply-To: <11b141710906050926p3be8708ei38de6126381b47da@mail.gmail.com> References: <11b141710906050926p3be8708ei38de6126381b47da@mail.gmail.com> Message-ID: <11b141710906050928r56a117c6s90c0522af49c613a@mail.gmail.com> On Fri, Jun 5, 2009 at 5:26 PM, Paulo J. Matos wrote: > Hi all, > > In 4.1.900 I am getting: >> (string->symbol "") > compile: unbound identifier (and no #%app syntax transformer is bound) > in: #%top-interaction > > I would think this is a bug, right? > Wierd, by opening a new repl everything is right now. I guess my repl got corrupted in some way. No worries about this then, I guess. Cheers, Paulo Matos > Cheers, > > -- > Paulo Jorge Matos - pocmatos at gmail.com > http://www.pmatos.net > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From dave at pawfal.org Fri Jun 5 15:11:29 2009 From: dave at pawfal.org (Dave Griffiths) Date: Fri Jun 5 15:11:51 2009 Subject: [Fluxus] [plt-scheme] Repl during animation or simulation In-Reply-To: <8763fakcfn.fsf@gmail.com> References: <66c9435a0906031628v79be3d74hc5b78a9d54b4eb91@mail.gmail.com> <4A27288C.90707@ccs.neu.edu> <66c9435a0906031908l1c98c280g34b5020047c511b2@mail.gmail.com> <4A273607.8030901@ccs.neu.edu> <87k53shdpt.fsf@gmail.com> <66c9435a0906032124g17aa3a67nee647fa5d483dbf2@mail.gmail.com> <1244125517.6645.7.camel@darkstar> <8763fakcfn.fsf@gmail.com> Message-ID: <1244229089.6039.18.camel@kittywake> On Fri, 2009-06-05 at 11:00 -0300, Glauber Alex Dias Prado wrote: > Erich Rast writes: > > >> Fluxus use this feature to enable live-coding "in the loop" :), > > > > I know I should be asking this on the fluxus mailing list, but while > > we're at it...Fluxus own scratchpad is just not usable for developing > > larger programs. The docs on the fluxus page say you should compile your > > own binary, but with all the dependencies I'll likely never get this to > > work. > > > > So is there any downloadable OS X binary for DrScheme with Fluxus > > built-in? > > I guess you can use the OSX binary from the download page and your already > installed DrScheme i think, as long as DrScheme can recognize fluxus > paths for libs nothing will prevent it from working afaik, but then im > not a OSX user so i may be missing something. In the worst scenario you > will have to install all dependencies trough OSX ports system which > might not be so difficult, and compile fluxus so it will be installed > where PLT wants it to be so nothing hard for it to recognize it. I'm not sure if the latest osx version embeds the binary plt modules in the scratchpad binary - we've started doing this on some platforms to make it easier to provide packages, but it means you can't load them into drscheme. In this case, it would be ideal to provide fluxus via the planet - is it possible to distribute binary modules this way? We've recently had something of a combinatorial explosion in terms of OS's, packages and flavours of install of fluxus - hopefully in the next bit we'll figure out a good way of approaching this. cheers, dave From grettke at acm.org Fri Jun 5 16:03:46 2009 From: grettke at acm.org (Grant Rettke) Date: Fri Jun 5 16:10:57 2009 Subject: [plt-scheme] Re: Why "lambda"? In-Reply-To: References: <1243807231.5017.7.camel@Nokia-N800-43-7> <4331ad810906010812y1ed3a6a6r8410684a835ab74a@mail.gmail.com> Message-ID: <756daca50906051303i38471180i64bf6b3a94f84e3d@mail.gmail.com> On Mon, Jun 1, 2009 at 5:01 PM, Richard Cleis wrote: > I view my own career that way, but I believe more influence from academia > would have benefitted me greatly. ?After a few decades of writing software, > I do not even want to look at much of my wonderful things (they truly are > wonderful, in my most humble opinion) much less work on them... or explain > to others how to rewrite them (my emerging #1 task) :) > > Greek symbols do not gain popularity outside of the Tex/Mathematica/etc > world because we cannot comfortably apply them in most computing > environments ... or email, for that matter. ?Even though we all have unicode > email, how many times did Greek letters show up in this thread? When I read use cases; rather than see: "Physical object / Dwelling / Manufactured Item / Ship / Vehicle / Road Vehicle" copied and pasted TWELVE times on a single page, I wouldn't mind seeing a symbol or some sort of shorthand to represent it. I wonder what the business would find acceptable. From gabor.lists at mndl.hu Fri Jun 5 16:30:16 2009 From: gabor.lists at mndl.hu (gabor papp) Date: Fri Jun 5 16:30:43 2009 Subject: [Fluxus] [plt-scheme] Repl during animation or simulation In-Reply-To: <1244229089.6039.18.camel@kittywake> References: <66c9435a0906031628v79be3d74hc5b78a9d54b4eb91@mail.gmail.com> <4A27288C.90707@ccs.neu.edu> <66c9435a0906031908l1c98c280g34b5020047c511b2@mail.gmail.com> <4A273607.8030901@ccs.neu.edu> <87k53shdpt.fsf@gmail.com> <66c9435a0906032124g17aa3a67nee647fa5d483dbf2@mail.gmail.com> <1244125517.6645.7.camel@darkstar> <8763fakcfn.fsf@gmail.com> <1244229089.6039.18.camel@kittywake> Message-ID: <4A298058.5060708@mndl.hu> > I'm not sure if the latest osx version embeds the binary plt modules in the osx binary does not embed the binary plt modules, although it is a bit complicated to load them into drscheme. if you put the fluxus application to /Applications, you need to include the resources folder of the fluxus.app to the collects path, so drscheme finds the fluxus modules. because they depend on the dynamic libraries and frameworks included in the application, you also need to set the dynamic library path. something like this: export PLTCOLLECTS=/Applications/PLT\ Scheme\ v4.2/collects/:/Applications/Fluxus.app/Contents/Resources/collects/ export DYLD_LIBRARY_PATH=/Applications/Fluxus.app/Contents/Frameworks/ then load drscheme: open /Applications/PLT\ Scheme\ v4.2/DrScheme.app/ a simple test script should work now: #lang scheme (require fluxus-016/drflux) (clear) (build-cube) on the other hand compiling fluxus is not that difficult on osx if you have macports installed. all required depencies are included in macports, and the fluxus readme file gives step by step instructions. best, gabor From rcleis at mac.com Fri Jun 5 16:52:13 2009 From: rcleis at mac.com (Richard Cleis) Date: Fri Jun 5 16:52:53 2009 Subject: [plt-scheme] Re: Why "lambda"? In-Reply-To: <756daca50906051303i38471180i64bf6b3a94f84e3d@mail.gmail.com> References: <1243807231.5017.7.camel@Nokia-N800-43-7> <4331ad810906010812y1ed3a6a6r8410684a835ab74a@mail.gmail.com> <756daca50906051303i38471180i64bf6b3a94f84e3d@mail.gmail.com> Message-ID: On Jun 5, 2009, at 2:03 PM, Grant Rettke wrote: > On Mon, Jun 1, 2009 at 5:01 PM, Richard Cleis wrote: >> I view my own career that way, but I believe more influence from >> academia >> would have benefitted me greatly. After a few decades of writing >> software, >> I do not even want to look at much of my wonderful things (they >> truly are >> wonderful, in my most humble opinion) much less work on them... or >> explain >> to others how to rewrite them (my emerging #1 task) :) >> >> Greek symbols do not gain popularity outside of the Tex/Mathematica/ >> etc >> world because we cannot comfortably apply them in most computing >> environments ... or email, for that matter. Even though we all >> have unicode >> email, how many times did Greek letters show up in this thread? > > When I read use cases; rather than see: > > "Physical object / Dwelling / Manufactured Item / Ship / Vehicle / > Road Vehicle" > > copied and pasted TWELVE times on a single page, I wouldn't mind > seeing a symbol or some sort of shorthand to represent it. I wonder > what the business would find acceptable. Short answer: a single work could be assigned to that description. The closest the business world seems to get to symbols is: QTY (statistics departments notwithstanding.) Most of business could probably be handled with a few dozen greek symbols, but the lack of general symbol capability in development environments would require programmers to represent them in some other manner anyway (like your example.) In my case, I learned to apply engineering, physics, and programming via programs... programs written with words, not symbols, because the programming environments did not support them. My colleagues sometimes think I am 'blowing them off' when I tell them that I have no equations for my implementations; they were developed as programs, not implementations of equations. What a difference it would have made if I could have used standard symbols in the programs! Wolfram has done well at addressing this issue, but a thousand pound (er, dollar) gorilla is not required for the basic problem of universal representation. rac From jos.koot at telefonica.net Fri Jun 5 16:54:36 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Fri Jun 5 16:55:03 2009 Subject: [plt-scheme] llc-with-redex Message-ID: <582ACFC7B25B478BA1AD502EFA3FC217@uw2b2dff239c4d> Hi, I love Lambda Calculus for its beauty. It is about lambda. If, as a schemer, you are interested in the origin of lambda and the beautiful mathematics on which it is based, you are invited to have a look in: http://telefonica.net/web2/koot/lc-with-redex.zip In this zip directory you can find file lc-with-Redex.doc which is a short intro in Lambda Calculus and contains info on how to use the material that goes with the essay. I have included a very condenced note on a system even without lambda, which is called 'combinatory logic'. My essay is adressed to Schemers and uses PLT Scheme, particularly PLT's redex library. It has become somewhat more verbose than I had in mind originally. If you have any ideas how to condence and simplify further without loosing too much content and accuracy, I welcome your suggestions. Comments about inaccuracies and other faults are welcome too, of course. My essay does not contain any new views. It is a compilation of views taken from books that have inspired me. They are mentioned in the essay. If the format of the above link does not suit you, give me a ping and I'll try to send you the material in a format that suits you. With thanks to Douglas R. Hofstadter, Daniel P Friedman, Matthias Felleisen, Roby Findler, Casey Klein and others, in all feasible orders. Jos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090605/afae9514/attachment.htm From dhurtt at sprintmail.com Sat Jun 6 00:59:41 2009 From: dhurtt at sprintmail.com (Dale Hurtt) Date: Sat Jun 6 08:03:18 2009 Subject: [plt-scheme] Override [Tab] handling in text-field% Message-ID: <1a77928c-1887-46ab-9bb3-b468cae4a1ba@e21g2000yqb.googlegroups.com> How can you easily override the [Tab] being handled by the top level window when the focus is in a text-field? I want to use the tab in the field. Thanks, Dale From mflatt at cs.utah.edu Sat Jun 6 09:36:48 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Sat Jun 6 09:37:11 2009 Subject: [plt-scheme] Override [Tab] handling in text-field% In-Reply-To: <1a77928c-1887-46ab-9bb3-b468cae4a1ba@e21g2000yqb.googlegroups.com> References: <1a77928c-1887-46ab-9bb3-b468cae4a1ba@e21g2000yqb.googlegroups.com> Message-ID: <20090606133650.79D736500AC@mail-svr1.cs.utah.edu> At Fri, 5 Jun 2009 21:59:41 -0700 (PDT), Dale Hurtt wrote: > How can you easily override the [Tab] being handled by the top level > window when the focus is in a text-field? I want to use the tab in the > field. You can override `on-traverse-char' in the frame% or dialog% that contains the text field. There's currently no way to control Tab handling locally in the text-field%, I think. From robert.winslow at gmail.com Sat Jun 6 16:16:10 2009 From: robert.winslow at gmail.com (rw) Date: Sat Jun 6 16:25:37 2009 Subject: [plt-scheme] Numerical precision (sqrt 2) Message-ID: <45d91bbd-09c9-488d-b9d4-fdafaaa85b98@g20g2000vba.googlegroups.com> I am seeking a (hopefully built-in) way to decide the precision of irrational numbers. By default (PLT 4.1.5) gives: (sqrt 2) -> 1.4142135623730951 I want to get an answer in (say) 50 or 100 digits precision. I am considering building a generating function for each digit of the irrational number, but I expect this to be computationally slow. Ideally, it would operate like this: (precision-take (sqrt 2) 50) -> 2^0.5 with 50 significant digits Is functionality like this already out there? Thanks! From neil at neilvandyke.org Sat Jun 6 17:48:18 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Sat Jun 6 17:48:50 2009 Subject: [plt-scheme] firefox locking up 15 seconds for each plt documentation search Message-ID: <4A2AE422.40700@neilvandyke.org> Does anyone else's entire Firefox 3 lock up completely for around 15 seconds *every* time they either load the PLT "Search Manuals" or enter a query in the "...search manuals..." field that's at the top of each page? This has been happening to me with the local copy of PLT documentation, with both 4.1.2 and 4.1.5. My first guess as to cause is that it's a combination of two factors: (1) loading the index pounds the JavaScript interpreter or GC; (2) something unusual about my browser configuration is preventing the index from being cached as a file or as JS data. Knowing if anyone else has this problem might help debug. Thanks. -- http://www.neilvandyke.org/ From matthias at ccs.neu.edu Sat Jun 6 18:48:18 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sat Jun 6 18:48:52 2009 Subject: [plt-scheme] firefox locking up 15 seconds for each plt documentation search In-Reply-To: <4A2AE422.40700@neilvandyke.org> References: <4A2AE422.40700@neilvandyke.org> Message-ID: <00B4F514-6790-4FB9-9EA0-89AD2956B084@ccs.neu.edu> I have complained about this often. Happens on safari and others, too. On Jun 6, 2009, at 5:48 PM, Neil Van Dyke wrote: > Does anyone else's entire Firefox 3 lock up completely for around > 15 seconds *every* time they either load the PLT "Search Manuals" > or enter a query in the "...search manuals..." field that's at the > top of each page? > > This has been happening to me with the local copy of PLT > documentation, with both 4.1.2 and 4.1.5. > > My first guess as to cause is that it's a combination of two > factors: (1) loading the index pounds the JavaScript interpreter or > GC; (2) something unusual about my browser configuration is > preventing the index from being cached as a file or as JS data. > > Knowing if anyone else has this problem might help debug. Thanks. > > -- > http://www.neilvandyke.org/ > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From neil at neilvandyke.org Sat Jun 6 18:59:56 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Sat Jun 6 19:00:26 2009 Subject: [plt-scheme] firefox locking up 15 seconds for each plt documentation search In-Reply-To: <00B4F514-6790-4FB9-9EA0-89AD2956B084@ccs.neu.edu> References: <4A2AE422.40700@neilvandyke.org> <00B4F514-6790-4FB9-9EA0-89AD2956B084@ccs.neu.edu> Message-ID: <4A2AF4EC.7020707@neilvandyke.org> I just got private email from someone that he doesn't experience this problem (on Linux with Firefox). And Eli has said in the past that he doesn't experience it either. Matthias Felleisen wrote at 06/06/2009 06:48 PM: > I have complained about this often. Happens on safari and others, too. > > > On Jun 6, 2009, at 5:48 PM, Neil Van Dyke wrote: >> Does anyone else's entire Firefox 3 lock up completely for around 15 >> seconds *every* time they either load the PLT "Search Manuals" or >> enter a query in the "...search manuals..." field that's at the top >> of each page? From a.rottmann at gmx.at Sat Jun 6 19:23:38 2009 From: a.rottmann at gmx.at (Andreas Rottmann) Date: Sat Jun 6 19:24:54 2009 Subject: [plt-scheme] Numerical precision (sqrt 2) In-Reply-To: <45d91bbd-09c9-488d-b9d4-fdafaaa85b98@g20g2000vba.googlegroups.com> (rw's message of "Sat, 6 Jun 2009 13:16:10 -0700 (PDT)") References: <45d91bbd-09c9-488d-b9d4-fdafaaa85b98@g20g2000vba.googlegroups.com> Message-ID: <878wk5x7yd.fsf@delenn.lan> rw writes: > I am seeking a (hopefully built-in) way to decide the precision of > irrational numbers. By default (PLT 4.1.5) gives: > > (sqrt 2) -> 1.4142135623730951 > > I want to get an answer in (say) 50 or 100 digits precision. I am > considering building a generating function for each digit of the > irrational number, but I expect this to be computationally slow. > Ideally, it would operate like this: > > (precision-take (sqrt 2) 50) -> 2^0.5 with 50 significant digits > > Is functionality like this already out there? > I've done something similiar for the "golden number". The code works by using an approximation function that works with rationals of growing precision, periodically checking if the approximation is good enough. You could probably transform the algorithm produce a digit stream to get an interface like you described. Perhaps you find the code useful (hereby placed in the public domain): #lang scheme (define (prev-power num base) (let ((l (/ (log num) (log base)))) (max 1 (inexact->exact (expt base (inexact->exact (floor l))))))) (define *decimal-digits* '#(#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9)) (define (number->string/prec num base prec) (let loop ((digits '()) (n num) (prec prec) (place-val (prev-power num base))) (if (= prec 0) (list->string (reverse digits)) (let* ((digit (inexact->exact (truncate (/ n place-val)))) (digit-char (vector-ref *decimal-digits* digit))) (loop (if (= place-val 1) (cons #\. (cons digit-char digits)) (cons digit-char digits)) (- n (* digit place-val)) (- prec 1) (/ place-val base)))))) (define (golden-ratio epsilon) (let loop ((f1 1) (f2 1) (i 0)) (let ((f3 (+ f1 f2))) (if (= i 1000) (let ((r1 (/ f2 f1)) (r2 (/ f3 f2))) (if (< (abs (- r2 r1)) epsilon) r2 (loop f2 f3 0))) (loop f2 f3 (+ i 1)))))) (define (golden n) (display (number->string/prec (golden-ratio (expt 1/10 n)) 10 n)) (newline)) (golden 100) From robby at eecs.northwestern.edu Sat Jun 6 20:09:50 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sat Jun 6 20:10:12 2009 Subject: [plt-scheme] firefox locking up 15 seconds for each plt documentation search In-Reply-To: <4A2AF4EC.7020707@neilvandyke.org> References: <4A2AE422.40700@neilvandyke.org> <00B4F514-6790-4FB9-9EA0-89AD2956B084@ccs.neu.edu> <4A2AF4EC.7020707@neilvandyke.org> Message-ID: <932b2f1f0906061709lc1eb8d2le8d980be98216a6e@mail.gmail.com> My laptop is slow (atom processor) and I do not see 15 second lockups to load the search page. Maybe 2 or 3 seconds. Robby On Sat, Jun 6, 2009 at 5:59 PM, Neil Van Dyke wrote: > I just got private email from someone that he doesn't experience this > problem (on Linux with Firefox). ?And Eli has said in the past that he > doesn't experience it either. > > > Matthias Felleisen wrote at 06/06/2009 06:48 PM: >> >> I have complained about this often. Happens on safari and others, too. >> >> >> On Jun 6, 2009, at 5:48 PM, Neil Van Dyke wrote: >>> >>> Does anyone else's entire Firefox 3 lock up completely for around 15 >>> seconds *every* time they either load the PLT "Search Manuals" or enter a >>> query in the "...search manuals..." field that's at the top of each page? > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From czhu at cs.utah.edu Sat Jun 6 20:19:17 2009 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Sat Jun 6 20:19:52 2009 Subject: [plt-scheme] Numerical precision (sqrt 2) In-Reply-To: <45d91bbd-09c9-488d-b9d4-fdafaaa85b98@g20g2000vba.googlegroups.com> References: <45d91bbd-09c9-488d-b9d4-fdafaaa85b98@g20g2000vba.googlegroups.com> Message-ID: <4A2B0785.6080809@cs.utah.edu> rw wrote: > I am seeking a (hopefully built-in) way to decide the precision of > irrational numbers. By default (PLT 4.1.5) gives: > > (sqrt 2) -> 1.4142135623730951 > > I want to get an answer in (say) 50 or 100 digits precision. I am > considering building a generating function for each digit of the > irrational number, but I expect this to be computationally slow. > Ideally, it would operate like this: > > (precision-take (sqrt 2) 50) -> 2^0.5 with 50 significant digits > > Is functionality like this already out there? > > (define (precision-sqrt n d) (/ (integer-sqrt (* n (expt 10 (* 2 d)))) (expt 10 d))) (precision-sqrt 2 50) I would also suggest you to read http://docs.plt-scheme.org/guide/numbers.html for more understanding about PLT's number system. Chongkai From toddobryan at gmail.com Sat Jun 6 21:15:20 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sat Jun 6 21:15:39 2009 Subject: [plt-scheme] SchemeUnit confusion Message-ID: <904774730906061815k1b921710h2385077107b26ba9@mail.gmail.com> In the latest SVN, I have the following program in the Definitions window. #lang scheme/base (require (planet schematics/schemeunit:3) schemeunit/text-ui) (define BLAH (test-suite "An example suite" #:before (lambda () (display "Before")) #:after (lambda () (display "After")) (test-case "An example test" (check-eq? 1 1)))) Then I try > (run-tests BLAH) in the Interactions window and get: foldts: Don't know what to do with #(struct:schemeunit-test-suite ... An example suite # # #). It isn't a test case or test suite. What am I doing wrong? Todd From dherman at ccs.neu.edu Sat Jun 6 21:16:22 2009 From: dherman at ccs.neu.edu (Dave Herman) Date: Sat Jun 6 21:16:53 2009 Subject: [plt-scheme] firefox locking up 15 seconds for each plt documentation search In-Reply-To: <4A2AF4EC.7020707@neilvandyke.org> References: <4A2AE422.40700@neilvandyke.org> <00B4F514-6790-4FB9-9EA0-89AD2956B084@ccs.neu.edu> <4A2AF4EC.7020707@neilvandyke.org> Message-ID: <6B3B0767-D194-4BBC-85FC-DABAE812DD10@ccs.neu.edu> I should've complained earlier! Yes, I figured everyone just put up with this. :) It's so bad that I never use F1 and just keep a page open to the docs. Even then, any search still locks up the browser for a painfully long time. Thanks for bringing this up. I should've said something sooner. Dave On Jun 6, 2009, at 6:59 PM, Neil Van Dyke wrote: > I just got private email from someone that he doesn't experience > this problem (on Linux with Firefox). And Eli has said in the past > that he doesn't experience it either. > > > Matthias Felleisen wrote at 06/06/2009 06:48 PM: >> I have complained about this often. Happens on safari and others, >> too. >> >> >> On Jun 6, 2009, at 5:48 PM, Neil Van Dyke wrote: >>> Does anyone else's entire Firefox 3 lock up completely for around >>> 15 seconds *every* time they either load the PLT "Search Manuals" >>> or enter a query in the "...search manuals..." field that's at the >>> top of each page? > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From toddobryan at gmail.com Sat Jun 6 21:18:05 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sat Jun 6 21:18:28 2009 Subject: [plt-scheme] firefox locking up 15 seconds for each plt documentation search In-Reply-To: <6B3B0767-D194-4BBC-85FC-DABAE812DD10@ccs.neu.edu> References: <4A2AE422.40700@neilvandyke.org> <00B4F514-6790-4FB9-9EA0-89AD2956B084@ccs.neu.edu> <4A2AF4EC.7020707@neilvandyke.org> <6B3B0767-D194-4BBC-85FC-DABAE812DD10@ccs.neu.edu> Message-ID: <904774730906061818t2bf4ed8cg4cc001818f8b39bc@mail.gmail.com> Also fine for me on Linux. Are all the problems on OS X, possibly? On Sat, Jun 6, 2009 at 9:16 PM, Dave Herman wrote: > I should've complained earlier! Yes, I figured everyone just put up with > this. :) It's so bad that I never use F1 and just keep a page open to the > docs. Even then, any search still locks up the browser for a painfully long > time. > > Thanks for bringing this up. I should've said something sooner. > > Dave > > On Jun 6, 2009, at 6:59 PM, Neil Van Dyke wrote: > >> I just got private email from someone that he doesn't experience this >> problem (on Linux with Firefox). ?And Eli has said in the past that he >> doesn't experience it either. >> >> >> Matthias Felleisen wrote at 06/06/2009 06:48 PM: >>> >>> I have complained about this often. Happens on safari and others, too. >>> >>> >>> On Jun 6, 2009, at 5:48 PM, Neil Van Dyke wrote: >>>> >>>> Does anyone else's entire Firefox 3 lock up completely for around 15 >>>> seconds *every* time they either load the PLT "Search Manuals" or enter a >>>> query in the "...search manuals..." field that's at the top of each page? >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From eddieSull at hotmail.com Sat Jun 6 21:35:33 2009 From: eddieSull at hotmail.com (Eddie Sullivan) Date: Sat Jun 6 21:32:39 2009 Subject: [plt-scheme] Re: firefox locking up 15 seconds for each plt References: <20090607011700.06FE4402BB@qua.cs.brown.edu> Message-ID: For me, the behavior seems related to the Firebug extension in Firefox. If disable Firebug, the delay doesn't occur. It needs to be disabled through the Tools->Add Ons menu. Disabling it just for localhost does not work. I don't see the delay in Opera or IE. -Eddie Sullivan From neil at neilvandyke.org Sat Jun 6 21:35:45 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Sat Jun 6 21:36:30 2009 Subject: [plt-scheme] Re: firefox locking up 15 seconds for each plt In-Reply-To: References: <20090607011700.06FE4402BB@qua.cs.brown.edu> Message-ID: <4A2B1971.5040604@neilvandyke.org> That's it! Thank you! Eddie Sullivan wrote at 06/06/2009 09:35 PM: > For me, the behavior seems related to the Firebug extension in > Firefox. If disable Firebug, the delay doesn't occur. It needs to be > disabled through the Tools->Add Ons menu. Disabling it just for > localhost does not work. From eddieSull at hotmail.com Sat Jun 6 21:39:17 2009 From: eddieSull at hotmail.com (Eddie Sullivan) Date: Sat Jun 6 21:36:34 2009 Subject: [plt-scheme] Re: firefox locking up 15 seconds for each plt Message-ID: Correction: I can also choose "Suspend Firebug" from its popup menu. That's an easier option. -Eddie ----- Original Message ----- From: "Eddie Sullivan" To: Sent: Saturday, June 06, 2009 6:35 PM Subject: Re: firefox locking up 15 seconds for each plt > For me, the behavior seems related to the Firebug extension in Firefox. If > disable Firebug, the delay doesn't occur. It needs to be disabled through > the Tools->Add Ons menu. Disabling it just for localhost does not work. > > I don't see the delay in Opera or IE. > -Eddie Sullivan > From neil at neilvandyke.org Sat Jun 6 21:37:50 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Sat Jun 6 21:38:19 2009 Subject: [plt-scheme] Re: firefox locking up 15 seconds for each plt In-Reply-To: <4A2B1971.5040604@neilvandyke.org> References: <20090607011700.06FE4402BB@qua.cs.brown.edu> <4A2B1971.5040604@neilvandyke.org> Message-ID: <4A2B19EE.9070100@neilvandyke.org> Er, at least that's it for me with Firefox 3 on Linux. If slowness/lockups also exhibit in, say, Safari, I am thinking it's a related JS/GC performance problem. Neil Van Dyke wrote at 06/06/2009 09:35 PM: > That's it! Thank you! > > > Eddie Sullivan wrote at 06/06/2009 09:35 PM: >> For me, the behavior seems related to the Firebug extension in >> Firefox. If disable Firebug, the delay doesn't occur. It needs to be >> disabled through the Tools->Add Ons menu. Disabling it just for >> localhost does not work. > > From dherman at ccs.neu.edu Sat Jun 6 22:24:44 2009 From: dherman at ccs.neu.edu (Dave Herman) Date: Sat Jun 6 22:25:17 2009 Subject: [plt-scheme] firefox locking up 15 seconds for each plt documentation search In-Reply-To: <904774730906061818t2bf4ed8cg4cc001818f8b39bc@mail.gmail.com> References: <4A2AE422.40700@neilvandyke.org> <00B4F514-6790-4FB9-9EA0-89AD2956B084@ccs.neu.edu> <4A2AF4EC.7020707@neilvandyke.org> <6B3B0767-D194-4BBC-85FC-DABAE812DD10@ccs.neu.edu> <904774730906061818t2bf4ed8cg4cc001818f8b39bc@mail.gmail.com> Message-ID: <4E581B3C-4735-4D35-8DD1-027A09C8726F@ccs.neu.edu> Both OS X and Windows for me. Dave On Jun 6, 2009, at 9:18 PM, Todd O'Bryan wrote: > Also fine for me on Linux. Are all the problems on OS X, possibly? > > On Sat, Jun 6, 2009 at 9:16 PM, Dave Herman > wrote: >> I should've complained earlier! Yes, I figured everyone just put up >> with >> this. :) It's so bad that I never use F1 and just keep a page open >> to the >> docs. Even then, any search still locks up the browser for a >> painfully long >> time. >> >> Thanks for bringing this up. I should've said something sooner. >> >> Dave >> >> On Jun 6, 2009, at 6:59 PM, Neil Van Dyke wrote: >> >>> I just got private email from someone that he doesn't experience >>> this >>> problem (on Linux with Firefox). And Eli has said in the past >>> that he >>> doesn't experience it either. >>> >>> >>> Matthias Felleisen wrote at 06/06/2009 06:48 PM: >>>> >>>> I have complained about this often. Happens on safari and others, >>>> too. >>>> >>>> >>>> On Jun 6, 2009, at 5:48 PM, Neil Van Dyke wrote: >>>>> >>>>> Does anyone else's entire Firefox 3 lock up completely for >>>>> around 15 >>>>> seconds *every* time they either load the PLT "Search Manuals" >>>>> or enter a >>>>> query in the "...search manuals..." field that's at the top of >>>>> each page? >>> >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From dhurtt at sprintmail.com Sat Jun 6 12:58:10 2009 From: dhurtt at sprintmail.com (Dale Hurtt) Date: Sat Jun 6 22:29:10 2009 Subject: [plt-scheme] Re: Override [Tab] handling in text-field% In-Reply-To: <20090606133650.79D736500AC@mail-svr1.cs.utah.edu> References: <1a77928c-1887-46ab-9bb3-b468cae4a1ba@e21g2000yqb.googlegroups.com> <20090606133650.79D736500AC@mail-svr1.cs.utah.edu> Message-ID: > You can override `on-traverse-char' in the frame% or dialog% that > contains the text field. There's currently no way to control Tab > handling locally in the text-field%, I think. Thanks. That did the trick. Now I need to figure out why the field keeps returning that it does not have the focus when the caret is clearly there. Dale From hendrik at topoi.pooq.com Sat Jun 6 23:26:43 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Sat Jun 6 23:33:23 2009 Subject: [plt-scheme] firefox locking up 15 seconds for each plt documentation search In-Reply-To: <4A2AE422.40700@neilvandyke.org> References: <4A2AE422.40700@neilvandyke.org> Message-ID: <20090607032642.GD16138@topoi.pooq.com> On Sat, Jun 06, 2009 at 05:48:18PM -0400, Neil Van Dyke wrote: > Does anyone else's entire Firefox 3 lock up completely for around 15 > seconds *every* time they either load the PLT "Search Manuals" or enter > a query in the "...search manuals..." field that's at the top of each page? > > This has been happening to me with the local copy of PLT documentation, > with both 4.1.2 and 4.1.5. I haven't accessed the PLT Scheme documentation recently, but I have had other firefox lockups -- some last several minutes. -- hendrik From jos.koot at telefonica.net Sun Jun 7 04:30:15 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Sun Jun 7 04:30:45 2009 Subject: [plt-scheme] firefox locking up 15 seconds for each plt documentation search References: <4A2AE422.40700@neilvandyke.org><00B4F514-6790-4FB9-9EA0-89AD2956B084@ccs.neu.edu><4A2AF4EC.7020707@neilvandyke.org><6B3B0767-D194-4BBC-85FC-DABAE812DD10@ccs.neu.edu> <904774730906061818t2bf4ed8cg4cc001818f8b39bc@mail.gmail.com> Message-ID: On my Windows XP firefox starts very slowly too, may be 5 seconds. This happens too when calling Firefox directly from the start menu. Jos ----- Original Message ----- From: "Todd O'Bryan" To: "PLT-Scheme List" Sent: Sunday, June 07, 2009 3:18 AM Subject: Re: [plt-scheme] firefox locking up 15 seconds for each plt documentation search Also fine for me on Linux. Are all the problems on OS X, possibly? On Sat, Jun 6, 2009 at 9:16 PM, Dave Herman wrote: > I should've complained earlier! Yes, I figured everyone just put up with > this. :) It's so bad that I never use F1 and just keep a page open to the > docs. Even then, any search still locks up the browser for a painfully long > time. > > Thanks for bringing this up. I should've said something sooner. > > Dave > > On Jun 6, 2009, at 6:59 PM, Neil Van Dyke wrote: > >> I just got private email from someone that he doesn't experience this >> problem (on Linux with Firefox). And Eli has said in the past that he >> doesn't experience it either. >> >> >> Matthias Felleisen wrote at 06/06/2009 06:48 PM: >>> >>> I have complained about this often. Happens on safari and others, too. >>> >>> >>> On Jun 6, 2009, at 5:48 PM, Neil Van Dyke wrote: >>>> >>>> Does anyone else's entire Firefox 3 lock up completely for around 15 >>>> seconds *every* time they either load the PLT "Search Manuals" or enter a >>>> query in the "...search manuals..." field that's at the top of each page? >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > _________________________________________________ For list-related administrative tasks: http://list.cs.brown.edu/mailman/listinfo/plt-scheme From noelwelsh at gmail.com Sun Jun 7 04:45:33 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Sun Jun 7 04:45:53 2009 Subject: [plt-scheme] firefox locking up 15 seconds for each plt documentation search In-Reply-To: <4A2AE422.40700@neilvandyke.org> References: <4A2AE422.40700@neilvandyke.org> Message-ID: On Sat, Jun 6, 2009 at 10:48 PM, Neil Van Dyke wrote: > Does anyone else's entire Firefox 3 lock up completely for around 15 seconds > *every* time they either load the PLT "Search Manuals" or enter a query in > the "...search manuals..." field that's at the top of each page? I assume this is the index loading. I keep one tab open on the search page, and open results in other tabs. This is much faster. N. From noelwelsh at gmail.com Sun Jun 7 04:48:32 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Sun Jun 7 04:48:51 2009 Subject: [plt-scheme] SchemeUnit confusion In-Reply-To: <904774730906061815k1b921710h2385077107b26ba9@mail.gmail.com> References: <904774730906061815k1b921710h2385077107b26ba9@mail.gmail.com> Message-ID: On Sun, Jun 7, 2009 at 2:15 AM, Todd O'Bryan wrote: > In the latest SVN, I have the following program in the Definitions window. > > #lang scheme/base > (require (planet schematics/schemeunit:3) > ? ? ? ? schemeunit/text-ui) > Here you mix the Planet version of SchemeUnit with the version bundled with PLT. Due to generative structures they don't interact well. I recommend using just the Planet version: (require (planet schematics/schemeunit:3) (planet schematics/schemeunit:3/text-ui)) N. From eli at barzilay.org Sun Jun 7 07:20:46 2009 From: eli at barzilay.org (Eli Barzilay) Date: Sun Jun 7 07:21:14 2009 Subject: [plt-scheme] firefox locking up 15 seconds for each plt documentation search In-Reply-To: References: <4A2AE422.40700@neilvandyke.org> Message-ID: <18987.41614.846385.281248@winooski.ccs.neu.edu> On Jun 7, Noel Welsh wrote: > On Sat, Jun 6, 2009 at 10:48 PM, Neil Van Dyke wrote: > > Does anyone else's entire Firefox 3 lock up completely for around > > 15 seconds *every* time they either load the PLT "Search Manuals" > > or enter a query in the "...search manuals..." field that's at the > > top of each page? > > I assume this is the index loading. I keep one tab open on the > search page, and open results in other tabs. This is much faster. FWIW, I do the same. [Read on if you're interested in trying a possible solution, otherwise you can safely ignore this.] I know that the search page is slow to load -- but I didn't know what caused the unreasonable freezes that Neil was having. I don't use firebug, and looking at the kind of debugging it does, it might do some errortrace-like annotations that would make the index load much slower. This might be made faster if the index is stored as a giant string instead of a giant arraw -- but parsing that string after it's loaded will probably mean a 2x slowdown or worse. (And I won't be surprised if browsers decide that a 3mb string means that the script is malicious.) As for trying to speed it, I can't think of any new tricks to do that. If you look at "doc/search/plt-index.js" you'll see that there are several encodings used -- most urls are shortened if they're in the expected place, and the many s are encoded as vectors. And to make things more fun, the PLT index keeps growing (in v4.1 it was 2.5M, and now it's close to 3M -- and that's only for the core tree). Together with the *many* problems of IE with local-file-scripts, it might make more sense to switch the whole thing to use an alternative approach -- an obvious example is to not include the docs in the distribution and instead use the on-line help, which will make it possible to use server-side scripts. (I'm not sure if it's feasible for the server do deal with that kind of load though, and this comes in addition to the usual problem of people with no network or with firewall-limited connections.) Other options: * Something that was tried in the past is a local "help" webserver. In a sense, this kind of a solution would be ideal, since it lets Scheme do the searching, making it possible to get rid of the harder-to-write-and-debug JS code, and some of the associated hacks. But there are problem with this: - The browser is independent from DrScheme, so such a server needs to keep running. This makes the instructions of how to use the whole thing more complicated -- since there should be some way to stop the background running server, etc. - Such a process will not have a small footprint, so it will be problematic for smaller machines. - Both of these problems might be hacked around somehow by making DrScheme run the server -- and on the HTML side do some JS hacking that will detect when the server is not there, and show a message saying that you need to have DrScheme running. - The next thing to tackle is multiple DrSchemes, possibly with different versions. This might be done by making the port depend on the version, but it still means that if I'm unfortunate to run DrScheme first on a dept server, then my process will do the searching for everyone else. - And to make things more fun -- there's also `plt-help', and just typing `help' in mzscheme. The first can just leave itself running, telling the user about it. In mzscheme, `help' could try to contact a running server and start its own if needed (similarly to the DrScheme situation, so the code will be shared). - And in addition there's a good number of smaller problems, like not being able to start a server due to some OS problems (eg, a different process listening on the same port, firewall issues, etc). * Yet another wild idea that was considered is to embed some browser. For example, include some browser with PLT (obviously, very bad), or use some OS hooks to do so (obviously, very difficult given the different platforms, and dealing with different browsers on each platform, and trying to get Windows to not just use IE to be polite etc). * Another possible *partial* solution is to make `F1' in DrScheme (as well as `plt-help' and MzScheme's `help') do the searching itself. This is certainly doable -- and was even the way it worked before the JS code was written. It would have the nice effect that you "pay" for the JS page only if you use it. However, there are some big problems with this: - The search code will be implemented in two places, using two different languages. Keeping them synced will be very difficult, and not doing so will be very bad (when people discover that there's a different way to search, which produces different results). BTW, the reason it will be difficult is that the search code is not at all trivial -- it does some scoring of the results, with different weights according to different factors, etc. - The interface to the search results will not be the same, since the scheme-based thing will just show a static page with results. I suppose that it's possible to make that static page have the same interface as the JS search so it appears the same, but load the index on demand (that is, when you change the query), but hacking something like that up is ... frightening. * A variation on the above: implement the Scheme search, and get rid of the JS search. This means no more dynamic searching, since it is effectively reverting back to the pre-JS days. * A variation on this variation, which might be feasible: no JS search, but compensate by making the Scheme side search into some widget that will show the dynamically found pages. Getting the Scheme-based browser is not a good option for the obvious reasons, but here we're talking about a classic GUI application. The main problems that I see with this: - "Return of the Help Desk". This is likely to have a sequel: "The Help Desk Strikes Back". For example -- `plt-help' and MzScheme's `help' are textual things. Possible solution is to have some textual interface. Given the nature of the problem, the way I imagine such an interface is likely to be lame enough to cause people some 80s-style flashbacks. (Making that Star Wars pun was more appropriate...) - To clarify -- I don't mean the whole help desk as it exited in pre-v4 days. I'm just referring to the help desk as another component in the PLT suite. An actual implementation will basically be just a search widget, perhaps with some way to mimic the toplevel set of pages. - No more searching on-line (which turned out to be more successful than I estimated) -- you want to find something in the docs, you need PLT installed, period. Possible solution is to have a search thing running on the server -- something that slaps a modern html/ajax/whatever skin on top of that 80s TUI. I'm happy to hear any other ideas people might have. (Note that I'm writing this sentence here, so it applies to people who read all of that...) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From neil at neilvandyke.org Sun Jun 7 08:31:07 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Sun Jun 7 08:31:38 2009 Subject: [plt-scheme] firefox locking up 15 seconds for each plt documentation search In-Reply-To: <18987.41614.846385.281248@winooski.ccs.neu.edu> References: <4A2AE422.40700@neilvandyke.org> <18987.41614.846385.281248@winooski.ccs.neu.edu> Message-ID: <4A2BB30B.9050702@neilvandyke.org> Eli Barzilay wrote at 06/07/2009 07:20 AM: > I'm happy to hear any other ideas people might have. As I said, with Firebug disabled, performance is fine for me. If the index is simply getting too big for some other browsers, another option is to break up the index and selectively load parts of it on demand. (I'm being vague saying "load" here, because I don't know whether the bottleneck would be I/O or JS/GC.) That would still use a normal Web browser and not require a Scheme server, but the implementation would be more complicated, and there would be latency issues compared to a browser that could keep the entire index loaded. -- http://www.neilvandyke.org/ From eli at barzilay.org Sun Jun 7 08:40:41 2009 From: eli at barzilay.org (Eli Barzilay) Date: Sun Jun 7 08:41:03 2009 Subject: [plt-scheme] firefox locking up 15 seconds for each plt documentation search In-Reply-To: <4A2BB30B.9050702@neilvandyke.org> References: <4A2AE422.40700@neilvandyke.org> <18987.41614.846385.281248@winooski.ccs.neu.edu> <4A2BB30B.9050702@neilvandyke.org> Message-ID: <18987.46409.175262.68355@winooski.ccs.neu.edu> On Jun 7, Neil Van Dyke wrote: > Eli Barzilay wrote at 06/07/2009 07:20 AM: > > I'm happy to hear any other ideas people might have. > > As I said, with Firebug disabled, performance is fine for me. > > If the index is simply getting too big for some other browsers, > another option is to break up the index and selectively load parts > of it on demand. (I'm being vague saying "load" here, because I > don't know whether the bottleneck would be I/O or JS/GC.) That > would still use a normal Web browser and not require a Scheme > server, but the implementation would be more complicated, and there > would be latency issues compared to a browser that could keep the > entire index loaded. The complication would be considerable, I think -- I don't see any obvious point where the code will decide to load the other chunks. Another issue with this is that "load" -- I think that the way to do that is to have JS code that dynamically add a script tag to the header, or some similar ajaxy-ish thing, and with the amount of headaches involved with JS running from local files, I hesitate to add more stuff. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From alcoholiday at gmail.com Sun Jun 7 00:51:51 2009 From: alcoholiday at gmail.com (Scott) Date: Sun Jun 7 08:42:14 2009 Subject: [Fluxus] [plt-scheme] Repl during animation or simulation In-Reply-To: <8763fakcfn.fsf@gmail.com> References: <66c9435a0906031628v79be3d74hc5b78a9d54b4eb91@mail.gmail.com> <4A27288C.90707@ccs.neu.edu> <66c9435a0906031908l1c98c280g34b5020047c511b2@mail.gmail.com> <4A273607.8030901@ccs.neu.edu> <87k53shdpt.fsf@gmail.com> <66c9435a0906032124g17aa3a67nee647fa5d483dbf2@mail.gmail.com> <1244125517.6645.7.camel@darkstar> <8763fakcfn.fsf@gmail.com> Message-ID: <90f797520906062151s4442a42dxe3eeeb87692bb39b@mail.gmail.com> This is what my emacs run-scheme looks like: mred-text -i -t /usr/local/collects/fluxus-016/drflux.ss But as someone else said, as long as you have the fluxus collects path set correctly, a simple: MrEd v4.1.4 [3m], Copyright (c) 2004-2009 PLT Scheme Inc. > (require fluxus-016/drflux) Should pop open a window and get you rolling. -Scott On Fri, Jun 5, 2009 at 7:00 AM, Glauber Alex Dias Prado wrote: > Erich Rast writes: > >>> ? ? ? ? Fluxus use this feature to enable live-coding "in the loop" :), >> >> I know I should be asking this on the fluxus mailing list, but while >> we're at it...Fluxus own scratchpad is just not usable for developing >> larger programs. The docs on the fluxus page say you should compile your >> own binary, but with all the dependencies I'll likely never get this to >> work. >> >> So is there any downloadable OS X binary for DrScheme with Fluxus >> built-in? > > I guess you can use the OSX binary from the download page and your already > installed DrScheme i think, as long as DrScheme can recognize fluxus > paths for libs nothing will prevent it from working afaik, but then im > not a OSX user so i may be missing something. In the worst scenario you > will have to install all dependencies trough OSX ports system which > might not be so difficult, and compile fluxus so it will be installed > where PLT wants it to be so nothing hard for it to recognize it. > >> >> Best, >> >> Erich >> >> _________________________________________________ >> ? For list-related administrative tasks: >> ? http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From toddobryan at gmail.com Sun Jun 7 09:11:26 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sun Jun 7 09:11:47 2009 Subject: [plt-scheme] More SchemeUnit confusion Message-ID: <904774730906070611j5a53c583p328c1063c01cbccb@mail.gmail.com> What's the SchemeUnit equivalent of JUnit setUp and tearDown? I'm trying to test display and write functions for structures where I've set the #prop:custom-write properties. I thought: (define OUTPUTS (test-suite "Outputs" #:before (lambda () (set! out (open-output-string))) (test-case "write R1" (write R1 out) (check-equal? (get-output-string out) "(make-Rule S (E))")) (test-case "write R2" (write R2 out) (check-equal? (get-output-string out) "(make-Rule E (E \"-\" T)")))) would reset out to a fresh output-port before each test case, but it looks like it just runs once at the beginning of the suite rather than before each test-case. What's the right way of doing this? Todd From dherman at ccs.neu.edu Sun Jun 7 12:11:50 2009 From: dherman at ccs.neu.edu (Dave Herman) Date: Sun Jun 7 12:12:16 2009 Subject: [plt-scheme] firefox locking up 15 seconds for each plt documentation search In-Reply-To: <18987.41614.846385.281248@winooski.ccs.neu.edu> References: <4A2AE422.40700@neilvandyke.org> <18987.41614.846385.281248@winooski.ccs.neu.edu> Message-ID: > I'm happy to hear any other ideas people might have. I don't know how the search algorithm works, but if the algorithm is fairly simple and unchanging, and it's just the index that changes frequently, it seems to me a middle ground solution to the problems with having two different search implementations would be: - build one index - from this index, auto-generate the data in two separate formats, one Scheme-friendly, one JS-friendly - implement the search algorithm separately in both Scheme and JS This is not as over-engineered as, say, compiling the Scheme search algorithm to JS, but it should mean the two implementations aren't as likely to diverge in behavior since they're both using the same index. Dave From eli at barzilay.org Sun Jun 7 12:30:30 2009 From: eli at barzilay.org (Eli Barzilay) Date: Sun Jun 7 12:32:36 2009 Subject: [plt-scheme] firefox locking up 15 seconds for each plt documentation search In-Reply-To: References: <4A2AE422.40700@neilvandyke.org> <18987.41614.846385.281248@winooski.ccs.neu.edu> Message-ID: <18987.60198.305350.534295@winooski.ccs.neu.edu> On Jun 7, Dave Herman wrote: > > I'm happy to hear any other ideas people might have. > > I don't know how the search algorithm works, but if the algorithm is > fairly simple and unchanging, and it's just the index that changes > frequently, it seems to me a middle ground solution to the problems > with having two different search implementations would be: > > - build one index > - from this index, auto-generate the data in two separate formats, > one Scheme-friendly, one JS-friendly > - implement the search algorithm separately in both Scheme and JS > > This is not as over-engineered as, say, compiling the Scheme search > algorithm to JS, but it should mean the two implementations aren't > as likely to diverge in behavior since they're both using the same > index. The problem is that the complication is not something that can be folded into an index. Here are some factors that change the scoring (it's not really scoring at the moment, but see below): * If there are exact matches for some "foo-bar", then they should be first. * If there are "foo-bar.*" keywords, they should appear soon after. * Same goes for keywords that have a "foo" in them (ie, matches for "\bfoo\b"), of course having both "foo" and "bar" should count higher. * Next should be matches for "\bfoo". * Matches from scheme/* are preferred over other modules. * ... but that's just an approximation, and eventually there should be a way to prefer other modules (for example, r5rs should prefer its own bindings, but still show others; and OTOH, BSL should show only its own matches and perhaps teachpack matches). * Further complicated by having multiple keywords specified with some operatos between them (currently the terms are all `and'ed though). * And finally there is the "context query" thing which is used to pre-filter the vector to search. As you can see, not only is this not trivial code, it's very fragile in the sense that it needs to change when there are new surprises. For example, I never thought of the whole word-boundary thing, until people complained that if, for example, you're looking for "copy-vector", then you should see the match for "vector-copy!". (And of course that implies that Scheme would be much better to do all of this, since then I can have a testsuite in the form of checking such expectations whenever there are changes to the rules, weights, orderings, etc.) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From henk at henk.ca Sun Jun 7 12:35:41 2009 From: henk at henk.ca (Henk Boom) Date: Sun Jun 7 12:36:00 2009 Subject: [plt-scheme] firefox locking up 15 seconds for each plt documentation search In-Reply-To: <18987.46409.175262.68355@winooski.ccs.neu.edu> References: <4A2AE422.40700@neilvandyke.org> <18987.41614.846385.281248@winooski.ccs.neu.edu> <4A2BB30B.9050702@neilvandyke.org> <18987.46409.175262.68355@winooski.ccs.neu.edu> Message-ID: 2009/6/7 Eli Barzilay : > On Jun ?7, Neil Van Dyke wrote: >> Eli Barzilay wrote at 06/07/2009 07:20 AM: >> > I'm happy to hear any other ideas people might have. >> >> As I said, with Firebug disabled, performance is fine for me. >> >> If the index is simply getting too big for some other browsers, >> another option is to break up the index and selectively load parts >> of it on demand. ?(I'm being vague saying "load" here, because I >> don't know whether the bottleneck would be I/O or JS/GC.) ?That >> would still use a normal Web browser and not require a Scheme >> server, but the implementation would be more complicated, and there >> would be latency issues compared to a browser that could keep the >> entire index loaded. > > The complication would be considerable, I think -- I don't see any > obvious point where the code will decide to load the other chunks. Why not keep only the identifier and module names in the main index, then when the user clicks on the link get the html information from a .js file based on a hash of the name? Just from looking at the index file it seems that this would shrink it quite a bit. Henk From eli at barzilay.org Sun Jun 7 12:45:02 2009 From: eli at barzilay.org (Eli Barzilay) Date: Sun Jun 7 12:45:26 2009 Subject: [plt-scheme] firefox locking up 15 seconds for each plt documentation search In-Reply-To: References: <4A2AE422.40700@neilvandyke.org> <18987.41614.846385.281248@winooski.ccs.neu.edu> <4A2BB30B.9050702@neilvandyke.org> <18987.46409.175262.68355@winooski.ccs.neu.edu> Message-ID: <18987.61070.354579.936597@winooski.ccs.neu.edu> On Jun 7, Henk Boom wrote: > > Why not keep only the identifier and module names in the main index, > then when the user clicks on the link get the html information from > a .js file based on a hash of the name? Just from looking at the > index file it seems that this would shrink it quite a bit. * Note that as soon as you stop typing, it starts a search, and to display the results it will need the rest of the information. (You could argue for changing that interface though, and make it require clicking some search button or hitting enter -- but see below.) * If the hashes are good, it means that results will be distributed nicely over all sub-files, which means that an average batch of results will hit all of them, so you'll end up loading all data anyway, and possibly slower, since it'll neead to read a file, and merge the data into the main index vector, with all the accounting that it implies. * Another problem is what I mentioned earlier -- it requires runtime loading of files, which can be a pain when used with local pages. * In addition, there are additional bits of information that are needed: - What's the type of the entry (eg, you can use `M:' to search only for bindings)? - Which module is it coming from (the full version of that operator is `M:' to restrict searches only for bindings in matching modules)? - Which manual is it coming from (the `T:' operator makes the search specific to a manual)? -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From henk at henk.ca Sun Jun 7 12:53:46 2009 From: henk at henk.ca (Henk Boom) Date: Sun Jun 7 12:54:05 2009 Subject: [plt-scheme] firefox locking up 15 seconds for each plt documentation search In-Reply-To: <18987.61070.354579.936597@winooski.ccs.neu.edu> References: <4A2AE422.40700@neilvandyke.org> <18987.41614.846385.281248@winooski.ccs.neu.edu> <4A2BB30B.9050702@neilvandyke.org> <18987.46409.175262.68355@winooski.ccs.neu.edu> <18987.61070.354579.936597@winooski.ccs.neu.edu> Message-ID: 2009/6/7 Eli Barzilay : > On Jun ?7, Henk Boom wrote: >> >> Why not keep only the identifier and module names in the main index, >> then when the user clicks on the link get the html information from >> a .js file based on a hash of the name? Just from looking at the >> index file it seems that this would shrink it quite a bit. > > * Note that as soon as you stop typing, it starts a search, and to > ?display the results it will need the rest of the information. ?(You > ?could argue for changing that interface though, and make it require > ?clicking some search button or hitting enter -- but see below.) > > * If the hashes are good, it means that results will be distributed > ?nicely over all sub-files, which means that an average batch of > ?results will hit all of them, so you'll end up loading all data > ?anyway, and possibly slower, since it'll neead to read a file, and > ?merge the data into the main index vector, with all the accounting > ?that it implies. > > * Another problem is what I mentioned earlier -- it requires runtime > ?loading of files, which can be a pain when used with local pages. > > * In addition, there are additional bits of information that are > ?needed: > ?- What's the type of the entry (eg, you can use `M:' to search only > ? ?for bindings)? > ?- Which module is it coming from (the full version of that operator > ? ?is `M:' to restrict searches only for bindings in matching > ? ?modules)? > ?- Which manual is it coming from (the `T:' operator makes the search > ? ?specific to a manual)? Ah, I see it's more complicated than I thought. I can reply to some of the points you bring up, but not all: Why does it need the rest of the information to display the results? If you only fetch the URL when the user clicks the link it seems that only the name and the module are needed for display. This means that typically you would need only to load a single one of the hash .js files. If you include the module name and the manual name (perhaps by index) in the main .js file then M: and T: should work fine as far as I can tell. Henk From pocmatos at gmail.com Sun Jun 7 12:53:33 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Sun Jun 7 12:54:31 2009 Subject: [plt-scheme] Dict Merge Message-ID: <11b141710906070953t758d644jea03248d0d63a688@mail.gmail.com> Hi all, Since I didn't find a portable way (among dict types) to merge several dicts I devised one (which assumes that no dicts have the same key): ;; dict-merge : dict? ..1 ;; Receives a list of dictionaries and merges them into a single dictionary. ;; The resulting dictionary is of the same time of the first dictionary and assumes that the set of keys of each dict are disjoint. (define dict-merge (case-lambda [(dict) dict] [(dict1 dict2) (let loop ([res dict1] [next (dict-iterate-first dict2)]) (if next (loop (dict-set res (dict-iterate-key dict2 next) (dict-iterate-value dict2 next)) (dict-iterate-next dict2 next)) res))] [(dict . dicts) (foldl (lambda (el acum) (dict-merge acum el)) dict dicts)])) > (dict-merge #hash((b . "banana") (a . "apple")) #hash((c . "cider") (p . "pizza"))) #hash((b . "banana") (a . "apple") (c . "cider") (p . "pizza")) > (dict-merge #hash((b . "banana") (a . "apple")) '((c . "cider") (p . "pizza"))) #hash((b . "banana") (a . "apple") (c . "cider") (p . "pizza")) Is this a good way to do it or can you improve on it? (moreover, why is there no such thing already in the library? it would be interesting to add one) Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From neil at neilvandyke.org Sun Jun 7 15:07:11 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Sun Jun 7 15:07:43 2009 Subject: [plt-scheme] How Hacker News was hacked In-Reply-To: <4A26B8C9.3010705@soegaard.net> References: <4A26B8C9.3010705@soegaard.net> Message-ID: <4A2C0FDF.8060603@neilvandyke.org> Jens Axel Soegaard wrote at 06/03/2009 01:54 PM: > http://news.ycombinator.com/item?id=639976 > I just added to PLaneT a library that generates (hopefully secure) random string tokens for this purpose, making fairly efficient use of scare randomness in "/dev/random": http://www.neilvandyke.org/randtok-scheme/ -- http://www.neilvandyke.org/ From jos.koot at telefonica.net Sun Jun 7 16:55:38 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Sun Jun 7 16:56:04 2009 Subject: [plt-scheme] lc-with-redex Message-ID: <55A4707F131D4A6885848EC16D04BBEE@uw2b2dff239c4d> Someone wrote me off list: "Very cool. I think it would be great as a PDF or Scribble document." My answer: "Thanks for your nice reaction. You are right, of course. However, I do not have tools on my PC to convert msword doc files to pdf. As a scribbler I am a terrible know/can-nothing. May be someone is willing to do the conversion to pdf for me. In that case please use the most recent version in http://telefonica.net/web2/koot/lc-with-redex.zip . I am retired, which means that I have to pay myself for all resources. I am not poor, but neither rich." How great that PLT-Scheme is for free!!! Jos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090607/781b6f77/attachment-0001.html From hendrik at topoi.pooq.com Sun Jun 7 19:23:58 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Sun Jun 7 19:30:46 2009 Subject: [plt-scheme] lc-with-redex In-Reply-To: <55A4707F131D4A6885848EC16D04BBEE@uw2b2dff239c4d> References: <55A4707F131D4A6885848EC16D04BBEE@uw2b2dff239c4d> Message-ID: <20090607232358.GA18199@topoi.pooq.com> On Sun, Jun 07, 2009 at 10:55:38PM +0200, Jos Koot wrote: > Someone wrote me off list: "Very cool. I think it would be great as a PDF or Scribble document." > > My answer: > > "Thanks for your nice reaction. You are right, of course. However, I do not have tools on my PC to convert msword doc files to pdf. > As a scribbler I am a terrible know/can-nothing. May be someone is willing to do the conversion to pdf for me. In that case please > use the most recent version in http://telefonica.net/web2/koot/lc-with-redex.zip . I am retired, which means that I have to pay > myself for all resources. I am not poor, but neither rich." > > How great that PLT-Scheme is for free!!! So is OpenOffice. And it will read Word files, and can export to pdf! It will also handle ODF files (which it calls .odt), which is the new international standard word-processor format. It's great that OpenOffice is free, too! -- hendrik (for more information, see www.openoffice.org) From pocmatos at gmail.com Mon Jun 8 05:36:43 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Mon Jun 8 05:37:26 2009 Subject: [plt-scheme] PP Code Message-ID: <11b141710906080236i66947d24icae564ff19c1fd7f@mail.gmail.com> Hi all, I am generating Scheme code on-the-fly and the code has bugs... :( By opening the file with the generated code and inspecting I can see nothing since the code was all written on the same line. Is there a way to pretty print the file in a readable way? Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From spdegabrielle at gmail.com Mon Jun 8 05:55:27 2009 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Mon Jun 8 05:55:46 2009 Subject: [plt-scheme] manually setting the size of a pasteboard Message-ID: <595b9ab20906080255k987b7d2ie4a047249219e35e@mail.gmail.com> Hi, I'm trying to manually set the size of a pasteboard I tried overriding get-extent - but just started creating errors > set-scroll-pos in canvas%: expected argument of type ; given -1 I get no reponse from the editor method ; (send an-editor set-max-height width) I know inserting a snip at my maximum x,y will do it - but that seems wrong. Any suggestions? Thanks, Stephen -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090608/ec04c841/attachment.html From toddobryan at gmail.com Mon Jun 8 06:46:41 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Mon Jun 8 06:47:04 2009 Subject: [plt-scheme] PP Code In-Reply-To: <11b141710906080236i66947d24icae564ff19c1fd7f@mail.gmail.com> References: <11b141710906080236i66947d24icae564ff19c1fd7f@mail.gmail.com> Message-ID: <904774730906080346v34ff13eal79ea3581ad5b0f40@mail.gmail.com> Is this what you want? http://docs.plt-scheme.org/reference/pretty-print.html#(def._((lib._scheme/pretty..ss)._pretty-print)) On Mon, Jun 8, 2009 at 5:36 AM, Paulo J. Matos wrote: > Hi all, > > I am generating Scheme code on-the-fly and the code has bugs... :( > By opening the file with the generated code and inspecting I can see > nothing since the code was all written on the same line. Is there a > way to pretty print the file in a readable way? > > Cheers, > > -- > Paulo Jorge Matos - pocmatos at gmail.com > http://www.pmatos.net > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From pocmatos at gmail.com Mon Jun 8 06:51:58 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Mon Jun 8 06:52:42 2009 Subject: [plt-scheme] PP Code In-Reply-To: <904774730906080346v34ff13eal79ea3581ad5b0f40@mail.gmail.com> References: <11b141710906080236i66947d24icae564ff19c1fd7f@mail.gmail.com> <904774730906080346v34ff13eal79ea3581ad5b0f40@mail.gmail.com> Message-ID: <11b141710906080351i7df645e8ic210fa98f428297b@mail.gmail.com> On Mon, Jun 8, 2009 at 11:46 AM, Todd O'Bryan wrote: > Is this what you want? > > http://docs.plt-scheme.org/reference/pretty-print.html#(def._((lib._scheme/pretty..ss)._pretty-print)) > I was just wondering if there was a command line app out there but yes, that seems to do it. Thanks for the reference. > On Mon, Jun 8, 2009 at 5:36 AM, Paulo J. Matos wrote: >> Hi all, >> >> I am generating Scheme code on-the-fly and the code has bugs... :( >> By opening the file with the generated code and inspecting I can see >> nothing since the code was all written on the same line. Is there a >> way to pretty print the file in a readable way? >> >> Cheers, >> >> -- >> Paulo Jorge Matos - pocmatos at gmail.com >> http://www.pmatos.net >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From jadudm at gmail.com Mon Jun 8 06:59:27 2009 From: jadudm at gmail.com (Matt Jadud) Date: Mon Jun 8 06:59:53 2009 Subject: [plt-scheme] PP Code In-Reply-To: <11b141710906080351i7df645e8ic210fa98f428297b@mail.gmail.com> References: <11b141710906080236i66947d24icae564ff19c1fd7f@mail.gmail.com> <904774730906080346v34ff13eal79ea3581ad5b0f40@mail.gmail.com> <11b141710906080351i7df645e8ic210fa98f428297b@mail.gmail.com> Message-ID: On Mon, Jun 8, 2009 at 6:51 AM, Paulo J. Matos wrote: > I was just wondering if there was a command line app out there but > yes, that seems to do it. > Thanks for the reference. Er... in Schemely pseudo-syntax... #lang scheme (require pretty-print cmdline) (pretty-print (command-line-args 0)) You could throw together the command-line application that does this, I would think. (I know I'm stating the obvious, but I'm mentioning it anyway.) Cheers, Matt From jos.koot at telefonica.net Mon Jun 8 04:29:12 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Mon Jun 8 08:18:01 2009 Subject: [plt-scheme] lc-with-redex References: <55A4707F131D4A6885848EC16D04BBEE@uw2b2dff239c4d> <377CC605-0071-4991-B524-BD7AE6D728C4@fellowhuman.com> Message-ID: <88574B358B3647C49CD05DE46533500A@uw2b2dff239c4d> Thanks for the conversions. I am overwhelmed by your friendly responses. I have downloaded CutePDF. Did not know there was a free converter. The converted pdf files do not recognize links links within the document nor to local files, but I'll find a way to circumvent that (I probably should write out the full urls) Anyway there is now a pdf version at http://telefonica.net/web2/koot/lc-with-redex.pdf A version with correct hyperlinks is to come today or tomorrow. Thanks to all of you, and of course thanks to the authors who permitted me to steel and modify their material (Daniel P. Friedman, Matthias Felleisen, Douglas R. Hofstadter) I also used knowledge and an example from Barendregt's book "The Lambda Calculus, ... " but I have not been able to contact him. Jos ----- Original Message ----- From: "Jordan Johnson" To: "Jos Koot" Sent: Monday, June 08, 2009 3:17 AM Subject: Re: [plt-scheme] lc-with-redex > Jos-- > > Here you go...and FYI, in addition to OpenOffice (which may be your > best bet for doing the conversion yourself), if you have access to a > Mac or know anyone who does, at this point OS X provides conversion to > PDF for any program that can print. > > Thanks for making this document -- a nice review of the LC! > > Best, > jmj > > -------------------------------------------------------------------------------- > > > > On Jun 7, 2009, at 1:55 PM, Jos Koot wrote: > >> Someone wrote me off list: "Very cool. I think it would be great as >> a PDF or Scribble document." >> >> My answer: >> >> "Thanks for your nice reaction. You are right, of course. However, I >> do not have tools on my PC to convert msword doc files to pdf. >> As a scribbler I am a terrible know/can-nothing. May be someone is >> willing to do the conversion to pdf for me. In that case please >> use the most recent version in http://telefonica.net/web2/koot/lc-with-redex.zip >> . I am retired, which means that I have to pay >> myself for all resources. I am not poor, but neither rich." >> >> How great that PLT-Scheme is for free!!! >> >> Jos >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From noelwelsh at gmail.com Mon Jun 8 08:24:55 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Mon Jun 8 08:25:17 2009 Subject: [plt-scheme] for comprehensions in typed-scheme Message-ID: Hi, Does typed-scheme support for comprehensions? If so, how do I use them? (If not, bummer.) N. From samth at ccs.neu.edu Mon Jun 8 08:45:35 2009 From: samth at ccs.neu.edu (Sam TH) Date: Mon Jun 8 08:45:56 2009 Subject: [plt-scheme] for comprehensions in typed-scheme In-Reply-To: References: Message-ID: <63bb19ae0906080545l6d16799g67549b953bd13ed2@mail.gmail.com> This works: #lang typed-scheme (: l (Listof Number)) (define l (list 1 2 3)) (for/lists (#{y : (Listof Number)}) ([z (in-list l)]) (* z z)) At the moment, you need to use a version of `for' where you can specify the type of the accumulator, such as `for/lists', or one that doesn't have an accumulator, such as `for' itself. And you need to specify the "type" of the values being iterated over, using something like `in-list'. I hope to remove both of these restrictions eventually. sam th On Mon, Jun 8, 2009 at 8:24 AM, Noel Welsh wrote: > Hi, > > Does typed-scheme support for comprehensions? If so, how do I use > them? (If not, bummer.) > > N. > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- sam th samth@ccs.neu.edu From noelwelsh at gmail.com Mon Jun 8 09:54:36 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Mon Jun 8 09:54:56 2009 Subject: [plt-scheme] for comprehensions in typed-scheme In-Reply-To: <63bb19ae0906080545l6d16799g67549b953bd13ed2@mail.gmail.com> References: <63bb19ae0906080545l6d16799g67549b953bd13ed2@mail.gmail.com> Message-ID: On Mon, Jun 8, 2009 at 1:45 PM, Sam TH wrote: > This works: Groovy. Next dumb question: (define-struct: Mark ()) (define-struct: (Dot Mark) ([x : Number] [y : Number])) (: bounding-box ((Listof Dot) -> Box)) (define (bounding-box marks) ;; This only works for Dots. It should work for all Marks (define: xs : (Listof Number) (map Dot-x marks)) (define: ys : (Listof Number) (map Dot-y marks)) (define: max-x : Number (#{apply @ Number Number} max xs)) (define: max-y : Number (apply max ys)) (define: min-x : Number (apply min xs)) (define: min-y : Number (apply min ys)) ... ) All the calls to apply fail with typecheck: Bad arguments to function in apply: Domain: Number Number * Arguments: (Listof Number) * I don't get it! At the REPL I can do: (apply max (list 1 2 3 4)) and it works. My expressions above seem equivalent. What must I do to get this past the type checker? N. From samth at ccs.neu.edu Mon Jun 8 10:13:13 2009 From: samth at ccs.neu.edu (Sam TH) Date: Mon Jun 8 10:13:32 2009 Subject: [plt-scheme] for comprehensions in typed-scheme In-Reply-To: References: <63bb19ae0906080545l6d16799g67549b953bd13ed2@mail.gmail.com> Message-ID: <63bb19ae0906080713j74dd5b5bl9fd40be436efd9a7@mail.gmail.com> On Mon, Jun 8, 2009 at 9:54 AM, Noel Welsh wrote: > All the calls to apply fail with > > typecheck: Bad arguments to function in apply: > Domain: Number Number * > Arguments: (Listof Number) * `max' requires at least one argument, and those lists you are providing might be empty. If you provide one fixed argument, it will work: (apply max n l) This expression, (apply max (list 1 2 3)) works because TS can tell that that list is non-empty. -- sam th samth@ccs.neu.edu From matthias at ccs.neu.edu Mon Jun 8 10:18:06 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Jun 8 10:18:49 2009 Subject: [plt-scheme] for comprehensions in typed-scheme In-Reply-To: References: <63bb19ae0906080545l6d16799g67549b953bd13ed2@mail.gmail.com> Message-ID: Noel, Sam is trying to imitate ML's bad type error messages and I am afraid he's succeeding all too well. Sorry. In your case, you need to read the error message as max consumes at least one number and a possible empty sequence of additional numbers. You, the programmer, is trying to make max compute the maximum of a list of numbers, via apply. But silly, don't you know that lists can be empty?!! Here is another way of saying this: > #lang typed-scheme > > (: f ((Listof Number) -> Number)) > (define (f y) > (define x (apply max (car y) (cdr y))) > x) Of course note that (car y) does NOT signal a type error. The typed language has turned the potential error of computing the max from a compile time type error into a run-time check/error -- QUIETLY. Aren't typed languages beautiful? On Jun 8, 2009, at 9:54 AM, Noel Welsh wrote: > On Mon, Jun 8, 2009 at 1:45 PM, Sam TH wrote: >> This works: > > Groovy. > > Next dumb question: > > (define-struct: Mark ()) > (define-struct: (Dot Mark) ([x : Number] [y : Number])) > > (: bounding-box ((Listof Dot) -> Box)) > (define (bounding-box marks) > ;; This only works for Dots. It should work for all Marks > (define: xs : (Listof Number) (map Dot-x marks)) > (define: ys : (Listof Number) (map Dot-y marks)) > (define: max-x : Number (#{apply @ Number Number} max xs)) > (define: max-y : Number (apply max ys)) > (define: min-x : Number (apply min xs)) > (define: min-y : Number (apply min ys)) > ... > ) > > All the calls to apply fail with > > typecheck: Bad arguments to function in apply: > Domain: Number Number * > Arguments: (Listof Number) * > > I don't get it! At the REPL I can do: > > (apply max (list 1 2 3 4)) > > and it works. My expressions above seem equivalent. What must I do to > get this past the type checker? > > N. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From eli at barzilay.org Mon Jun 8 10:44:52 2009 From: eli at barzilay.org (Eli Barzilay) Date: Mon Jun 8 10:45:14 2009 Subject: [plt-scheme] for comprehensions in typed-scheme In-Reply-To: References: <63bb19ae0906080545l6d16799g67549b953bd13ed2@mail.gmail.com> Message-ID: <18989.9188.209566.674466@winooski.ccs.neu.edu> On Jun 8, Matthias Felleisen wrote: > > Noel, Sam is trying to imitate ML's bad type error messages and I am > afraid he's succeeding all too well. Sorry. > > In your case, you need to read the error message as > > max consumes at least one number and a possible empty sequence of > additional numbers. I think that this error message typecheck: Bad arguments to function in apply: Domain: Number Number * Arguments: (Listof Number) * *is* confusing, probably because it's talking about `apply', but the problem is the type it (`apply') expects when used with `max'. Isn't that domain the one for `max'? -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From samth at ccs.neu.edu Mon Jun 8 10:53:21 2009 From: samth at ccs.neu.edu (Sam TH) Date: Mon Jun 8 10:53:40 2009 Subject: [plt-scheme] for comprehensions in typed-scheme In-Reply-To: <18989.9188.209566.674466@winooski.ccs.neu.edu> References: <63bb19ae0906080545l6d16799g67549b953bd13ed2@mail.gmail.com> <18989.9188.209566.674466@winooski.ccs.neu.edu> Message-ID: <63bb19ae0906080753t326bbd57wf2dc76e35710dae@mail.gmail.com> On Mon, Jun 8, 2009 at 10:44 AM, Eli Barzilay wrote: > On Jun ?8, Matthias Felleisen wrote: >> >> Noel, Sam is trying to imitate ML's bad type error messages and I am >> afraid he's succeeding all too well. Sorry. >> >> In your case, you need to read the error message as >> >> ? max consumes at least one number and a possible empty sequence of >> additional numbers. > > I think that this error message > > ?typecheck: Bad arguments to function in apply: > ?Domain: Number Number * > ?Arguments: (Listof Number) * > > *is* confusing, probably because it's talking about `apply', but the > problem is the type it (`apply') expects when used with `max'. ?Isn't > that domain the one for `max'? Yes, it is. Can you suggest a different message? Especially one that works when `max' is an arbitrary expression, and not an identifier? -- sam th samth@ccs.neu.edu From noelwelsh at gmail.com Mon Jun 8 10:57:16 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Mon Jun 8 10:57:35 2009 Subject: [plt-scheme] for comprehensions in typed-scheme In-Reply-To: <63bb19ae0906080753t326bbd57wf2dc76e35710dae@mail.gmail.com> References: <63bb19ae0906080545l6d16799g67549b953bd13ed2@mail.gmail.com> <18989.9188.209566.674466@winooski.ccs.neu.edu> <63bb19ae0906080753t326bbd57wf2dc76e35710dae@mail.gmail.com> Message-ID: On Mon, Jun 8, 2009 at 3:53 PM, Sam TH wrote: > Yes, it is. ?Can you suggest a different message? ?Especially one that > works when `max' is an arbitrary expression, and not an identifier? The first argument to apply expects arguments with a type but received N. From mflatt at cs.utah.edu Mon Jun 8 11:32:56 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Mon Jun 8 11:33:18 2009 Subject: [plt-scheme] manually setting the size of a pasteboard In-Reply-To: <595b9ab20906080255k987b7d2ie4a047249219e35e@mail.gmail.com> References: <595b9ab20906080255k987b7d2ie4a047249219e35e@mail.gmail.com> Message-ID: <20090608153259.1FD186500D7@mail-svr1.cs.utah.edu> At Mon, 8 Jun 2009 10:55:27 +0100, Stephen De Gabrielle wrote: > I'm trying to manually set the size of a pasteboard > > [...] > > Any suggestions? `set-min-width', `set-max-width', `set-in-height', and `set-max-height'. From eli at barzilay.org Mon Jun 8 13:07:45 2009 From: eli at barzilay.org (Eli Barzilay) Date: Mon Jun 8 13:08:08 2009 Subject: [plt-scheme] scribble/reader Message-ID: <18989.17761.454304.296325@winooski.ccs.neu.edu> The API for the Scribble reader is now extended in the repository. Previously, the `make-at-readtable' function could be used to create a customized reader, but getting a customized `-inside' reader was impossible without knowing exactly how the readtable is organized. The extension is a new `make-at-reader' function, which can create either a `read' or a `read-syntax' function based on a `#:syntax?' keyword argument, and they can create an "inside" reader based on an `#:inside?' keyword. With this, it is possible to easily implement a `scribble/text'-like language that uses a different command character. For example, the code below does just that, and uses a backslash. On a related note, I have recently played with combining this kind of backslash-based preprocessor combined with some `#%top' and `#%app' magic to create a language where unbound identifiers will just spit their own forms out -- for example, if there is no binding for `emph', then this: foo \emph{bar} baz will lead to spitting out the exact same line on its output. The result is a Scheme/latex hybrid language, where latex commands work, but you can extend or redefine commands in Scheme, which in general is much better than dealing with ing la/tex (read "" with some word that customizes this sentence according to your personal horror experiences). This is not working completely right though, for example, `\\' doesn't work right, because the second `\' is read as part of a scheme identifier; \foo[x, y]{blah} doesn't work right because the bracketed part is read in Scheme, and, of course, you might have a Scheme binding that happens to shadow a latex command name. The most obvious example of this is `\begin' -- which I solved by making it also spit out its own form if it is written as a scribble expression. Overall, my opinion about it is not really clear yet. On one hand, choosing a different character is better because none of these problems happen; but on the other hand I find it extremely useful to just type the text without explicitly knowing which commands are implemented in Scheme, and which in latex. This is a strong point: using the same syntax means that I can start with the usual `\emph', then extend it in latex because of some reason, and then switch to Scheme if it becomes too complex. Still, it's a cute hack, and I can put it up somewhere if anyone's interested in trying it out. Maybe there is some way to fix things up in the future so it is no longer a hack... ------------------------------------------------------------------------------- #lang s-exp syntax/module-reader scribble/text/textlang #:read read-inside #:read-syntax read-syntax-inside #:whole-body-readers? #t (require (prefix-in scribble: scribble/reader)) (define read-syntax-inside (scribble:make-at-reader #:inside? #t #:command-char #\\ #:syntax? #t)) (define read-inside (scribble:make-at-reader #:inside? #t #:command-char #\\ #:syntax? #f)) ------------------------------------------------------------------------------- -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From reb at cs.bilgi.edu.tr Mon Jun 8 13:49:44 2009 From: reb at cs.bilgi.edu.tr (=?utf-8?Q?R=2E_Emre_Ba=C5=9Far?=) Date: Mon Jun 8 13:50:31 2009 Subject: [plt-scheme] lc-with-redex In-Reply-To: <88574B358B3647C49CD05DE46533500A@uw2b2dff239c4d> References: <55A4707F131D4A6885848EC16D04BBEE@uw2b2dff239c4d> <377CC605-0071-4991-B524-BD7AE6D728C4@fellowhuman.com> <88574B358B3647C49CD05DE46533500A@uw2b2dff239c4d> Message-ID: <20090608174943.GE10838@terra.galaxy> I started converting it to scribble for easier publication online etc... Is it OK for everybody? Jos Koot der ki: > Thanks for the conversions. I am overwhelmed by your friendly responses. > I have downloaded CutePDF. Did not know there was a free converter. The > converted pdf files do not recognize links links within the document nor > to local files, but I'll find a way to circumvent that (I probably should > write out the full urls) > Anyway there is now a pdf version at http://telefonica.net/web2/koot/lc-with-redex.pdf > A version with correct hyperlinks is to come today or tomorrow. > Thanks to all of you, and of course thanks to the authors who permitted > me to steel and modify their material (Daniel P. Friedman, Matthias > Felleisen, Douglas R. Hofstadter) I also used knowledge and an example > from Barendregt's book "The Lambda Calculus, ... " but I have not been > able to contact him. > Jos > > ----- Original Message ----- From: "Jordan Johnson" > To: "Jos Koot" > Sent: Monday, June 08, 2009 3:17 AM > Subject: Re: [plt-scheme] lc-with-redex > > >> Jos-- >> >> Here you go...and FYI, in addition to OpenOffice (which may be your >> best bet for doing the conversion yourself), if you have access to a >> Mac or know anyone who does, at this point OS X provides conversion to >> PDF for any program that can print. >> >> Thanks for making this document -- a nice review of the LC! >> >> Best, >> jmj >> >> > > > -------------------------------------------------------------------------------- > > >> >> >> >> On Jun 7, 2009, at 1:55 PM, Jos Koot wrote: >> >>> Someone wrote me off list: "Very cool. I think it would be great as >>> a PDF or Scribble document." >>> >>> My answer: >>> >>> "Thanks for your nice reaction. You are right, of course. However, I >>> do not have tools on my PC to convert msword doc files to pdf. >>> As a scribbler I am a terrible know/can-nothing. May be someone is >>> willing to do the conversion to pdf for me. In that case please >>> use the most recent version in http://telefonica.net/web2/koot/lc-with-redex.zip >>> . I am retired, which means that I have to pay >>> myself for all resources. I am not poor, but neither rich." >>> >>> How great that PLT-Scheme is for free!!! >>> >>> Jos >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme -- R. Emre Ba?ar ?stanbul Bilgi University Department of Computer Science -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090608/ac8dd859/attachment.pgp From sbloch at adelphi.edu Mon Jun 8 14:41:12 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Mon Jun 8 14:41:47 2009 Subject: [plt-scheme] teachpacks breaking in 4.2 In-Reply-To: <88574B358B3647C49CD05DE46533500A@uw2b2dff239c4d> References: <55A4707F131D4A6885848EC16D04BBEE@uw2b2dff239c4d> <377CC605-0071-4991-B524-BD7AE6D728C4@fellowhuman.com> <88574B358B3647C49CD05DE46533500A@uw2b2dff239c4d> Message-ID: <5338E1B4-D90F-4189-BEF0-E34F7489673A@adelphi.edu> I'm trying to install my tiles and sb-world teachpacks into 4.2. Both of them worked (alone or together) in 4.1.3, but when I add either or both of these teachpacks and hit "Run", I get a horrible error message: require: namespace mismatch; reference (phase 0) to a module "C: \Program Files\PLT\collects\scheme\private\kw.ss" that is not available (phase level 0) First, what's going on? Second, how do I fix the teachpacks so they work with 4.2? (And, preferably, with 4.1.x as well.) I have to admit, I'm performing unnatural acts with a consenting "require", using it as an installer: when you "require" tiles.plt, it's supposed to install a file named tiles.ss into the local PLaneT cache, download and execute a file named install.ss, which writes a different file named tiles.ss into the installed-teachpacks directory that "require"s tiles.ss from PLaneT, which should be found in the local cache. This was the easiest (for the user) way I could think of to add a teachpack into the list of available teachpacks while simultaneously adding its documentation to the Help Desk. Anyway, this trick worked from 4.0 through 4.1.3, and it's not working now in 4.2. Stephen Bloch sbloch@adelphi.edu From sbloch at adelphi.edu Mon Jun 8 14:56:29 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Mon Jun 8 14:56:52 2009 Subject: [plt-scheme] teachpacks broken in 4.2 Message-ID: <087106D8-71F2-48E3-BD47-027FF9619CCB@adelphi.edu> I'm testing my tiles.plt and sb-world teachpacks in 4.2, and getting a horrible error message: as soon as I "add teachpack" and click "Run", I see require: namespace mismatch; reference (phase 0) to a module "/ Applications/PLT Scheme v4.2/collects/scheme/private/kw.ss" that is not available (phase level 0) So I have a couple of questions: 1) What happened? 2) How do I fix the teachpack so it works with both 4.2 and 4.1.x? This may be a side effect of the unnatural acts I've been committing with a consenting "require", using it as an installer. I tell students to "(require (planet "install.ss" ("sbloch" "tiles.plt" 1 14)))" and similarly for "sb-world", ONCE each. This is supposed to download and store the contents of the PLT file in the local PLaneT cache including a file named "tiles.ss", then execute "install.ss", which writes a different file named "tiles.ss" into the installed- teachpacks directory, which in turn does a "(require (planet "tiles.ss" ...))" to bring in the one we just cached. After that, they can just add or clear those individual teachpacks. Sorta weird, but it was the easiest (for the user) way I could think of to add a teachpack to the list of available teachpacks and simultaneously add its documentation to the index. BTW, the bug arises on both MacOS and Windows (with, of course, a different pathname in the error message). Stephen Bloch sbloch@adelphi.edu From mflatt at cs.utah.edu Mon Jun 8 15:03:21 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Mon Jun 8 15:03:42 2009 Subject: [plt-scheme] teachpacks breaking in 4.2 In-Reply-To: <5338E1B4-D90F-4189-BEF0-E34F7489673A@adelphi.edu> References: <55A4707F131D4A6885848EC16D04BBEE@uw2b2dff239c4d> <377CC605-0071-4991-B524-BD7AE6D728C4@fellowhuman.com> <88574B358B3647C49CD05DE46533500A@uw2b2dff239c4d> <5338E1B4-D90F-4189-BEF0-E34F7489673A@adelphi.edu> Message-ID: <20090608190322.AC9BE65016F@mail-svr1.cs.utah.edu> At Mon, 8 Jun 2009 14:41:12 -0400, Stephen Bloch wrote: > I'm trying to install my tiles and sb-world teachpacks into 4.2. > Both of them worked (alone or together) in 4.1.3, but when I add > either or both of these teachpacks and hit "Run", I get a horrible > error message: > > require: namespace mismatch; reference (phase 0) to a module "C: > \Program Files\PLT\collects\scheme\private\kw.ss" that is not > available (phase level 0) > > First, what's going on? > Second, how do I fix the teachpacks so they work with 4.2? (And, > preferably, with 4.1.x as well.) I can answer the second question, at least. The "tiles.ss" teachpack file uses the `mzscheme' language. Changing it to `scheme/base' solves the problem for me: (module tiles scheme/base (require (planet "tiles.ss" ("sbloch" "tiles.plt" 1 12))) (provide (all-from-out (planet "tiles.ss" ("sbloch" "tiles.plt" 1 12)))) ) Meanwhile, we'll figure out why using `mzscheme' fails. From noelwelsh at gmail.com Mon Jun 8 16:07:50 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Mon Jun 8 16:08:19 2009 Subject: [plt-scheme] More SchemeUnit confusion In-Reply-To: <904774730906070611j5a53c583p328c1063c01cbccb@mail.gmail.com> References: <904774730906070611j5a53c583p328c1063c01cbccb@mail.gmail.com> Message-ID: On Sun, Jun 7, 2009 at 2:11 PM, Todd O'Bryan wrote: > What's the SchemeUnit equivalent of JUnit setUp and tearDown? before/after/around. You can also build an abstraction on top of test-case with a simple define-syntax: (define-syntax super-test-case (syntax-rules () [(_ expr ...) (test-case (around my-begin expr ... my-around))])) There was a discussion about this a little while ago, and I though the situation should be improved. The multiple context of SchemeUnit make this a little trickier than you might think; I decided a parameter current-around (or similar) would be best but never got around to implementing it. N. From ramalho at gmail.com Mon Jun 8 18:59:23 2009 From: ramalho at gmail.com (Luciano Ramalho) Date: Mon Jun 8 19:06:55 2009 Subject: [plt-scheme] lc-with-redex In-Reply-To: <88574B358B3647C49CD05DE46533500A@uw2b2dff239c4d> References: <55A4707F131D4A6885848EC16D04BBEE@uw2b2dff239c4d> <377CC605-0071-4991-B524-BD7AE6D728C4@fellowhuman.com> <88574B358B3647C49CD05DE46533500A@uw2b2dff239c4d> Message-ID: <4331ad810906081559n1f89871dsbfa512c086527a3c@mail.gmail.com> On Mon, Jun 8, 2009 at 5:29 AM, Jos Koot wrote: > Thanks for the conversions. I am overwhelmed by your friendly responses. I > have downloaded CutePDF. Did not know there was a free converter. The > converted pdf files do not recognize links links within the document nor to > local files, but I'll find a way to circumvent that (I probably should write > out the full urls) > Anyway there is now a pdf version at > http://telefonica.net/web2/koot/lc-with-redex.pdf > A version with correct hyperlinks is to come today or tomorrow. > Thanks to all of you, and of course thanks to the authors who permitted me > to steel and modify their material (Daniel P. Friedman, Matthias Felleisen, > Douglas R. Hofstadter) I also used knowledge and an example from > Barendregt's book "The Lambda Calculus, ... " but I have not been able to > contact him. > Jos What a great contribution, Jos, thanks a lot! I am taking a Programming Languages class at the University of S?o Paulo and just last week we read chapter 22 "Shrinking the Language" of Shriram Krishnamurthi's Programming Languages: Application and Interpretation (PLAI) [1], in which he "shrinks" Scheme to the essentials of the Lambda Calculus. http://www.cs.brown.edu/~sk/Publications/Books/ProgLangs/ I generated a PDF version of the text. The links to your site and and the internal links are working (only the links to the local files do not work). I used OpenOffice to do the conversion. I took the liberty of putting the .doc, .pdf and .odt, and all your source code in a public repository on GitHub [2]. [2] http://github.com/ramalho/lc-with-redex/tree/master Full credit is given to you in the repository description and in a README.txt file. I also put links to your site [3] in the repository home page and in the README.txt. [3] http://telefonica.net/web2/koot/ Thank your very much for that contribution, Jos! Cheers, Luciano PS. I also agree that turning the text in to a scribble like Emre is doing is the best way to publish your work for use by the DrScheme community. From jay.mccarthy at gmail.com Mon Jun 8 19:07:04 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Mon Jun 8 19:07:26 2009 Subject: [plt-scheme] Re: ANN: Fra - Functional Relational Algebra In-Reply-To: References: Message-ID: I've updated this package with proper documentation. Package info: http://planet.plt-scheme.org/display.ss?package=fra.plt&owner=jaymccarthy Documentation: http://planet.plt-scheme.org/package-source/jaymccarthy/fra.plt/2/0/planet-docs/fra/index.html Jay On Tue, Jun 2, 2009 at 2:47 PM, Jay McCarthy wrote: > I've just released a package on PLaneT: fra.plt > > http://planet.plt-scheme.org/display.ss?package=fra.plt&owner=jaymccarthy > > Fra is an implementation of the relational algebra with a database & > query optimizer. > > I don't have proper documentation yet, but if you'd like to see what > the code looks like, check out the test suite: > > http://planet.plt-scheme.org/package-source/jaymccarthy/fra.plt/1/0/test.ss > > High Points: > - Query optimizer (currently not the best, but it is cool to see what it does) > > - Full relational algebra support (unlike SQL, I've stayed close to > the mathematical definition) > > - Full Scheme value support (relations can contain any Scheme values) > > - Full Scheme support for propositions (propositions are lambdas with > attributes as arguments) > > -- > > Why FRA? > > One acronym: FR-RA > > -- > Jay McCarthy > Assistant Professor / Brigham Young University > http://teammccarthy.org/jay > > "The glory of God is Intelligence" - D&C 93 > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From jos.koot at telefonica.net Tue Jun 9 01:05:07 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Tue Jun 9 01:05:30 2009 Subject: [plt-scheme] lc-with-redex References: <55A4707F131D4A6885848EC16D04BBEE@uw2b2dff239c4d> <377CC605-0071-4991-B524-BD7AE6D728C4@fellowhuman.com> <88574B358B3647C49CD05DE46533500A@uw2b2dff239c4d> <4331ad810906081559n1f89871dsbfa512c086527a3c@mail.gmail.com> Message-ID: <7F145E5407C94343BC45A9B5B86B0E22@uw2b2dff239c4d> Hi Luciano, Looks great, Thanks, Jos. ----- Original Message ----- From: "Luciano Ramalho" To: "Jos Koot" Cc: Sent: Tuesday, June 09, 2009 12:59 AM Subject: Re: [plt-scheme] lc-with-redex On Mon, Jun 8, 2009 at 5:29 AM, Jos Koot wrote: > Thanks for the conversions. I am overwhelmed by your friendly responses. I > have downloaded CutePDF. Did not know there was a free converter. The > converted pdf files do not recognize links links within the document nor to > local files, but I'll find a way to circumvent that (I probably should write > out the full urls) > Anyway there is now a pdf version at > http://telefonica.net/web2/koot/lc-with-redex.pdf > A version with correct hyperlinks is to come today or tomorrow. > Thanks to all of you, and of course thanks to the authors who permitted me > to steel and modify their material (Daniel P. Friedman, Matthias Felleisen, > Douglas R. Hofstadter) I also used knowledge and an example from > Barendregt's book "The Lambda Calculus, ... " but I have not been able to > contact him. > Jos What a great contribution, Jos, thanks a lot! I am taking a Programming Languages class at the University of S?o Paulo and just last week we read chapter 22 "Shrinking the Language" of Shriram Krishnamurthi's Programming Languages: Application and Interpretation (PLAI) [1], in which he "shrinks" Scheme to the essentials of the Lambda Calculus. http://www.cs.brown.edu/~sk/Publications/Books/ProgLangs/ I generated a PDF version of the text. The links to your site and and the internal links are working (only the links to the local files do not work). I used OpenOffice to do the conversion. I took the liberty of putting the .doc, .pdf and .odt, and all your source code in a public repository on GitHub [2]. [2] http://github.com/ramalho/lc-with-redex/tree/master Full credit is given to you in the repository description and in a README.txt file. I also put links to your site [3] in the repository home page and in the README.txt. [3] http://telefonica.net/web2/koot/ Thank your very much for that contribution, Jos! Cheers, Luciano PS. I also agree that turning the text in to a scribble like Emre is doing is the best way to publish your work for use by the DrScheme community. From jos.koot at telefonica.net Tue Jun 9 01:12:44 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Tue Jun 9 01:13:05 2009 Subject: Fw: [plt-scheme] lc-with-redex Message-ID: <5ED1F087717940028567915E0548A699@uw2b2dff239c4d> That's great, Many thanks, Jos > ----- Original Message ----- > I started converting it to scribble for easier publication online etc... > Is it OK for everybody? > > From power.real at gmail.com Tue Jun 9 08:12:10 2009 From: power.real at gmail.com (=?KOI8-R?B?88XSx8XKIOzJzM8=?=) Date: Tue Jun 9 08:12:29 2009 Subject: [plt-scheme] mysql tutor Message-ID: <715bde180906090512q1e59ac8au46455ad7364b45ee@mail.gmail.com> Hi all! Is enywhere an tutorial how can to use mysql database with plt scheme? From reb at cs.bilgi.edu.tr Mon Jun 8 13:48:11 2009 From: reb at cs.bilgi.edu.tr (=?utf-8?Q?R=2E_Emre_Ba=C5=9Far?=) Date: Tue Jun 9 09:03:16 2009 Subject: [plt-scheme] lc-with-redex In-Reply-To: <88574B358B3647C49CD05DE46533500A@uw2b2dff239c4d> References: <55A4707F131D4A6885848EC16D04BBEE@uw2b2dff239c4d> <377CC605-0071-4991-B524-BD7AE6D728C4@fellowhuman.com> <88574B358B3647C49CD05DE46533500A@uw2b2dff239c4d> Message-ID: <20090608174810.GD10838@terra.galaxy> I started converting it to scribble for easier publication online etc... Is it OK for everybody? Jos Koot der ki: > Thanks for the conversions. I am overwhelmed by your friendly responses. > I have downloaded CutePDF. Did not know there was a free converter. The > converted pdf files do not recognize links links within the document nor > to local files, but I'll find a way to circumvent that (I probably should > write out the full urls) > Anyway there is now a pdf version at http://telefonica.net/web2/koot/lc-with-redex.pdf > A version with correct hyperlinks is to come today or tomorrow. > Thanks to all of you, and of course thanks to the authors who permitted > me to steel and modify their material (Daniel P. Friedman, Matthias > Felleisen, Douglas R. Hofstadter) I also used knowledge and an example > from Barendregt's book "The Lambda Calculus, ... " but I have not been > able to contact him. > Jos > > ----- Original Message ----- From: "Jordan Johnson" > To: "Jos Koot" > Sent: Monday, June 08, 2009 3:17 AM > Subject: Re: [plt-scheme] lc-with-redex > > >> Jos-- >> >> Here you go...and FYI, in addition to OpenOffice (which may be your >> best bet for doing the conversion yourself), if you have access to a >> Mac or know anyone who does, at this point OS X provides conversion to >> PDF for any program that can print. >> >> Thanks for making this document -- a nice review of the LC! >> >> Best, >> jmj >> >> > > > -------------------------------------------------------------------------------- > > >> >> >> >> On Jun 7, 2009, at 1:55 PM, Jos Koot wrote: >> >>> Someone wrote me off list: "Very cool. I think it would be great as >>> a PDF or Scribble document." >>> >>> My answer: >>> >>> "Thanks for your nice reaction. You are right, of course. However, I >>> do not have tools on my PC to convert msword doc files to pdf. >>> As a scribbler I am a terrible know/can-nothing. May be someone is >>> willing to do the conversion to pdf for me. In that case please >>> use the most recent version in http://telefonica.net/web2/koot/lc-with-redex.zip >>> . I am retired, which means that I have to pay >>> myself for all resources. I am not poor, but neither rich." >>> >>> How great that PLT-Scheme is for free!!! >>> >>> Jos >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme -- R. Emre Ba?ar ?stanbul Bilgi University Department of Computer Science -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090608/e872173f/attachment.pgp From eli at barzilay.org Tue Jun 9 09:27:09 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Jun 9 09:27:30 2009 Subject: [plt-scheme] lc-with-redex In-Reply-To: <88574B358B3647C49CD05DE46533500A@uw2b2dff239c4d> References: <55A4707F131D4A6885848EC16D04BBEE@uw2b2dff239c4d> <377CC605-0071-4991-B524-BD7AE6D728C4@fellowhuman.com> <88574B358B3647C49CD05DE46533500A@uw2b2dff239c4d> Message-ID: <18990.25389.472979.858235@winooski.ccs.neu.edu> On Jun 8, Jos Koot wrote: > Thanks for the conversions. I am overwhelmed by your friendly > responses. I have downloaded CutePDF. Did not know there was a free > converter. The converted pdf files do not recognize links links > within the document nor to local files, but I'll find a way to > circumvent that (I probably should write out the full urls) Anyway > there is now a pdf version at > http://telefonica.net/web2/koot/lc-with-redex.pdf A version with > correct hyperlinks is to come today or tomorrow. [...] I had a look at the recently generated PDF, and it had some issues with fonts and line wrapping. Getting a PDF from Word is easy with the right MS plugin (IIRC, it's the one at http://office.microsoft.com/en-us/word/HA101675271033.aspx), so I did it and put the result at http://tmp.barzilay.org/LC-with-Redex/LC-with-Redex.pdf The rest of your files are there too, mainly to see that the relative links work fine. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From keiko at kurims.kyoto-u.ac.jp Tue Jun 9 10:21:13 2009 From: keiko at kurims.kyoto-u.ac.jp (Keiko Nakata) Date: Tue Jun 9 10:21:35 2009 Subject: [plt-scheme] programs using units Message-ID: <20090609.232113.63228857.keiko@kurims.kyoto-u.ac.jp> Hello, Could someone please refer me to programs which intensively use units? I am generally interested in how/where units are useful, as well as I want to debug my lazy units. Best, Keiko From noelwelsh at gmail.com Tue Jun 9 10:50:48 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Tue Jun 9 10:51:07 2009 Subject: [plt-scheme] programs using units In-Reply-To: <20090609.232113.63228857.keiko@kurims.kyoto-u.ac.jp> References: <20090609.232113.63228857.keiko@kurims.kyoto-u.ac.jp> Message-ID: I can send you a big pile of code (about 5K lines) but it has external dependencies you'll have to install yourself (namely: Gnu Scientfic Library, bindings to same, and a couple other libraries I've written but not yet released). It's numeric/scientific code. N. On Tue, Jun 9, 2009 at 3:21 PM, Keiko Nakata wrote: > Hello, > > Could someone please refer me to programs which intensively use units? > > I am generally interested in how/where units are useful, > as well as I want to debug my lazy units. > > Best, > Keiko From keiko at kurims.kyoto-u.ac.jp Tue Jun 9 10:55:12 2009 From: keiko at kurims.kyoto-u.ac.jp (Keiko Nakata) Date: Tue Jun 9 10:55:37 2009 Subject: [plt-scheme] programs using units In-Reply-To: References: <20090609.232113.63228857.keiko@kurims.kyoto-u.ac.jp> Message-ID: <20090609.235512.45265133.keiko@kurims.kyoto-u.ac.jp> From: Noel Welsh > I can send you a big pile of code (about 5K lines) but it has external > dependencies you'll have to install yourself (namely: Gnu Scientfic > Library, bindings to same, and a couple other libraries I've written > but not yet released). That sounds quite interesting. Will you please? Best, Keiko From noelwelsh at gmail.com Tue Jun 9 11:04:10 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Tue Jun 9 11:04:32 2009 Subject: [plt-scheme] programs using units In-Reply-To: References: <20090609.232113.63228857.keiko@kurims.kyoto-u.ac.jp> <20090609.235512.45265133.keiko@kurims.kyoto-u.ac.jp> Message-ID: Oops! Sorry for the spam -- I meant to reply directly to Keiko! N. On Tue, Jun 9, 2009 at 4:03 PM, Noel Welsh wrote: > itm is the main code (itm = infinite toplogical map). See the code in > the experiments directory to run it, or look at the tests. > > numeric is misc numeric code. Install a planet link to schematics > numeric.plt 1 0 ?You might be amused by my hacked up implementation of > compile-time units in unet.ss > > You'll also need levmar and mzgsl from http://github.com/noelwelsh/ > which should have planet links as well. > > N. From sk at cs.brown.edu Tue Jun 9 11:32:33 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Tue Jun 9 11:33:11 2009 Subject: [plt-scheme] Another Scheme book! Message-ID: http://www.linusbooks.com/compscience.html From ramalho at gmail.com Tue Jun 9 11:51:35 2009 From: ramalho at gmail.com (Luciano Ramalho) Date: Tue Jun 9 11:59:22 2009 Subject: [plt-scheme] Another Scheme book! In-Reply-To: References: Message-ID: <4331ad810906090851y4f87193dm82ee402abef15521@mail.gmail.com> On Tue, Jun 9, 2009 at 12:32 PM, Shriram Krishnamurthi wrote: > http://www.linusbooks.com/compscience.html Thanks for that link, Shriram. I found this other page describing the idea behind the book: http://elvis.rowan.edu/~nlt/sbr_scheme.html BTW, I don't know if you are aware of this excellent book, available only in Portuguese, however: Programa??o em Scheme: introdu??o ? programa??o utilizando m?ltiplos paradigmas (Programming in Scheme: an introduction to programming using multiple paradigms) by: Jo?o Pav?o Martins & Maria dos Rem?dios Cravo http://istpress.ist.utl.pt/lscheme.htm Cheers, Luciano From noelwelsh at gmail.com Tue Jun 9 12:09:01 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Tue Jun 9 12:09:20 2009 Subject: [plt-scheme] Matching typed structs in untyped code Message-ID: It would be nice if I could pattern match in untyped code on structures defined in Typed Scheme code. Presently I get: match: Dot does not refer to a structure definition in: Dot Using Typed Scheme for a couple of days has made me revert to my ML days, and now I'm pattern matching everywhere. Oh, and the untyped code is using classes, which I believe aren't yet supported by Typed Scheme so I can't just rewrite it. [I know there is a class form in Typed Scheme but it ain't documented. I'm using MrEd. I suppose if I could extend the existing bindings to MrEd to cover what I need. That does sound tedious...] N. From matthias at ccs.neu.edu Tue Jun 9 12:15:44 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Tue Jun 9 12:16:31 2009 Subject: [plt-scheme] Matching typed structs in untyped code In-Reply-To: References: Message-ID: <377FE7DE-F9D1-4465-96A5-A7273B189863@ccs.neu.edu> The philosophy behind Typed Scheme is "no matching required, needed, in demand". Code as you always have. -- Matthias On Jun 9, 2009, at 12:09 PM, Noel Welsh wrote: > It would be nice if I could pattern match in untyped code on > structures defined in Typed Scheme code. Presently I get: > > match: Dot does not refer to a structure definition in: Dot > > Using Typed Scheme for a couple of days has made me revert to my ML > days, and now I'm pattern matching everywhere. Oh, and the untyped > code is using classes, which I believe aren't yet supported by Typed > Scheme so I can't just rewrite it. > > [I know there is a class form in Typed Scheme but it ain't documented. > I'm using MrEd. I suppose if I could extend the existing bindings to > MrEd to cover what I need. That does sound tedious...] > > N. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From samth at ccs.neu.edu Tue Jun 9 12:18:28 2009 From: samth at ccs.neu.edu (Sam TH) Date: Tue Jun 9 12:18:47 2009 Subject: [plt-scheme] Matching typed structs in untyped code In-Reply-To: References: Message-ID: <63bb19ae0906090918t2d1a7a90s3f2138ae273af366@mail.gmail.com> On Tue, Jun 9, 2009 at 12:09 PM, Noel Welsh wrote: > It would be nice if I could pattern match in untyped code on > structures defined in Typed Scheme code. Presently I get: > > ?match: Dot does not refer to a structure definition in: Dot Unfortunately, there's not really a way for Typed Scheme to make this work in general. The static information that match uses contains references to the unprotected versions of the structure functions, so it can't be allowed to be used from untyped code. It's possible that I could create a struct-info-specific workaround for this, but that seems kind of ugly. The other possibility is to create your own static struct info. For example: #lang scheme/load (module m typed-scheme (define-struct: x ([y : Number])) (define z (make-x 1)) (provide (all-defined-out))) (module n scheme (require (except-in 'm x)) (define-struct x (y) #:omit-define-values) (match z [(struct x (a)) a])) (require 'n) -- sam th samth@ccs.neu.edu From noelwelsh at gmail.com Tue Jun 9 12:19:16 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Tue Jun 9 12:19:35 2009 Subject: [plt-scheme] Matching typed structs in untyped code In-Reply-To: <377FE7DE-F9D1-4465-96A5-A7273B189863@ccs.neu.edu> References: <377FE7DE-F9D1-4465-96A5-A7273B189863@ccs.neu.edu> Message-ID: On Tue, Jun 9, 2009 at 5:15 PM, Matthias Felleisen wrote: > > The philosophy behind Typed Scheme is "no matching required, needed, in > demand". Code as you always have. -- Matthias I don't quite follow that. In this case pattern matching is very compact and I would probably use pattern matching even if I wasn't using Typed Scheme. This is the code: (define (draw-mark dc mk) (match mk [(struct Dot (x y)) (send dc draw-point x y)] [(struct Circle (x y r)) (send dc draw-ellipse (- x r) (- y r) r r)] [(struct Box (l t w h)) (send dc draw-rectangle l t w h)] [(struct Overlay mks) (for-each (lambda (mk) (draw-mark dc mk)) mks)])) N. From noelwelsh at gmail.com Tue Jun 9 12:20:36 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Tue Jun 9 12:20:55 2009 Subject: [plt-scheme] Matching typed structs in untyped code In-Reply-To: <63bb19ae0906090918t2d1a7a90s3f2138ae273af366@mail.gmail.com> References: <63bb19ae0906090918t2d1a7a90s3f2138ae273af366@mail.gmail.com> Message-ID: Hey. I'll have a hack at extending the MrEd bindings first. N. On Tue, Jun 9, 2009 at 5:18 PM, Sam TH wrote: ... > The other possibility is to create your own static struct info. ... From samth at ccs.neu.edu Tue Jun 9 12:19:36 2009 From: samth at ccs.neu.edu (Sam TH) Date: Tue Jun 9 12:26:34 2009 Subject: [plt-scheme] Matching typed structs in untyped code In-Reply-To: <377FE7DE-F9D1-4465-96A5-A7273B189863@ccs.neu.edu> References: <377FE7DE-F9D1-4465-96A5-A7273B189863@ccs.neu.edu> Message-ID: <63bb19ae0906090919s1e513d22i5e3d60b7f4e95bd8@mail.gmail.com> On Tue, Jun 9, 2009 at 12:15 PM, Matthias Felleisen wrote: > > The philosophy behind Typed Scheme is "no matching required, needed, in > demand". Code as you always have. -- Matthias That's not to say that I don't encourage use of match, both for typed and for untyped code. But it shouldn't be required for Typed Scheme any more than for any other flavor of Scheme. -- sam th samth@ccs.neu.edu From eli at barzilay.org Tue Jun 9 12:35:58 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Jun 9 12:36:19 2009 Subject: [plt-scheme] Matching typed structs in untyped code In-Reply-To: <63bb19ae0906090919s1e513d22i5e3d60b7f4e95bd8@mail.gmail.com> References: <377FE7DE-F9D1-4465-96A5-A7273B189863@ccs.neu.edu> <63bb19ae0906090919s1e513d22i5e3d60b7f4e95bd8@mail.gmail.com> Message-ID: <18990.36718.753343.627226@winooski.ccs.neu.edu> On Jun 9, Sam TH wrote: > On Tue, Jun 9, 2009 at 12:15 PM, Matthias Felleisen wrote: > > > > The philosophy behind Typed Scheme is "no matching required, > > needed, in demand". Code as you always have. -- Matthias > > That's not to say that I don't encourage use of match, both for > typed and for untyped code. But it shouldn't be required for Typed > Scheme any more than for any other flavor of Scheme. The implicit need in Noel's example is `define-type' -- that *is* something that is useful without TS, but even more if you get the ML advantages that I have in my class code (error when a case is missing, or is unreachable). -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From jos.koot at telefonica.net Tue Jun 9 12:52:55 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Tue Jun 9 12:53:18 2009 Subject: [plt-scheme] INVITATION FLIBUG Message-ID: Hi I am sorry to announce that the first FLIBUG (was FLIB) meeting has been postponed to June 17. At this moment the group has around 8 members. Adapated invitation below. Jos Koot INVITATION FLIBUG (Fringe/Functional Languages In Barcelona User Group) has postponed its first meeting to June 17. Everyone who is interested is invited to share us. June 17 2009 at 7.30 PM Calle del Pi 3 Principal Interior (first floor) Barcelona Spain Preliminary program Welcome. Short discussion about what FLIBUG should be and should not be. Jose: communication about FUEL (Factors Ultimate Emacs Library) Jos : 5 minute click talk on his recent experiences with PLT's redex library. You: 5 minut click talk. Many more of you: 5 minut click talks. Informal meeting in the conference room or in a bar or simple restaurant within walking distance. The preferred language is English, but click talks can also be in Castiliano (Spanish) or in Catala. If you intend to come, let us know by email, please, in order that we can estimate the number of participants. If you intend to do a click talk, please let us know too. Please forward this invitation to relevant mailing lists we may have missed. Hope to meet you on June the tenth. Jos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090609/8a199cf8/attachment.htm From jos.koot at telefonica.net Tue Jun 9 13:55:47 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Tue Jun 9 13:56:16 2009 Subject: [plt-scheme] lc-with-redex References: <55A4707F131D4A6885848EC16D04BBEE@uw2b2dff239c4d><377CC605-0071-4991-B524-BD7AE6D728C4@fellowhuman.com><88574B358B3647C49CD05DE46533500A@uw2b2dff239c4d> <18990.25389.472979.858235@winooski.ccs.neu.edu> Message-ID: <4B793194A1DF49FDB7E612CA97545C21@uw2b2dff239c4d> Hi Eli, Thanks very much for the help. Most links work. I did check most of them. The links to miu-puzzle.ss and miu-traces.ss are not found, but that probably is be a mismatch between upper and lower case. The .doc file contained lnks to MIU-puzzle.ss and MIU-traces.ss, but the filenames are in lowercase. I have changed the links to lower case in the .doc file and uploaded it to to the zipfile. http://telefonica.net/web2/koot/lc-with-redex.zip. I tried to install the plugin, but it does work for office-2003 (as is indicated on the download page the plugin applies to 2007 applications) Thanks very much again, Jos ----- Original Message ----- From: "Eli Barzilay" To: "Jos Koot" Cc: Sent: Tuesday, June 09, 2009 3:27 PM Subject: Re: [plt-scheme] lc-with-redex > On Jun 8, Jos Koot wrote: >> Thanks for the conversions. I am overwhelmed by your friendly >> responses. I have downloaded CutePDF. Did not know there was a free >> converter. The converted pdf files do not recognize links links >> within the document nor to local files, but I'll find a way to >> circumvent that (I probably should write out the full urls) Anyway >> there is now a pdf version at >> http://telefonica.net/web2/koot/lc-with-redex.pdf A version with >> correct hyperlinks is to come today or tomorrow. [...] > > I had a look at the recently generated PDF, and it had some issues > with fonts and line wrapping. Getting a PDF from Word is easy with > the right MS plugin (IIRC, it's the one at > http://office.microsoft.com/en-us/word/HA101675271033.aspx), so I did > it and put the result at > > http://tmp.barzilay.org/LC-with-Redex/LC-with-Redex.pdf > > The rest of your files are there too, mainly to see that the relative > links work fine. > > -- > ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: > http://www.barzilay.org/ Maze is Life! > From toddobryan at gmail.com Tue Jun 9 14:59:15 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Tue Jun 9 14:59:33 2009 Subject: [plt-scheme] instanceof equivalent in Typed Scheme? Message-ID: <904774730906091159p77a13d23m7717e9c6c6482eb0@mail.gmail.com> Is there a way to check whether something is of a particular type? I know you can define a type-predicate with: (: Type? : Any -> Boolean : Type) but I assume if you define that incorrectly bad things will happen. Todd From matthias at ccs.neu.edu Tue Jun 9 15:04:07 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Tue Jun 9 15:04:52 2009 Subject: [plt-scheme] instanceof equivalent in Typed Scheme? In-Reply-To: <904774730906091159p77a13d23m7717e9c6c6482eb0@mail.gmail.com> References: <904774730906091159p77a13d23m7717e9c6c6482eb0@mail.gmail.com> Message-ID: <5512CB4D-A394-4CCE-97E9-EB9F8A010532@ccs.neu.edu> It is impossible to check whether a function is of type (Integer -> Integer) or (X -> Void). -- Matthias On Jun 9, 2009, at 2:59 PM, Todd O'Bryan wrote: > Is there a way to check whether something is of a particular type? > > I know you can define a type-predicate with: > > (: Type? : Any -> Boolean : Type) > > but I assume if you define that incorrectly bad things will happen. > > Todd > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From samth at ccs.neu.edu Tue Jun 9 15:29:47 2009 From: samth at ccs.neu.edu (Sam TH) Date: Tue Jun 9 15:30:06 2009 Subject: [plt-scheme] instanceof equivalent in Typed Scheme? In-Reply-To: <904774730906091159p77a13d23m7717e9c6c6482eb0@mail.gmail.com> References: <904774730906091159p77a13d23m7717e9c6c6482eb0@mail.gmail.com> Message-ID: <63bb19ae0906091229t6dabd39cmf941170768da4813@mail.gmail.com> On Tue, Jun 9, 2009 at 2:59 PM, Todd O'Bryan wrote: > Is there a way to check whether something is of a particular type? First-order values such as numbers come with predicates built-in, such as `number?'. Structs define their own predicate. For more complicated types, you can write functions with types like this: > (: Type? : Any -> Boolean : Type) for some types, but not all types, both because some such predicates are not computable, as Matthias points out, and some cannot be verified by Typed Scheme. There isn't a general mechanism for defining such predicates. -- sam th samth@ccs.neu.edu From pocmatos at gmail.com Tue Jun 9 15:48:17 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Jun 9 15:48:58 2009 Subject: [plt-scheme] Another Scheme book! In-Reply-To: <4331ad810906090851y4f87193dm82ee402abef15521@mail.gmail.com> References: <4331ad810906090851y4f87193dm82ee402abef15521@mail.gmail.com> Message-ID: <11b141710906091248x3d4fbe1es48e9bb94b12ac4e@mail.gmail.com> On Tue, Jun 9, 2009 at 4:51 PM, Luciano Ramalho wrote: > Programa??o em Scheme: ?introdu??o ? programa??o utilizando m?ltiplos > paradigmas > > (Programming in Scheme: an introduction to programming using multiple paradigms) > > by: Jo?o Pav?o Martins & Maria dos Rem?dios Cravo > > http://istpress.ist.utl.pt/lscheme.htm > This book was being written by my lecturers (the authors of the book) when I was studying scheme for the first time in 'Introduction to Programming'. The recommended book was SICP and the lecture notes were drafts of the book. Some years later, I taught the same subject using this book [which was for the obvious reasons recommended instead of SICP] This is a good book, yes [for those understanding Portuguese] but I would only recommend it to those that either have trouble with English or for very young portuguese students (maybe highschool level). It is in my opinion just an expanded [trying to be clearer in places, with more exercises of different levels of difficulty] version of the first few chapters of SICP written in Portuguese. Cheers, Paulo Matos > Cheers, > > Luciano > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From noelwelsh at gmail.com Tue Jun 9 16:06:45 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Tue Jun 9 16:07:06 2009 Subject: [plt-scheme] Matching typed structs in untyped code In-Reply-To: References: <63bb19ae0906090918t2d1a7a90s3f2138ae273af366@mail.gmail.com> Message-ID: On Tue, Jun 9, 2009 at 5:20 PM, Noel Welsh wrote: > Hey. I'll have a hack at extending the MrEd bindings first. And this is how I managed to crash DrScheme. Heh. So back to the ugly hack. (I would have thought you could wrap the struct-info value with contracted function.) N. From jos.koot at telefonica.net Wed Jun 10 02:02:02 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Wed Jun 10 02:02:30 2009 Subject: [plt-scheme] lc-with-redex Message-ID: <2261EC9AE0FE4BF09890DACFD16F0EE3@uw2b2dff239c4d> Lc-with-redex is now available with pdf and correct hyperlinks. http://www.telefonica.net/web2/koot/ or http://www.telefonica.net/web2/koot/lc-with-redex.zip With thanks for all your help. With special thanks to Eli Barzilay. This thread has grown long. For remarks, questions etc. you are free to contact me off list. Jos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090610/e36c058e/attachment.html From ecl at pckswarms.ch Wed Jun 10 05:45:27 2009 From: ecl at pckswarms.ch (Bruce O'Neel) Date: Wed Jun 10 05:46:00 2009 Subject: [plt-scheme] libGL.so In-Reply-To: <18979.56403.860304.291069@winooski.ccs.neu.edu> References: <904774730906010618l3ed7b1ffk1bcb08424e49621e@mail.gmail.com> <18979.56403.860304.291069@winooski.ccs.neu.edu> Message-ID: <20090610094527.GA10694@gnosca.pckswarms.ch> Hi, In the debian world the libBLAH.so sym link is done for you if you install the -dev package. In my case (on debian) I've installed libgl1-mesa-dev but that's because I use mesa and no OpenGL accleration. Good luck! cheers bruce On Mon, Jun 01, 2009 at 09:49:07AM -0400, Eli Barzilay wrote: > On Jun 1, Todd O'Bryan wrote: > > I'm trying to play Gobblet on Ubuntu using the Debian 4.1.5 package, > > but I get an error saying that libGL.so is not available. I have > > libGLU.so, but if I try to install the package that provides libGL, > > it gets rid of some of the other packages (including > > ubuntu-desktop). > > > > Can someone with more Linux-fu than I explain the way out of this > > conundrum? > > Do you have any other libGL.so library? -- try > > ls /usr/lib/libGL.so* > > and if you see one, then you can just create a symlink to the > version-less name, for example: > > cd /usr/lib > ln -s libGL.so.1 libGL.so > > (In 4.2 the sgl library will look for that version too, so this won't > be needed.) > > -- > ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: > http://www.barzilay.org/ Maze is Life! > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From ramalho at gmail.com Wed Jun 10 05:46:15 2009 From: ramalho at gmail.com (Luciano Ramalho) Date: Wed Jun 10 05:46:49 2009 Subject: [plt-scheme] lc-with-redex In-Reply-To: <2261EC9AE0FE4BF09890DACFD16F0EE3@uw2b2dff239c4d> References: <2261EC9AE0FE4BF09890DACFD16F0EE3@uw2b2dff239c4d> Message-ID: <4331ad810906100246o390262e3ncd133c16852c8ee0@mail.gmail.com> On Wed, Jun 10, 2009 at 3:02 AM, Jos Koot wrote: > Lc-with-redex is now available?with pdf and correct hyperlinks. > http://www.telefonica.net/web2/koot/ > or > http://www.telefonica.net/web2/koot/lc-with-redex.zip > With thanks for all your help. > With special thanks to Eli Barzilay. Great! I have updated the git repository [1] with the contents of the new .zip file produced by Jos. [1] http://github.com/ramalho/lc-with-redex/tree/master Cheers, Luciano From Damir.Cavar at gmail.com Wed Jun 10 12:55:53 2009 From: Damir.Cavar at gmail.com (Damir Cavar) Date: Wed Jun 10 12:56:14 2009 Subject: [plt-scheme] Re: Natural Language parsing in CS1 In-Reply-To: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> References: <904774730906010614o27ea91a2oe8f0a183d21ff364@mail.gmail.com> Message-ID: <363b9697-93de-4d0a-9fb1-ec81693867f1@g20g2000vba.googlegroups.com> Some simple implementation of a chart parser (Early-type of parser with agenda etc.) can be found on the Schemers page at the University of Zadar: http://ling.unizd.hr/~schemers/ in the code section. This is just CFG-based, without Unification. I have a first version of a graphical tree drawing tool that visualizes s-structures (results of parses on the chart) as nice graphical trees (as e.g. in XLE), using the PLT Scheme GUI toolkit only. I'll post this in some days (once the coordinates for drawing such trees get fixed so that they are nice looking and well- balanced :-) ). We extend the chart parser right now with a Unification formalism for grammars of the LFG or HPSG type. So, if somebody wants to participate, we can share the code-base via svn. This is definitely not just a toy, one can seriously generate very good parse trees, and even handle unknowns and partial parses easily for all kinds of text types and constructions, even for Croatian. :-) As far as parsing is concerned, and the question of scaling, and "such symbolic approaches", don't get confused there. Such grammars and approaches do scale, as XLE and the broad coverage LFG grammars show, but also some HPSG grammars and parsers. Statistical methods can be integrated easily, but purely statistical methods without real grammars is not what I'd put my trust in (as a syntactician), at least if we are talking about serious syntax parsing and not shallow dependency trees (and I don't even see a real use for my syntax approach in those kinds of models) etc. It would be good to have some code and tools in Scheme for that. We're trying to get things together, and I was actually already planing to set up some (code) site for something like the Scheme NLTK (see Python NLTK). I might fire this page up soon. Help is welcome! Damir From mmrasheed at gmail.com Wed Jun 10 06:53:51 2009 From: mmrasheed at gmail.com (Captain___nemo) Date: Wed Jun 10 13:50:16 2009 Subject: [plt-scheme] Draw and save coordinates on every mouse event on canvas? Message-ID: Hi, I am newbie in scheme, just started yesterday. So, please don't mind if I am overlooking anything simple. I want to draw circular points on every click on the drawing window (or canvas). Also I want to save the coordinates in an array. After every click a connecting line should be drawn (from last point) and so on. Now, I don't understand how I should put a canvas. As I can see in Dr.Scheme manual , it is recommended to use world.ss. But I don't understand how will I get the coordinates and save in an array? Also how that line can be drawn? Any suggestion is appreciated. Thanks in advance. From npt11tpn at googlemail.com Wed Jun 10 10:24:13 2009 From: npt11tpn at googlemail.com (N T) Date: Wed Jun 10 13:50:22 2009 Subject: [plt-scheme] Load and require in PLT Message-ID: Hi guys, I am trying to find an equivalent way to run the following test.scm script with mzscheme. I would like to to keep s as a variable, so that it could be passed as a command-line argument. (require "parameters.scm") works in mzscheme while (require s) does not. From what i gathered from reading the plt archives using units could be the way to do it ... Help will be very much appreciated! Nik csi test.scm ;; test.scm (define s "parameters.scm") (load s) (display x) ;; parameters.scm (define x 1) From grettke at acm.org Wed Jun 10 14:24:26 2009 From: grettke at acm.org (Grant Rettke) Date: Wed Jun 10 14:24:45 2009 Subject: [plt-scheme] Draw and save coordinates on every mouse event on canvas? In-Reply-To: References: Message-ID: <756daca50906101124l47e704bfh7a6cbecd2203e267@mail.gmail.com> On Wed, Jun 10, 2009 at 5:53 AM, Captain___nemo wrote: > Now, I don't understand how I should put a canvas. As I can see in > Dr.Scheme manual , it is recommended to use world.ss. ?But I don't > understand how will I get the coordinates and save in an array? Also > how that line can be drawn? You might define a structure to store coordinates, and keep them in a list, and then use scheme/gui language to gain access to functions for drawing on a canvas using a bitmap-dc% object. Or perhaps that is too low level if you are supposed to use world? From matthias at ccs.neu.edu Wed Jun 10 15:55:23 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Wed Jun 10 15:56:12 2009 Subject: [plt-scheme] Draw and save coordinates on every mouse event on canvas? In-Reply-To: References: Message-ID: <7A36E9D6-39B7-4D5E-AC1E-A4F9CFAB68CB@ccs.neu.edu> Here is a solution: #lang scheme (require 2htdp/universe) ;; World = [Listof (list Nat Nat)] (define mt (empty-scene 200 200)) (define col "red") (define DOT (circle 3 "solid" col)) (define (click w x y ke) (cond [(mouse=? "button-down" ke) (cons (list x y) w)] [else w])) (define (render w0) (local ((define (cnt w a) (foldl (lambda (f a) (list f (apply ln+ f a))) a w)) (define (dot s p) (place-image DOT (first p) (second p) s)) (define (ln+ p q s) (add-line s (first p) (second p) (first q) (second q) col)) (define dots (foldr (lambda (f r) (dot r f)) mt w0))) (cond [(empty? w0) mt] [else (second (cnt (rest w0) (list (first w0) (dot dots (first w0)))))]))) (big-bang '() (on-mouse click) (on-draw render)) But this solution will give you away in case this is homework. To prove that this isn't homework, you need to point us to the place where our manuals recommend using world.ss. -- Matthias On Jun 10, 2009, at 6:53 AM, Captain___nemo wrote: > Hi, > I am newbie in scheme, just started yesterday. So, please don't mind > if I am overlooking anything simple. > > I want to draw circular points on every click on the drawing window > (or canvas). Also I want to save the coordinates in an array. After > every click a connecting line should be drawn (from last point) and so > on. > > Now, I don't understand how I should put a canvas. As I can see in > Dr.Scheme manual , it is recommended to use world.ss. But I don't > understand how will I get the coordinates and save in an array? Also > how that line can be drawn? > > Any suggestion is appreciated. > > Thanks in advance. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From jos.koot at telefonica.net Wed Jun 10 16:06:44 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Wed Jun 10 16:07:19 2009 Subject: [plt-scheme] lc-with-redex update Message-ID: <51F36E700E564F2DB1DC2590FE95DC0F@uw2b2dff239c4d> A private comment of Eli Barzilay made me reconsider some points in my lc-with-redex. Changes: pdf and doc: Remark about easily making unbound variables self-evaluating within PLT Scheme removed. It is possible, but not as easy as I suggested. My oversimplified implementation had the danger of being very confusing. Removed: free-vars-in-scheme.ss. Adapted: one-point-basis.ss. No longer uses free-vars-in-scheme.ss nor eval. Uses lazy-evaluator.ss in stead. Adapted: lazy-evaluator.ss. Was necessary for one-point-basis.ss (added: ev-proc and def-proc) Main reason: Syntax test of one-point-basis.ss did not correctly handle all free variables. Now it does. I hope not to bother you again with new updates within so short time. Thanks to all of you who showed so kind interest. Remarks are welcome, of course, but as to avoid unnecessary burden on this list, may be off list is to be preferred. With special thanks to Eli Barzilay for his comment and for promptly converting doc to pdf again. Jos The updated version is available at http://www.telefonica.net/web2/koot/ or http://www.telefonica.net/web2/koot/lc-with-redex.zip -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090610/5d4e37b8/attachment.htm From ramalho at gmail.com Wed Jun 10 16:27:39 2009 From: ramalho at gmail.com (Luciano Ramalho) Date: Wed Jun 10 16:28:01 2009 Subject: [plt-scheme] lc-with-redex update In-Reply-To: <51F36E700E564F2DB1DC2590FE95DC0F@uw2b2dff239c4d> References: <51F36E700E564F2DB1DC2590FE95DC0F@uw2b2dff239c4d> Message-ID: <4331ad810906101327p30f136c5i46f139ca07ee6142@mail.gmail.com> On Wed, Jun 10, 2009 at 5:06 PM, Jos Koot wrote: > A private comment of Eli Barzilay made me reconsider some points in my > lc-with-redex. I've updated the repository accordingly [1]. [1] http://github.com/ramalho/lc-with-redex/tree/master Jos, an interesting feature of having the code in a repo is being able to check, using git diff, the changes you've made each time. I have not yet removed free-vars-in-scheme.ss, but I will. I assume I should also remove free-vars-in-scheme-aux.ss from the repository, right? Cheers, Luciano From adityashukla1983 at gmail.com Wed Jun 10 16:47:58 2009 From: adityashukla1983 at gmail.com (aditya shukla) Date: Wed Jun 10 16:48:19 2009 Subject: [plt-scheme] HTDPExercise 14.1.3 Message-ID: <73045cca0906101347t3d37ecb6x3b91b9b5384eb588@mail.gmail.com> I was solving this exercise from htdp , its been quite some days since i wrote a program in scheme .I am getting this error which i am not able to sort out .Can someone please help me with this. ;data definition (define-struct child (father mother name date eyes)) ;oldest generation (define Carl (make-child empty empty 'Carl 1926 'green)) (define Bettina (make-child empty empty 'Bettina 1926 'green)) ;; Middle Generation: (define Adam (make-child Carl Bettina 'Adam 1950 'yellow)) (define Dave (make-child Carl Bettina 'Dave 1955 'black)) (define Eva (make-child Carl Bettina 'Eva 1965 'blue)) (define Fred (make-child empty empty 'Fred 1966 'pink)) ;; Youngest Generation: (define Gustav (make-child Fred Eva 'Gustav 1988 'brown)) ;A family-tree-node (short: ftn) is either ; 1. ; empty; or ;2. ; (make-child f m na da ec) ; where f and m are ftns, na ;and ec are symbols, and da is a number. ;contract of count-persons ftn(family tree node) -> number ;Purpose :This function takes a family tree node and computes the number of persons in that node ;examples empty -> 0 ,carl ->1 , bettina -> 1 , adam , dave , eva -> 3 , fred->1 , gustav-> 5 ;template(define count-persons (lambda (ftn) (cond [(empty? ftn )][else (count-persons (child-father ftn)) (count-persons (child-mother ftn)) (child-name ftn) (child-date ftn) (child-eyes ftn)]))) (define (count-persons a-ftree) (cond [(empty? a-ftree) 0] [else ((symbol? (child-name a-ftree)) (+ 1 (count-persons(or (child? (child-father a-ftree) ) (child? (child-mother a-ftree) )))))])) (count-persons Fred) function call: expected a name after an open parenthesis, but found something else Thanks, Aditya -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090610/ff11c64a/attachment-0001.html From matthias at ccs.neu.edu Wed Jun 10 17:29:30 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Wed Jun 10 17:30:19 2009 Subject: [plt-scheme] HTDPExercise 14.1.3 In-Reply-To: <73045cca0906101347t3d37ecb6x3b91b9b5384eb588@mail.gmail.com> References: <73045cca0906101347t3d37ecb6x3b91b9b5384eb588@mail.gmail.com> Message-ID: <461E72D3-4FD7-4093-85C7-D1819D7AB792@ccs.neu.edu> ((symbol? ...) ...) ^^^^^^^^^^^^^ 1. (foo ...) means apply function foo to arguments. 2. ((symbol? ...) ...) is NOT the name of a function. And it's highlighted. So you don't mean to write this here. Follow the receipe. On Jun 10, 2009, at 4:47 PM, aditya shukla wrote: > I was solving this exercise from htdp , its been quite some days > since i wrote a program in scheme .I am getting this error which i > am not able to sort out .Can someone please help me with this. > > ;data definition > (define-struct child (father mother name date eyes)) > ;oldest generation > (define Carl (make-child empty empty 'Carl 1926 'green)) > (define Bettina (make-child empty empty 'Bettina 1926 'green)) > > ;; Middle Generation: > (define Adam (make-child Carl Bettina 'Adam 1950 'yellow)) > (define Dave (make-child Carl Bettina 'Dave 1955 'black)) > (define Eva (make-child Carl Bettina 'Eva 1965 'blue)) > (define Fred (make-child empty empty 'Fred 1966 'pink)) > > ;; Youngest Generation: > (define Gustav (make-child Fred Eva 'Gustav 1988 'brown)) > > > ;A family-tree-node (short: ftn) is either > > ; 1. > > ; empty; or > ;2. > > ; (make-child f m na da ec) > ; where f and m are ftns, na > ;and ec are symbols, and da is a number. > ;contract of count-persons ftn(family tree node) -> number > ;Purpose :This function takes a family tree node and computes the > number of persons in that node > ;examples empty -> 0 ,carl ->1 , bettina -> 1 , adam , dave , eva - > > 3 , fred->1 , gustav-> 5 > ;template(define count-persons (lambda (ftn) (cond [(empty? ftn )] > [else (count-persons (child-father ftn)) (count-persons (child- > mother ftn)) (child-name ftn) (child-date ftn) (child-eyes ftn)]))) > (define (count-persons a-ftree) > (cond > [(empty? a-ftree) 0] > [else ((symbol? (child-name a-ftree)) (+ 1 (count-persons(or > (child? (child-father a-ftree) ) (child? (child-mother a- > ftree) )))))])) > > (count-persons Fred) > > > > > function call: expected a name after an open parenthesis, but found > something else > > > Thanks, > Aditya > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From matthias at ccs.neu.edu Wed Jun 10 17:36:32 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Wed Jun 10 17:37:22 2009 Subject: [plt-scheme] Load and require in PLT In-Reply-To: References: Message-ID: <736557E5-029F-4FBE-872A-ED78FA7DEE06@ccs.neu.edu> I used this load trick in script that has minimally evolved since 1995 when I first wrote it. What's the problem? Looks fine. On Jun 10, 2009, at 10:24 AM, N T wrote: > Hi guys, > I am trying to find an equivalent way to run the following test.scm > script with mzscheme. > I would like to to keep s as a variable, so that it could be passed as > a command-line argument. > (require "parameters.scm") works in mzscheme while (require s) does > not. From what i gathered from reading the plt archives using units > could be the way to do it ... > Help will be very much appreciated! > Nik > > csi test.scm > > ;; test.scm > (define s "parameters.scm") > (load s) > (display x) > > > ;; parameters.scm > (define x 1) > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From eli at barzilay.org Wed Jun 10 17:50:01 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Jun 10 17:50:23 2009 Subject: [plt-scheme] Load and require in PLT In-Reply-To: <736557E5-029F-4FBE-872A-ED78FA7DEE06@ccs.neu.edu> References: <736557E5-029F-4FBE-872A-ED78FA7DEE06@ccs.neu.edu> Message-ID: <18992.10889.612543.583530@winooski.ccs.neu.edu> Looks like the problem might be due to using `mzscheme ' instead of `mzscheme -r '. (But a better solution is to dump the `load' stuff, and use modules.) On Jun 10, Matthias Felleisen wrote: > > I used this load trick in script that has minimally evolved since > 1995 when I first wrote it. What's the problem? Looks fine. > > > On Jun 10, 2009, at 10:24 AM, N T wrote: > > > Hi guys, > > I am trying to find an equivalent way to run the following test.scm > > script with mzscheme. > > I would like to to keep s as a variable, so that it could be passed as > > a command-line argument. > > (require "parameters.scm") works in mzscheme while (require s) does > > not. From what i gathered from reading the plt archives using units > > could be the way to do it ... > > Help will be very much appreciated! > > Nik > > > > csi test.scm > > > > ;; test.scm > > (define s "parameters.scm") > > (load s) > > (display x) > > > > > > ;; parameters.scm > > (define x 1) > > _________________________________________________ > > For list-related administrative tasks: > > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From mmrasheed at gmail.com Wed Jun 10 17:43:22 2009 From: mmrasheed at gmail.com (Captain___nemo) Date: Wed Jun 10 18:19:03 2009 Subject: [plt-scheme] Re: Draw and save coordinates on every mouse event on canvas? In-Reply-To: <7A36E9D6-39B7-4D5E-AC1E-A4F9CFAB68CB@ccs.neu.edu> References: <7A36E9D6-39B7-4D5E-AC1E-A4F9CFAB68CB@ccs.neu.edu> Message-ID: <0d886242-c20b-4534-859d-3e7ac7e03e44@g1g2000yqh.googlegroups.com> Thanks a lot Mr.Matthias. nop, I am not a student, have graduated several months (not year though) ago :). I am working on implementing Voronoi diagram. And may be I was thinking to learn this too fast (as I did for python). But I understand now that this language is not like Java or python. So, I have to learn the structure of this language rather than jumping here and there :) Regards. On Jun 11, 1:55?am, Matthias Felleisen wrote: > Here is a solution: > > #lang scheme > > (require 2htdp/universe) > > ;; World = [Listof (list Nat Nat)] > (define mt (empty-scene 200 200)) > (define col "red") > (define DOT (circle 3 "solid" col)) > > (define (click w x y ke) > ? ?(cond > ? ? ?[(mouse=? "button-down" ke) > ? ? ? (cons (list x y) w)] > ? ? ?[else w])) > > (define (render w0) > ? ?(local ((define (cnt w a) (foldl (lambda (f a) (list f (apply ln+ ? > f a))) a w)) > ? ? ? ? ? ?(define (dot s p) (place-image DOT (first p) (second p) s)) > ? ? ? ? ? ?(define (ln+ p q s) > ? ? ? ? ? ? ?(add-line s (first p) (second p) (first q) (second q) col)) > ? ? ? ? ? ?(define dots (foldr (lambda (f r) (dot r f)) mt w0))) > ? ? ?(cond > ? ? ? ?[(empty? w0) mt] > ? ? ? ?[else (second (cnt (rest w0) (list (first w0) (dot dots (first ? > w0)))))]))) > > (big-bang '() (on-mouse click) (on-draw render)) > > But this solution will give you away in case this is homework. To ? > prove that this isn't homework, you need to point us to the place ? > where our manuals recommend using world.ss. > > -- Matthias > > On Jun 10, 2009, at 6:53 AM, Captain___nemo wrote: > > > > > > > Hi, > > I am newbie in scheme, just started yesterday. So, please don't mind > > if I am overlooking anything simple. > > > I want to draw circular points on every click on the drawing window > > (or canvas). Also I want to save the coordinates in an array. After > > every click a connecting line should be drawn (from last point) and so > > on. > > > Now, I don't understand how I should put a canvas. As I can see in > > Dr.Scheme manual , it is recommended to use world.ss. ?But I don't > > understand how will I get the coordinates and save in an array? Also > > how that line can be drawn? > > > Any suggestion is appreciated. > > > Thanks in advance. > > _________________________________________________ > > ? For list-related administrative tasks: > > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From mmrasheed at gmail.com Wed Jun 10 17:50:46 2009 From: mmrasheed at gmail.com (Captain___nemo) Date: Wed Jun 10 18:19:11 2009 Subject: [plt-scheme] Re: Draw and save coordinates on every mouse event on canvas? In-Reply-To: <7A36E9D6-39B7-4D5E-AC1E-A4F9CFAB68CB@ccs.neu.edu> References: <7A36E9D6-39B7-4D5E-AC1E-A4F9CFAB68CB@ccs.neu.edu> Message-ID: oppss..I am sorry that I forgot to answer your question :( That warning is written in document of "draw.ss". regards. On Jun 11, 1:55?am, Matthias Felleisen wrote: > Here is a solution: > > #lang scheme > > (require 2htdp/universe) > > ;; World = [Listof (list Nat Nat)] > (define mt (empty-scene 200 200)) > (define col "red") > (define DOT (circle 3 "solid" col)) > > (define (click w x y ke) > ? ?(cond > ? ? ?[(mouse=? "button-down" ke) > ? ? ? (cons (list x y) w)] > ? ? ?[else w])) > > (define (render w0) > ? ?(local ((define (cnt w a) (foldl (lambda (f a) (list f (apply ln+ ? > f a))) a w)) > ? ? ? ? ? ?(define (dot s p) (place-image DOT (first p) (second p) s)) > ? ? ? ? ? ?(define (ln+ p q s) > ? ? ? ? ? ? ?(add-line s (first p) (second p) (first q) (second q) col)) > ? ? ? ? ? ?(define dots (foldr (lambda (f r) (dot r f)) mt w0))) > ? ? ?(cond > ? ? ? ?[(empty? w0) mt] > ? ? ? ?[else (second (cnt (rest w0) (list (first w0) (dot dots (first ? > w0)))))]))) > > (big-bang '() (on-mouse click) (on-draw render)) > > But this solution will give you away in case this is homework. To ? > prove that this isn't homework, you need to point us to the place ? > where our manuals recommend using world.ss. > > -- Matthias > > On Jun 10, 2009, at 6:53 AM, Captain___nemo wrote: > > > > > > > Hi, > > I am newbie in scheme, just started yesterday. So, please don't mind > > if I am overlooking anything simple. > > > I want to draw circular points on every click on the drawing window > > (or canvas). Also I want to save the coordinates in an array. After > > every click a connecting line should be drawn (from last point) and so > > on. > > > Now, I don't understand how I should put a canvas. As I can see in > > Dr.Scheme manual , it is recommended to use world.ss. ?But I don't > > understand how will I get the coordinates and save in an array? Also > > how that line can be drawn? > > > Any suggestion is appreciated. > > > Thanks in advance. > > _________________________________________________ > > ? For list-related administrative tasks: > > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From matthias at ccs.neu.edu Wed Jun 10 23:30:54 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Wed Jun 10 23:31:28 2009 Subject: [plt-scheme] Re: Draw and save coordinates on every mouse event on canvas? In-Reply-To: References: <7A36E9D6-39B7-4D5E-AC1E-A4F9CFAB68CB@ccs.neu.edu> Message-ID: <17FC3167-FD42-4579-AB43-558CE5E438EB@ccs.neu.edu> Okay. In world.ss you will soon find the note "use universe". On Jun 10, 2009, at 5:50 PM, Captain___nemo wrote: > > oppss..I am sorry that I forgot to answer your question :( That > warning is written in document of "draw.ss". > > regards. > > On Jun 11, 1:55 am, Matthias Felleisen wrote: >> Here is a solution: >> >> #lang scheme >> >> (require 2htdp/universe) >> >> ;; World = [Listof (list Nat Nat)] >> (define mt (empty-scene 200 200)) >> (define col "red") >> (define DOT (circle 3 "solid" col)) >> >> (define (click w x y ke) >> (cond >> [(mouse=? "button-down" ke) >> (cons (list x y) w)] >> [else w])) >> >> (define (render w0) >> (local ((define (cnt w a) (foldl (lambda (f a) (list f (apply ln+ >> f a))) a w)) >> (define (dot s p) (place-image DOT (first p) (second p) >> s)) >> (define (ln+ p q s) >> (add-line s (first p) (second p) (first q) (second q) >> col)) >> (define dots (foldr (lambda (f r) (dot r f)) mt w0))) >> (cond >> [(empty? w0) mt] >> [else (second (cnt (rest w0) (list (first w0) (dot dots (first >> w0)))))]))) >> >> (big-bang '() (on-mouse click) (on-draw render)) >> >> But this solution will give you away in case this is homework. To >> prove that this isn't homework, you need to point us to the place >> where our manuals recommend using world.ss. >> >> -- Matthias >> >> On Jun 10, 2009, at 6:53 AM, Captain___nemo wrote: >> >> >> >> >> >>> Hi, >>> I am newbie in scheme, just started yesterday. So, please don't mind >>> if I am overlooking anything simple. >> >>> I want to draw circular points on every click on the drawing window >>> (or canvas). Also I want to save the coordinates in an array. After >>> every click a connecting line should be drawn (from last point) >>> and so >>> on. >> >>> Now, I don't understand how I should put a canvas. As I can see in >>> Dr.Scheme manual , it is recommended to use world.ss. But I don't >>> understand how will I get the coordinates and save in an array? Also >>> how that line can be drawn? >> >>> Any suggestion is appreciated. >> >>> Thanks in advance. >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From matthias at ccs.neu.edu Wed Jun 10 23:31:58 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Wed Jun 10 23:32:30 2009 Subject: [plt-scheme] Re: Draw and save coordinates on every mouse event on canvas? In-Reply-To: <0d886242-c20b-4534-859d-3e7ac7e03e44@g1g2000yqh.googlegroups.com> References: <7A36E9D6-39B7-4D5E-AC1E-A4F9CFAB68CB@ccs.neu.edu> <0d886242-c20b-4534-859d-3e7ac7e03e44@g1g2000yqh.googlegroups.com> Message-ID: <213E596C-891D-4CC7-B540-1381075A363C@ccs.neu.edu> You can learn Scheme the way you learned Python. But it's like trying to practice for the swim team in a bathtub. -- Matthias, former swimcoach On Jun 10, 2009, at 5:43 PM, Captain___nemo wrote: > Thanks a lot Mr.Matthias. nop, I am not a student, have graduated > several months (not year though) ago :). > > I am working on implementing Voronoi diagram. And may be I was > thinking to learn this too fast (as I did for python). But I > understand now that this language is not like Java or python. So, I > have to learn the structure of this language rather than jumping here > and there :) > > Regards. > > On Jun 11, 1:55 am, Matthias Felleisen wrote: >> Here is a solution: >> >> #lang scheme >> >> (require 2htdp/universe) >> >> ;; World = [Listof (list Nat Nat)] >> (define mt (empty-scene 200 200)) >> (define col "red") >> (define DOT (circle 3 "solid" col)) >> >> (define (click w x y ke) >> (cond >> [(mouse=? "button-down" ke) >> (cons (list x y) w)] >> [else w])) >> >> (define (render w0) >> (local ((define (cnt w a) (foldl (lambda (f a) (list f (apply ln+ >> f a))) a w)) >> (define (dot s p) (place-image DOT (first p) (second p) >> s)) >> (define (ln+ p q s) >> (add-line s (first p) (second p) (first q) (second q) >> col)) >> (define dots (foldr (lambda (f r) (dot r f)) mt w0))) >> (cond >> [(empty? w0) mt] >> [else (second (cnt (rest w0) (list (first w0) (dot dots (first >> w0)))))]))) >> >> (big-bang '() (on-mouse click) (on-draw render)) >> >> But this solution will give you away in case this is homework. To >> prove that this isn't homework, you need to point us to the place >> where our manuals recommend using world.ss. >> >> -- Matthias >> >> On Jun 10, 2009, at 6:53 AM, Captain___nemo wrote: >> >> >> >> >> >>> Hi, >>> I am newbie in scheme, just started yesterday. So, please don't mind >>> if I am overlooking anything simple. >> >>> I want to draw circular points on every click on the drawing window >>> (or canvas). Also I want to save the coordinates in an array. After >>> every click a connecting line should be drawn (from last point) >>> and so >>> on. >> >>> Now, I don't understand how I should put a canvas. As I can see in >>> Dr.Scheme manual , it is recommended to use world.ss. But I don't >>> understand how will I get the coordinates and save in an array? Also >>> how that line can be drawn? >> >>> Any suggestion is appreciated. >> >>> Thanks in advance. >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From DekuDekuplex at Yahoo.com Thu Jun 11 04:30:30 2009 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Thu Jun 11 04:31:18 2009 Subject: [plt-scheme] How difficult would creating a collaborative multi-user online virtual world application be in PLT Scheme? Message-ID: One question that has been coming up at the back of my mind for the past several weeks has been how difficult would it be to create a collaborative multi-user online virtual world application in a semi-functional programming language, such as PLT Scheme. More specifically, last August, I came across a very interesting application called Croquet (see http://www.opencroquet.org/index.php/Main_Page), which happens to be based on Squeak (see http://www.squeak.org/), a dialect of Smalltalk. Croquet, in turn, provides the basis for Cobalt (see http://www.duke.edu/~julian/Cobalt/Home.html), a "virtual workspace browser and construction toolkit for accessing, creating, and publishing hyperlinked multi-user virtual environments" (according to the home page for that project). What struck me as especially interesting was how Croquet allows multiple users to collaborate together in a multi-user online virtual world in software development and other collaborative projects. As one application, the video clip on the upper-right-hand corner of the above-mentioned Croquet home page illustrates how a user can, by writing code from inside the application, create on-the-fly additional virtual environments, which can then be entered by either the programmer or other programmers. Other applications (shown in other video clips on the "Screenshots/Videos" page (see http://www.opencroquet.org/index.php/Screenshots/Videos) show alternative applications that include text-based annotations, a 3D spreadsheet, and writing a conventional blog from within a virtual world. Unfortunately, Smalltalk is an object-oriented language. If possible, I would like to see something similar in a more functional programming language such as PLT Scheme. Does anybody know whether duplicating this project in PLT Scheme would be feasible? -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ From noelwelsh at gmail.com Thu Jun 11 05:59:17 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Jun 11 06:06:19 2009 Subject: [plt-scheme] How difficult would creating a collaborative multi-user online virtual world application be in PLT Scheme? In-Reply-To: References: Message-ID: On Thu, Jun 11, 2009 at 9:30 AM, Benjamin L.Russell wrote: > One question that has been coming up at the back of my mind for the > past several weeks has been how difficult would it be to create a > collaborative multi-user online virtual world application in a > semi-functional programming language, such as PLT Scheme. ... > Does anybody know whether duplicating this project in PLT Scheme would > be feasible? The big problem would, I expect, be serialising data from one machine to another. Not every value in PLT Scheme can be serialised. Functions, I think, are the prime example. However, I don't see the world crying out for that kind of collaboration. Doing something as simple as distributed collaborative editing would be 80% as useful. Integrating with Google Wave (http://www.waveprotocol.org/) might be timely. N. From noelwelsh at gmail.com Thu Jun 11 06:02:47 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Jun 11 06:08:51 2009 Subject: [plt-scheme] Load and require in PLT In-Reply-To: References: Message-ID: As Eli said, you can keep the same code if you invoke MzScheme with the right arguments. To shift to the world of modules you probably want to use dynamic-require. N. On Wed, Jun 10, 2009 at 3:24 PM, N T wrote: > Hi guys, > I am trying to find an equivalent way to run the following test.scm > script with mzscheme. ... From DekuDekuplex at Yahoo.com Thu Jun 11 07:12:11 2009 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Thu Jun 11 07:12:46 2009 Subject: [plt-scheme] Re: How difficult would creating a collaborative multi-user online virtual world application be in PLT Scheme? References: Message-ID: On Thu, 11 Jun 2009 10:59:17 +0100, Noel Welsh wrote: >On Thu, Jun 11, 2009 at 9:30 AM, Benjamin >L.Russell wrote: >> One question that has been coming up at the back of my mind for the >> past several weeks has been how difficult would it be to create a >> collaborative multi-user online virtual world application in a >> semi-functional programming language, such as PLT Scheme. >... >> Does anybody know whether duplicating this project in PLT Scheme would >> be feasible? > >The big problem would, I expect, be serialising data from one machine >to another. Not every value in PLT Scheme can be serialised. >Functions, I think, are the prime example. > >However, I don't see the world crying out for that kind of >collaboration. Doing something as simple as distributed collaborative >editing would be 80% as useful. Integrating with Google Wave >(http://www.waveprotocol.org/) might be timely. Well, I'm basically looking for that kind of collaboration. Distributed collaborative editing might be useful, but it isn't nearly so fun. Having fun is part of the point of this project. I work as a translator, and collaborating with boring coworkers using distributed collaborative editing in a crowded office doing boring work with no scenery might be useful, but it isn't fun; however, collaborating via surreal avatars in a virtual favorite landscape, even with the same coworkers doing the same work, can be more fun. Of course, the definition of "fun" differs from individual to individual, and is highly subjective, so it can be difficult to explain if one's focus is purely on the utility value. Quantifying "fun" can be difficult.... -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ From hkBst at gentoo.org Thu Jun 11 10:03:42 2009 From: hkBst at gentoo.org (Marijn Schouten (hkBst)) Date: Thu Jun 11 10:07:16 2009 Subject: [plt-scheme] random walk In-Reply-To: <05332993-7B7D-4900-85FF-547D01F3B3C1@ccs.neu.edu> References: <4A1FFA58.4080506@gentoo.org> <05332993-7B7D-4900-85FF-547D01F3B3C1@ccs.neu.edu> Message-ID: <4A310EBE.9060401@gentoo.org> Skipped content of type multipart/mixed-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 261 bytes Desc: OpenPGP digital signature Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090611/928695d5/signature.pgp From pocmatos at gmail.com Thu Jun 11 11:10:07 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Jun 11 11:18:58 2009 Subject: [plt-scheme] Contracts on Structures vs Guards Message-ID: <11b141710906110810v75088be4vcb4134aead539c67@mail.gmail.com> Hi all, I am wondering if there is any difference performance-wise between defining a guard on a structure and defining a contract on the structure. I am I correct to say that the contract on the structure is only checked in module boundaries while guards are always checked when the structure is built and therefore having contracts would always be at least as fast as guards (when assuming that guards are only used to check the types of values)? Contracts are also probably the recommended style, right? Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From luciano at ramalho.org Thu Jun 11 11:57:05 2009 From: luciano at ramalho.org (Luciano Ramalho) Date: Thu Jun 11 11:57:28 2009 Subject: [plt-scheme] Immutable boxes: why? Message-ID: <4331ad810906110857j63c5a2e4ocfc68e57bc822464@mail.gmail.com> My understanding of the box datatype was shaken when I read [1] that there is an "immutable box" constructor: (box-immutable v) [1] http://docs.plt-scheme.org/reference/boxes.html Can someone please explain what is the use of an immutable box? Thanks in advance! --Luciano From eli at barzilay.org Thu Jun 11 12:05:22 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Jun 11 12:05:45 2009 Subject: [plt-scheme] Immutable boxes: why? In-Reply-To: <4331ad810906110857j63c5a2e4ocfc68e57bc822464@mail.gmail.com> References: <4331ad810906110857j63c5a2e4ocfc68e57bc822464@mail.gmail.com> Message-ID: <18993.11074.783614.284262@winooski.ccs.neu.edu> On Jun 11, Luciano Ramalho wrote: > My understanding of the box datatype was shaken when I read [1] that > there is an "immutable box" constructor: > > (box-immutable v) > > [1] http://docs.plt-scheme.org/reference/boxes.html > > Can someone please explain what is the use of an immutable box? It's useful in literals. Try this in PLT v3xx, and then in v4.x: (define (foo) (let ([b #&0]) (set-box! b (add1 (unbox b))) (unbox b))) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From mflatt at cs.utah.edu Thu Jun 11 13:20:08 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Jun 11 13:20:34 2009 Subject: [plt-scheme] Immutable boxes: why? In-Reply-To: <18993.11074.783614.284262@winooski.ccs.neu.edu> References: <4331ad810906110857j63c5a2e4ocfc68e57bc822464@mail.gmail.com> <18993.11074.783614.284262@winooski.ccs.neu.edu> Message-ID: <20090611172010.EF1196500FB@mail-svr1.cs.utah.edu> At Thu, 11 Jun 2009 12:05:22 -0400, Eli Barzilay wrote: > On Jun 11, Luciano Ramalho wrote: > > My understanding of the box datatype was shaken when I read [1] that > > there is an "immutable box" constructor: > > > > (box-immutable v) > > > > [1] http://docs.plt-scheme.org/reference/boxes.html > > > > Can someone please explain what is the use of an immutable box? > > It's useful in literals. Try this in PLT v3xx, and then in v4.x: > > (define (foo) > (let ([b #&0]) > (set-box! b (add1 (unbox b))) > (unbox b))) Although this illustrates why literal boxes should not be mutable, it begs the question of why literal boxes exist at all. Literal boxes are a just holdover from earlier days, and I know of no good use for them. From samth at ccs.neu.edu Thu Jun 11 13:53:34 2009 From: samth at ccs.neu.edu (Sam TH) Date: Thu Jun 11 14:01:53 2009 Subject: [plt-scheme] Immutable boxes: why? In-Reply-To: <20090611172010.EF1196500FB@mail-svr1.cs.utah.edu> References: <4331ad810906110857j63c5a2e4ocfc68e57bc822464@mail.gmail.com> <18993.11074.783614.284262@winooski.ccs.neu.edu> <20090611172010.EF1196500FB@mail-svr1.cs.utah.edu> Message-ID: <63bb19ae0906111053s6c3318eah4362a966a94fe12b@mail.gmail.com> On Thu, Jun 11, 2009 at 1:20 PM, Matthew Flatt wrote: > At Thu, 11 Jun 2009 12:05:22 -0400, Eli Barzilay wrote: >> On Jun 11, Luciano Ramalho wrote: >> > My understanding of the box datatype was shaken when I read [1] that >> > there is an "immutable box" constructor: >> > >> > (box-immutable v) >> > >> > [1] http://docs.plt-scheme.org/reference/boxes.html >> > >> > Can someone please explain what is the use of an immutable box? >> >> It's useful in literals. ?Try this in PLT v3xx, and then in v4.x: >> >> ? (define (foo) >> ? ? (let ([b #&0]) >> ? ? ? (set-box! b (add1 (unbox b))) >> ? ? ? (unbox b))) > > Although this illustrates why literal boxes should not be mutable, it > begs the question of why literal boxes exist at all. Literal boxes are > a just holdover from earlier days, and I know of no good use for them. Literal boxes are used in `match', both in the old-style patterns and in quasi-patterns. I'm not suggesting that those uses are worth keeping them, though. -- sam th samth@ccs.neu.edu From adityashukla1983 at gmail.com Thu Jun 11 14:07:24 2009 From: adityashukla1983 at gmail.com (aditya shukla) Date: Thu Jun 11 14:07:44 2009 Subject: [plt-scheme] HTDP Excercise 14.1.5 Message-ID: <73045cca0906111107h4228a68br1aadd0996b904e99@mail.gmail.com> I am trying to solve this particular exercise from htdp and this how i have done it. ;data definition (define-struct child (father mother name date eyes)) ;oldest generation (define Carl (make-child empty empty 'Carl 1926 'green)) (define Bettina (make-child empty empty 'Bettina 1926 'green)) ;; Middle Generation: (define Adam (make-child Carl Bettina 'Adam 1950 'yellow)) (define Dave (make-child Carl Bettina 'Dave 1955 'black)) (define Eva (make-child Carl Bettina 'Eva 1965 'blue)) (define Fred (make-child empty empty 'Fred 1966 'pink)) ;; Youngest Generation: (define Gustav (make-child Fred Eva 'Gustav 1988 'brown)) ;A family-tree-node (short: ftn) is either ; 1. ; empty; or ;2. ; (make-child f m na da ec) ; where f and m are ftns, na ;and ec are symbols, and da is a number. ;contract of eye-color ftn(family tree node) -> list of eyes color ;Purpose :This function takes a family tree node and constructs an eye-color list for that node ( eye-color) can occur more. ;examples empty -> empty ,carl ->green , bettina -> green , adam->yellow,green, green , dave->black,green,green , gustav-> brown,pink,blue,green,green ;template(define eye-color (lambda (ftn) (cond [(empty? ftn )][else (count-persons (child-father ftn)) (count-persons (child-mother ftn)) (child-name ftn) (child-date ftn) (child-eyes ftn)]))) (define eye-color (lambda (ftn) (cond [(empty? ftn) empty] [else (append(list(child-eyes ftn))(list(eye-color(child-father ftn)))(list(eye-color(child-mother ftn))))]))) (eye-color empty) (eye-color Carl) (eye-color Bettina) (eye-color Adam) (eye-color Gustav) empty (list 'green empty empty) (list 'green empty empty) (list 'yellow (list 'green empty empty) (list 'green empty empty)) (list 'brown (list 'pink empty empty) (list 'blue (list 'green empty empty) (list 'green empty empty))) My question here is :In the question it is asked to use append , and I am appending lists with each other.Is this the right solution ? Also I think cons could have been used to construct a single list for a particulat family-tree-node then why to use append.? Thanks Aditya -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090611/8fc895ac/attachment.htm From grettke at acm.org Thu Jun 11 14:31:08 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Jun 11 14:31:28 2009 Subject: [plt-scheme] Why did Honu visit me today? Message-ID: <756daca50906111131n3fb13425p512b6b914ca4e1a3@mail.gmail.com> Why did Honu visit me today? From dherman at ccs.neu.edu Thu Jun 11 14:34:10 2009 From: dherman at ccs.neu.edu (Dave Herman) Date: Thu Jun 11 14:34:41 2009 Subject: [plt-scheme] Why did Honu visit me today? In-Reply-To: <756daca50906111131n3fb13425p512b6b914ca4e1a3@mail.gmail.com> References: <756daca50906111131n3fb13425p512b6b914ca4e1a3@mail.gmail.com> Message-ID: <4A314E22.6080308@ccs.neu.edu> http://en.wikipedia.org/wiki/Kamehameha_Day Grant Rettke wrote: > Why did Honu visit me today? > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From robby at eecs.northwestern.edu Thu Jun 11 15:11:38 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Jun 11 15:17:19 2009 Subject: [plt-scheme] Why did Honu visit me today? In-Reply-To: <4A314E22.6080308@ccs.neu.edu> References: <756daca50906111131n3fb13425p512b6b914ca4e1a3@mail.gmail.com> <4A314E22.6080308@ccs.neu.edu> Message-ID: <932b2f1f0906111211u3004bad3lf679ddd43f6527e8@mail.gmail.com> The pattern in the background was my attempt at a Palaka pattern, another Hawaiian thing. Robby On Thu, Jun 11, 2009 at 1:34 PM, Dave Herman wrote: > http://en.wikipedia.org/wiki/Kamehameha_Day > > Grant Rettke wrote: >> >> Why did Honu visit me today? >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From keydana at gmx.de Thu Jun 11 15:56:04 2009 From: keydana at gmx.de (keydana@gmx.de) Date: Thu Jun 11 15:56:28 2009 Subject: [plt-scheme] problem using sqlite and web server in combination (empty db file) Message-ID: <87566EDE-0EB0-4783-B63C-5E88220EBCCD@gmx.de> Hi all, I am using snooze (with sqlite) to build a web application with database access. I created tables and test data, which I can successfully query from a "normal" file. However, when I try doing the same from a request- generating function called with serve/servlet, I get an error that the tables don't exist: ./../../../../../Users/hunli/Documents/scheme/webapps/calendar/web.ss: 109:55: Servlet (@ /calendar) exception: Could not execute SELECT query: SELECT [P].[id] AS [P-id], [P].[code] AS [P-code] FROM [person] AS [P];: SQLite Error: no such table: person I have configured extra-files-paths like this: #:extra-files-paths (list (current-directory) (build-path (current- directory) "static-docs")) and my database file, planning.db, is in the current directory. As I was in general unsure about where to put the application files and where the server root (with its htdocs subdirectory) is, I searched for it and found it in /Applications/PLT Scheme v4.1.4/collects/web-server/default-web-root/ htdocs and there I also found an instance of planning.db, only this file was empty (so of course there was no table :-;) Now I wonder how the empty file got there (I would have assumed that #:extra-files-paths really just meant a search directive and not creating links to or even copying files?) and what I can do to fix it? Also, in general, where should applications best be put - under some user directory like I'm doing now, or directly in an "application" subdirectory of "htdocs" ? Coming from Java, I am somehow used to having separated "development" and "deployment" steps... I'd be grateful for any help or hints about what to do. Thanks a lot in advance, Sigrid From matthias at ccs.neu.edu Thu Jun 11 16:22:46 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Jun 11 16:23:57 2009 Subject: [plt-scheme] random walk In-Reply-To: <4A310EBE.9060401@gentoo.org> References: <4A1FFA58.4080506@gentoo.org> <05332993-7B7D-4900-85FF-547D01F3B3C1@ccs.neu.edu> <4A310EBE.9060401@gentoo.org> Message-ID: <193B28D0-C39A-425D-BE51-433D92044E51@ccs.neu.edu> I have spent an hour or so improving the speed of my solution by a factor of 12. This should bring it closer to 150 seconds on your machine. I started from a list based version, went to vectors, and then eliminated the applicative vector update with temporary assignments. The files (with invocation commands) follow in order fast to slow. -- Matthias #lang scheme #| [:~/0Unison/Need] matthias% mzscheme foo3.ss 10 cpu time: 234 real time: 234 gc time: 0 |# ;; Nat Nat -> Nat ;; compute L2 distance for all random walks of depth dpt in n-space (define (walk n depth) (define O (make-vector n 0)) (let step ((ld 0) (p O)) (if (>= ld depth) ;; (apply + (map sqr p)) (let loop ([i 0][sum 0]) (if (= i n) sum (loop (+ i 1) (+ sum (sqr (vector-ref p i)))))) ;; (apply + (map (curry step (+ ld 1)) (map (curry v+ p) Ds))) (let loop ([Ds 0][sum 0]) (define-syntax-rule (tmp! delta) (let ([old (vector-ref p Ds)]) (vector-set! p Ds (delta old 1)) (begin0 (step (+ ld 1) p) (vector-set! p Ds old)))) (if (= Ds n) sum (loop (+ Ds 1) (+ sum (tmp! +) (tmp! -)))))))) (define (main depth) (pretty-print (/ (walk 2 depth) (expt 4 depth)))) (time (main 10)) #lang scheme #| [:~/0Unison/Need] matthias% mzscheme foo2.ss 10 cpu time: 414 real time: 414 gc time: 14 |# ;; Nat Nat -> Nat ;; compute L2 distance for all random walks of depth dpt in n-space (define (walk n depth) (define O (make-vector n 0)) (define Ds (deltas n)) (let step ((ld 0) (p O)) (if (>= ld depth) ;; (apply + (map sqr p)) (let loop ([i 0][sum 0]) (if (= i n) sum (loop (+ i 1) (+ sum (sqr (vector-ref p i)))))) ;; (apply + (map (curry step (+ ld 1)) (map (curry v+ p) Ds))) (let loop ([Ds Ds][sum 0]) (if (null? Ds) sum (loop (cdr Ds) (+ sum (step (+ ld 1) (vector+ n p (car Ds)))))))))) ;; Nat (Vectorof Nat) (Vectorof Nat) -> (Vectorof Nat) (define (vector+ n p delta) (define result (make-vector n 0)) (let loop ([i 0]) (when (< i n) (vector-set! result i (+ (vector-ref p i) (vector-ref delta i))) (loop (+ i 1)))) result) ;; Nat -> (Listof (Vectorof {0|+1|-1})) (define (deltas n) (define (mk D i) (lambda (j) (if (= i j) D 0))) (append (build-list n (lambda (i) (build-vector n (mk +1 i)))) (build-list n (lambda (i) (build-vector n (mk -1 i)))))) (define (main depth) (pretty-print (/ (walk 2 depth) (expt 4 depth)))) (time (main 10)) #lang scheme #| [:~/0Unison/Need] matthias% mzscheme foo1.ss 10 cpu time: 606 real time: 607 gc time: 18 |# ;; Nat Nat -> Nat ;; compute L2 distance for all random walks of depth dpt in n-space (define (walk n depth) (define O (make-list n 0)) (define Ds (deltas n)) (let step ((ld 0) (p O)) (if (>= ld depth) ;; (apply + (map sqr p)) (let loop ([p p][sum 0]) (if (null? p) sum (loop (cdr p) (+ sum (sqr (car p)))))) ;; (apply + (map (curry step (+ ld 1)) (map (curry v+ p) Ds))) (let loop ([Ds Ds][sum 0]) (if (null? Ds) sum (loop (cdr Ds) (+ sum (step (+ ld 1) (map + p (car Ds)))))))))) ;; Nat -> (Listof (Vectorof {0|+1|-1})) (define (deltas n) (define (mk D i) (lambda (j) (if (= i j) D 0))) (append (build-list n (lambda (i) (build-list n (mk +1 i)))) (build-list n (lambda (i) (build-list n (mk -1 i)))))) (define (main depth) (pretty-print (/ (walk 2 depth) (expt 4 depth)))) (time (main 10)) #lang scheme #| [:~/0Unison/Need] matthias% mzscheme foo.ss 10 cpu time: 2779 real time: 2776 gc time: 72 |# ;; Nat Nat -> Nat ;; compute L2 distance for all random walks of depth dpt in n-space (define (walk n depth) (define O (make-vector n 0)) (define Ds (deltas n)) (let step ((ld 0) (p O)) (if (>= ld depth) (L2 p) (apply + (map (curry step (+ ld 1)) (map (curry v+ p) Ds)))))) ;; (Vectorof Nat) -> Nat (define (L2 p) (apply + (map sqr (vector->list p)))) ;; Nat -> (Listof (Vectorof {0|+1|-1})) (define (deltas n) (define (mk D i) (lambda (j) (if (= i j) D 0))) (append (build-list n (lambda (i) (build-vector n (mk +1 i)))) (build-list n (lambda (i) (build-vector n (mk -1 i)))))) ;; (Vectorof Nat) (Vector Nat) -> (Vector Nat) (define (v+ u v) ;; I am sure there's some for/vector somewhere, I can't find it (list->vector (for/list ((x u) (y v)) (+ x y)))) (define (main depth) (pretty-print (/ (walk 2 depth) (expt 4 depth)))) (time (main 10)) On Jun 11, 2009, at 10:03 AM, Marijn Schouten (hkBst) wrote: > First, I'd like to thank all who tried to help me previously with > this. > Unfortunately I still didn't manage to fix my macro mess, so I have > tried again > with functions. > > Matthias Felleisen wrote: >> >> Do you want this function? I don't see the need for a macro. > > Yes, this code does what I need, but it doesn't do it fast enough. > >> #lang scheme > > I commented this out, since I don't know how to run with it. > >> >> ;; Nat Nat -> Nat >> ;; compute L2 distance for all random walks of depth dpt in n-space >> (define (walk n depth) >> (define O (make-vector n 0)) >> (define Ds (deltas n)) >> (let step ((ld 0) (p O)) >> (if (>= ld depth) >> (L2 p) >> (apply + (map (lambda (d) (step (+ ld 1) (v+ p d))) Ds))))) >> >> ;; (Vectorof Nat) -> Nat >> (define (L2 p) >> (apply + (map sqr (vector->list p)))) >> >> ;; Nat -> (Listof (Vectorof {0|+1|-1})) >> (define (deltas n) >> (define (mk+1 i) (lambda (j) (if (= i j) +1 0))) >> (define (mk-1 i) (lambda (j) (if (= i j) -1 0))) >> (apply append >> (build-list n (lambda (i) >> (list (build-vector n (mk+1 i)) >> (build-vector n (mk-1 i))))))) >> >> ;; (Vectorof Nat) (Vector Nat) -> (Vector Nat) >> (define (v+ u v) >> ;; I am sure there's some for/vector somewhere, I can't find it >> (list->vector (for/list ((x u) (y v)) (+ x y)))) >> >> ;; > > I added: > > (define (main depth) > (pretty-print (/ (walk 2 depth) (expt 4 depth)))) > > Then I ran like so: > > mzscheme -f felleisen-walk.scm -e "(time (main 10))" > 10 > cpu time: 1940 real time: 1956 gc time: 75 > > > > The following code: > > (define (fast-squared-L2-norm-2 x y) > (+ (* x x) (* y y))) > > (define (fast-walk-2 depth) > (let step ((d 0) (x 0) (y 0) #;(z 0)) > (cond ((< d depth) > (let ((d+1 (+ d 1))) > (+ (step d+1 (+ x 1) y) > (+ (step d+1 (- x 1) y) > (+ (step d+1 x (+ y 1)) > (step d+1 x (- y 1)) ))))) > (else > (fast-squared-L2-norm-2 x y))))) > > is specific to dimension 2 but also much faster: > > $ mzscheme -e "(define pp pretty-print)" -f randomwalk.scm -e > "(time (main 10))" > 10 > cpu time: 59 real time: 59 gc time: 0 > > I also have an abstract version that runs in any dimension that > runs 10 times as > slow as my fast version and 3 times faster than your version. There > are > certainly some areas in my abstract version which I am extremely > unhappy about > that account for a lot of consing. > > Anyway, I'm interested in code that runs as fast as my fast code > above, but is > also able to work with arbitrary dimension, such that I do not have > to duplicate > my code for each dimension that I am interested in. I would be very > happy if I > could do that by optimizing some abstract version that uses only > functions by > eliminating consing and non-tail recursion, but currently it seems > to me that > only a macro that generates the fast code given a particular > dimension will give > maximum speed. > > Further I would like to note that preliminary testing seems to > indicate that > plt-scheme is quite competitive with other fast implementations > that I have > tried for my current code (unlike say gauche (3-4 times slower) or > scheme48 (4 > times slower than gauche)). Previous testing had shown plt to be > (only) > medium-fast, so I am pleasantly surprised. > > I have attached a file with my slow and fast implementations (no > macros yet). > You can switch between the implementations in the main function at > the bottom. > > Thanks, > > Marijn > >> --------------------------------------------------------------------- >> -------- >> >> (require test-engine/scheme-tests) >> >> ;; deltas >> (check-expect (deltas 0) '()) >> (check-expect (deltas 1) (list (vector +1) (vector -1))) >> (check-expect >> (deltas 2) (list (vector +1 0) (vector -1 0) (vector 0 +1) >> (vector 0 -1))) >> >> ;; v+ >> (check-expect (v+ #3(2 3 0) #3(-1 0 0)) #3(1 3 0)) >> >> ;; L2 >> (check-expect (L2 #3(2 3 0)) 13) >> >> ;; walk: >> ;; add your favorite test here >> >> (test) >> >> >> >> >> On May 29, 2009, at 11:08 AM, Marijn Schouten (hkBst) wrote: >> >>> Hi, >>> >>> I'm trying to write a macro that writes a function that sums the >>> L2-lengths of >>> all (random) walks of depth d on a square grid of dimension DIM. In >>> dimension 2 >>> that function should look like this: >>> >>> >>> (define (walk depth) >>> (let step ((d 0) (x 0) (y 0) #;(z 0)) >>> (cond ((< d depth) >>> (let ((d+1 (+ d 1))) >>> (+ >>> (step d+1 (+ x 1) y) >>> (+ >>> (step d+1 (- x 1) y) >>> (+ (step d+1 x (+ y 1)) >>> (step d+1 x (- y 1))) )))) >>> (else >>> (+ (* x x) (* y y)) ) ))) >>> >>> >>> (walk d) starts at the origin, (x,y) = (0,0), and recursively >>> walks a >>> step in >>> all 2DIM directions, returning the L2-length when depth d is reached >>> and summing >>> all those lengths. It is not hard to prove that (walk depth) is >>> equal >>> to (expt >>> (* 2 (DIM)) depth) but this random walk length summer is only the >>> starting point >>> for doing more interesting things. >>> >>> I'm looking for a macro that will write the `walk' function given >>> the >>> dimension. >>> >>> Attached is an attempt that I cannot seem to get working. >>> >>> Thanks, >>> >>> Marijn > > > > -- > If you cannot read my mind, then listen to what I say. > > Marijn Schouten (hkBst), Gentoo Lisp project, Gentoo ML > , #gentoo-{lisp,ml} on FreeNode > ; $ gsc -prelude "(declare (standard-bindings)(block))" randomwalk.scm > ; $ gsc -prelude "(declare (standard-bindings)(extended-bindings) > (block)(not safe))" randomwalk.scm > ; $ gsi randomwalk -e "(time (main 10))" > > ; $ time bigloo -load randomwalk.scm -eval "(main 8)(exit)" > > ; $ bigloo -Obench randomwalk.bgl -o bigloo-randomwalk > ; $ time ./bigloo-randomwalk 10 > > ; $ mzscheme -e "(define pp pretty-print)" -f randomwalk.scm -e > "(time (main 10))" > > ; $ larceny -- -e "(define pp pretty-print)(compiler-switches 'fast- > unsafe)(benchmark-block-mode #t)" randomwalk.scm -e "(time (main > 10))" -e "(quit)" > > ; $ gosh -l ./randomwalk.scm -e "(define pp print)" -e "(time (main > 10))" -e "(exit)" > > ; $ scheme48 -a batch <<<$'(define pp (lambda (x) (display x) > (newline)))(load "randomwalk.scm")\n,time(main 8)' > > > (define (reduce-map/index u r m l) > (let loop ((l l) (ret u) (i 0)) > (if (null? l) ret (loop (cdr l) (r (m (car l) i) ret) (+ i 1))))) > > (define (reduce-map-right/index u r m l) > (let loop ((l l) (i 0)) > (if (null? l) u (r (m (car l) i) (loop (cdr l) (+ i 1)))))) > > (define (reduce-map u r m l) > (reduce-map/index u r (lambda (e i) (m e)) l)) > ; (let loop ((l l) (ret u)) > ; (if (null? l) ret (loop (cdr l) (r (m (car l)) ret))))) > > (define (map/index m l) > (reduce-map-right/index '() cons m l)) > > (define (squared-L2-norm pos) > (reduce-map 0 + (lambda (e) (* e e)) pos)) > > (define (next-position pos dim step) > (let ((pos-vector (list->vector pos))) > (vector-set! pos-vector dim (+ (vector-ref pos-vector dim) step)) > (vector->list pos-vector))) > > (define (next-positions dimension pos) > (let loop ((dim 0) (dir #t) (ret '())) > (if (= dim dimension) ret > (if dir > (loop dim #f (cons (next-position pos dim -1) ret)) > (loop (+ dim 1) #t (cons (next-position pos dim +1) ret)) )))) > > (define (walk dimension norm) > (lambda (depth) > (let step ((d 0) (pos (vector->list (make-vector dimension 0)))) > (if (< d depth) > (reduce-map 0 + (lambda (p) (step (+ d 1) p)) (next-positions > dimension pos)) > (norm pos) ) ))) > > ;;;fast version below > > (define (fast-squared-L2-norm-2 x y) > (+ (* x x) (* y y))) > > (define (fast-walk-2 depth) > (let step ((d 0) (x 0) (y 0) );#;(z 0)) > (cond ((< d depth) > (let ((d+1 (+ d 1))) > (+ (step d+1 (+ x 1) y) > (+ (step d+1 (- x 1) y) > (+ (step d+1 x (+ y 1)) > (step d+1 x (- y 1)) ))))) > (else > (fast-squared-L2-norm-2 x y))))) > > (define (main depth) > (pp (/ ((if #f (walk 2 squared-L2-norm) fast-walk-2) depth) (expt > 4 depth)))) > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From matthias at ccs.neu.edu Thu Jun 11 16:23:35 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Jun 11 16:24:24 2009 Subject: [plt-scheme] Contracts on Structures vs Guards In-Reply-To: <11b141710906110810v75088be4vcb4134aead539c67@mail.gmail.com> References: <11b141710906110810v75088be4vcb4134aead539c67@mail.gmail.com> Message-ID: <7BE61944-35B8-4E5F-BFBB-44B021F1535A@ccs.neu.edu> yes. On Jun 11, 2009, at 11:10 AM, Paulo J. Matos wrote: > Hi all, > > I am wondering if there is any difference performance-wise between > defining a guard on a structure and defining a contract on the > structure. > > I am I correct to say that the contract on the structure is only > checked in module boundaries while guards are always checked when the > structure is built and therefore having contracts would always be at > least as fast as guards (when assuming that guards are only used to > check the types of values)? > > Contracts are also probably the recommended style, right? > > Cheers, > > -- > Paulo Jorge Matos - pocmatos at gmail.com > http://www.pmatos.net > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From matthias at ccs.neu.edu Thu Jun 11 17:22:58 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Jun 11 17:23:47 2009 Subject: [plt-scheme] random walk In-Reply-To: <193B28D0-C39A-425D-BE51-433D92044E51@ccs.neu.edu> References: <4A1FFA58.4080506@gentoo.org> <05332993-7B7D-4900-85FF-547D01F3B3C1@ccs.neu.edu> <4A310EBE.9060401@gentoo.org> <193B28D0-C39A-425D-BE51-433D92044E51@ccs.neu.edu> Message-ID: p.s. I am so sorry for using a lexically scope macro before: I thought I needed to do so for performance. Turns out, a function works just as fast: > #lang scheme > > #| [:~/0Unison/Need] matthias% mzscheme foo3.ss > 10 > cpu time: 234 real time: 234 gc time: 0 |# > > ;; Nat Nat -> Nat > ;; compute L2 distance for all random walks of depth dpt in n-space > (define (walk n depth) > (define O (make-vector n 0)) > (let step ((ld 0) (p O)) > (if (>= ld depth) > ;; (apply + (map sqr p)) > (let loop ([i 0][sum 0]) > (if (= i n) sum (loop (+ i 1) (+ sum (sqr (vector-ref p > i)))))) > ;; (apply + (map (curry step (+ ld 1)) (map (curry v+ p) Ds))) > (let loop ([Ds 0][sum 0]) > (define (tmp! delta) > (let ([old (vector-ref p Ds)]) > (vector-set! p Ds (delta old 1)) > (begin0 > (step (+ ld 1) p) > (vector-set! p Ds old)))) > (if (= Ds n) sum (loop (+ Ds 1) (+ sum (tmp! +) (tmp! > -)))))))) > > (define (main depth) > (pretty-print (/ (walk 2 depth) (expt 4 depth)))) > > (time (main 10)) On Jun 11, 2009, at 4:22 PM, Matthias Felleisen wrote: > > I have spent an hour or so improving the speed of my solution by a > factor of 12. This should bring it closer to 150 seconds on your > machine. > > I started from a list based version, went to vectors, and then > eliminated the applicative vector update with temporary assignments. > > The files (with invocation commands) follow in order fast to slow. > -- Matthias > > #lang scheme > > #| [:~/0Unison/Need] matthias% mzscheme foo3.ss > 10 > cpu time: 234 real time: 234 gc time: 0 |# > > ;; Nat Nat -> Nat > ;; compute L2 distance for all random walks of depth dpt in n-space > (define (walk n depth) > (define O (make-vector n 0)) > (let step ((ld 0) (p O)) > (if (>= ld depth) > ;; (apply + (map sqr p)) > (let loop ([i 0][sum 0]) > (if (= i n) sum (loop (+ i 1) (+ sum (sqr (vector-ref p > i)))))) > ;; (apply + (map (curry step (+ ld 1)) (map (curry v+ p) Ds))) > (let loop ([Ds 0][sum 0]) > (define-syntax-rule (tmp! delta) > (let ([old (vector-ref p Ds)]) > (vector-set! p Ds (delta old 1)) > (begin0 > (step (+ ld 1) p) > (vector-set! p Ds old)))) > (if (= Ds n) sum (loop (+ Ds 1) (+ sum (tmp! +) (tmp! > -)))))))) > > (define (main depth) > (pretty-print (/ (walk 2 depth) (expt 4 depth)))) > > (time (main 10)) > > > #lang scheme > > #| [:~/0Unison/Need] matthias% mzscheme foo2.ss > 10 > cpu time: 414 real time: 414 gc time: 14 |# > > ;; Nat Nat -> Nat > ;; compute L2 distance for all random walks of depth dpt in n-space > (define (walk n depth) > (define O (make-vector n 0)) > (define Ds (deltas n)) > (let step ((ld 0) (p O)) > (if (>= ld depth) > ;; (apply + (map sqr p)) > (let loop ([i 0][sum 0]) > (if (= i n) sum (loop (+ i 1) (+ sum (sqr (vector-ref p > i)))))) > ;; (apply + (map (curry step (+ ld 1)) (map (curry v+ p) Ds))) > (let loop ([Ds Ds][sum 0]) > (if (null? Ds) > sum > (loop (cdr Ds) > (+ sum (step (+ ld 1) (vector+ n p (car > Ds)))))))))) > > ;; Nat (Vectorof Nat) (Vectorof Nat) -> (Vectorof Nat) > (define (vector+ n p delta) > (define result (make-vector n 0)) > (let loop ([i 0]) > (when (< i n) > (vector-set! result i (+ (vector-ref p i) (vector-ref delta i))) > (loop (+ i 1)))) > result) > > ;; Nat -> (Listof (Vectorof {0|+1|-1})) > (define (deltas n) > (define (mk D i) (lambda (j) (if (= i j) D 0))) > (append (build-list n (lambda (i) (build-vector n (mk +1 i)))) > (build-list n (lambda (i) (build-vector n (mk -1 i)))))) > > (define (main depth) > (pretty-print (/ (walk 2 depth) (expt 4 depth)))) > > (time (main 10)) > > #lang scheme > > #| [:~/0Unison/Need] matthias% mzscheme foo1.ss > 10 > cpu time: 606 real time: 607 gc time: 18 |# > > ;; Nat Nat -> Nat > ;; compute L2 distance for all random walks of depth dpt in n-space > (define (walk n depth) > (define O (make-list n 0)) > (define Ds (deltas n)) > (let step ((ld 0) (p O)) > (if (>= ld depth) > ;; (apply + (map sqr p)) > (let loop ([p p][sum 0]) > (if (null? p) sum (loop (cdr p) (+ sum (sqr (car p)))))) > ;; (apply + (map (curry step (+ ld 1)) (map (curry v+ p) Ds))) > (let loop ([Ds Ds][sum 0]) > (if (null? Ds) > sum > (loop (cdr Ds) (+ sum (step (+ ld 1) (map + p (car > Ds)))))))))) > > ;; Nat -> (Listof (Vectorof {0|+1|-1})) > (define (deltas n) > (define (mk D i) (lambda (j) (if (= i j) D 0))) > (append (build-list n (lambda (i) (build-list n (mk +1 i)))) > (build-list n (lambda (i) (build-list n (mk -1 i)))))) > > (define (main depth) > (pretty-print (/ (walk 2 depth) (expt 4 depth)))) > > (time (main 10)) > > #lang scheme > > #| [:~/0Unison/Need] matthias% mzscheme foo.ss > 10 > cpu time: 2779 real time: 2776 gc time: 72 |# > > ;; Nat Nat -> Nat > ;; compute L2 distance for all random walks of depth dpt in n-space > (define (walk n depth) > (define O (make-vector n 0)) > (define Ds (deltas n)) > (let step ((ld 0) (p O)) > (if (>= ld depth) > (L2 p) > (apply + (map (curry step (+ ld 1)) (map (curry v+ p) Ds)))))) > > ;; (Vectorof Nat) -> Nat > (define (L2 p) > (apply + (map sqr (vector->list p)))) > > ;; Nat -> (Listof (Vectorof {0|+1|-1})) > (define (deltas n) > (define (mk D i) (lambda (j) (if (= i j) D 0))) > (append (build-list n (lambda (i) (build-vector n (mk +1 i)))) > (build-list n (lambda (i) (build-vector n (mk -1 i)))))) > > ;; (Vectorof Nat) (Vector Nat) -> (Vector Nat) > (define (v+ u v) > ;; I am sure there's some for/vector somewhere, I can't find it > (list->vector (for/list ((x u) (y v)) (+ x y)))) > > (define (main depth) > (pretty-print (/ (walk 2 depth) (expt 4 depth)))) > > (time (main 10)) > > > > > > > > > > On Jun 11, 2009, at 10:03 AM, Marijn Schouten (hkBst) wrote: > >> First, I'd like to thank all who tried to help me previously with >> this. >> Unfortunately I still didn't manage to fix my macro mess, so I >> have tried again >> with functions. >> >> Matthias Felleisen wrote: >>> >>> Do you want this function? I don't see the need for a macro. >> >> Yes, this code does what I need, but it doesn't do it fast enough. >> >>> #lang scheme >> >> I commented this out, since I don't know how to run with it. >> >>> >>> ;; Nat Nat -> Nat >>> ;; compute L2 distance for all random walks of depth dpt in n-space >>> (define (walk n depth) >>> (define O (make-vector n 0)) >>> (define Ds (deltas n)) >>> (let step ((ld 0) (p O)) >>> (if (>= ld depth) >>> (L2 p) >>> (apply + (map (lambda (d) (step (+ ld 1) (v+ p d))) Ds))))) >>> >>> ;; (Vectorof Nat) -> Nat >>> (define (L2 p) >>> (apply + (map sqr (vector->list p)))) >>> >>> ;; Nat -> (Listof (Vectorof {0|+1|-1})) >>> (define (deltas n) >>> (define (mk+1 i) (lambda (j) (if (= i j) +1 0))) >>> (define (mk-1 i) (lambda (j) (if (= i j) -1 0))) >>> (apply append >>> (build-list n (lambda (i) >>> (list (build-vector n (mk+1 i)) >>> (build-vector n (mk-1 i))))))) >>> >>> ;; (Vectorof Nat) (Vector Nat) -> (Vector Nat) >>> (define (v+ u v) >>> ;; I am sure there's some for/vector somewhere, I can't find it >>> (list->vector (for/list ((x u) (y v)) (+ x y)))) >>> >>> ;; >> >> I added: >> >> (define (main depth) >> (pretty-print (/ (walk 2 depth) (expt 4 depth)))) >> >> Then I ran like so: >> >> mzscheme -f felleisen-walk.scm -e "(time (main 10))" >> 10 >> cpu time: 1940 real time: 1956 gc time: 75 >> >> >> >> The following code: >> >> (define (fast-squared-L2-norm-2 x y) >> (+ (* x x) (* y y))) >> >> (define (fast-walk-2 depth) >> (let step ((d 0) (x 0) (y 0) #;(z 0)) >> (cond ((< d depth) >> (let ((d+1 (+ d 1))) >> (+ (step d+1 (+ x 1) y) >> (+ (step d+1 (- x 1) y) >> (+ (step d+1 x (+ y 1)) >> (step d+1 x (- y 1)) ))))) >> (else >> (fast-squared-L2-norm-2 x y))))) >> >> is specific to dimension 2 but also much faster: >> >> $ mzscheme -e "(define pp pretty-print)" -f randomwalk.scm -e >> "(time (main 10))" >> 10 >> cpu time: 59 real time: 59 gc time: 0 >> >> I also have an abstract version that runs in any dimension that >> runs 10 times as >> slow as my fast version and 3 times faster than your version. >> There are >> certainly some areas in my abstract version which I am extremely >> unhappy about >> that account for a lot of consing. >> >> Anyway, I'm interested in code that runs as fast as my fast code >> above, but is >> also able to work with arbitrary dimension, such that I do not >> have to duplicate >> my code for each dimension that I am interested in. I would be >> very happy if I >> could do that by optimizing some abstract version that uses only >> functions by >> eliminating consing and non-tail recursion, but currently it seems >> to me that >> only a macro that generates the fast code given a particular >> dimension will give >> maximum speed. >> >> Further I would like to note that preliminary testing seems to >> indicate that >> plt-scheme is quite competitive with other fast implementations >> that I have >> tried for my current code (unlike say gauche (3-4 times slower) or >> scheme48 (4 >> times slower than gauche)). Previous testing had shown plt to be >> (only) >> medium-fast, so I am pleasantly surprised. >> >> I have attached a file with my slow and fast implementations (no >> macros yet). >> You can switch between the implementations in the main function at >> the bottom. >> >> Thanks, >> >> Marijn >> >>> -------------------------------------------------------------------- >>> --------- >>> >>> (require test-engine/scheme-tests) >>> >>> ;; deltas >>> (check-expect (deltas 0) '()) >>> (check-expect (deltas 1) (list (vector +1) (vector -1))) >>> (check-expect >>> (deltas 2) (list (vector +1 0) (vector -1 0) (vector 0 +1) >>> (vector 0 -1))) >>> >>> ;; v+ >>> (check-expect (v+ #3(2 3 0) #3(-1 0 0)) #3(1 3 0)) >>> >>> ;; L2 >>> (check-expect (L2 #3(2 3 0)) 13) >>> >>> ;; walk: >>> ;; add your favorite test here >>> >>> (test) >>> >>> >>> >>> >>> On May 29, 2009, at 11:08 AM, Marijn Schouten (hkBst) wrote: >>> >>>> Hi, >>>> >>>> I'm trying to write a macro that writes a function that sums the >>>> L2-lengths of >>>> all (random) walks of depth d on a square grid of dimension DIM. In >>>> dimension 2 >>>> that function should look like this: >>>> >>>> >>>> (define (walk depth) >>>> (let step ((d 0) (x 0) (y 0) #;(z 0)) >>>> (cond ((< d depth) >>>> (let ((d+1 (+ d 1))) >>>> (+ >>>> (step d+1 (+ x 1) y) >>>> (+ >>>> (step d+1 (- x 1) y) >>>> (+ (step d+1 x (+ y 1)) >>>> (step d+1 x (- y 1))) )))) >>>> (else >>>> (+ (* x x) (* y y)) ) ))) >>>> >>>> >>>> (walk d) starts at the origin, (x,y) = (0,0), and recursively >>>> walks a >>>> step in >>>> all 2DIM directions, returning the L2-length when depth d is >>>> reached >>>> and summing >>>> all those lengths. It is not hard to prove that (walk depth) is >>>> equal >>>> to (expt >>>> (* 2 (DIM)) depth) but this random walk length summer is only the >>>> starting point >>>> for doing more interesting things. >>>> >>>> I'm looking for a macro that will write the `walk' function >>>> given the >>>> dimension. >>>> >>>> Attached is an attempt that I cannot seem to get working. >>>> >>>> Thanks, >>>> >>>> Marijn >> >> >> >> -- >> If you cannot read my mind, then listen to what I say. >> >> Marijn Schouten (hkBst), Gentoo Lisp project, Gentoo ML >> , #gentoo-{lisp,ml} on FreeNode >> ; $ gsc -prelude "(declare (standard-bindings)(block))" >> randomwalk.scm >> ; $ gsc -prelude "(declare (standard-bindings)(extended-bindings) >> (block)(not safe))" randomwalk.scm >> ; $ gsi randomwalk -e "(time (main 10))" >> >> ; $ time bigloo -load randomwalk.scm -eval "(main 8)(exit)" >> >> ; $ bigloo -Obench randomwalk.bgl -o bigloo-randomwalk >> ; $ time ./bigloo-randomwalk 10 >> >> ; $ mzscheme -e "(define pp pretty-print)" -f randomwalk.scm -e >> "(time (main 10))" >> >> ; $ larceny -- -e "(define pp pretty-print)(compiler-switches >> 'fast-unsafe)(benchmark-block-mode #t)" randomwalk.scm -e "(time >> (main 10))" -e "(quit)" >> >> ; $ gosh -l ./randomwalk.scm -e "(define pp print)" -e "(time >> (main 10))" -e "(exit)" >> >> ; $ scheme48 -a batch <<<$'(define pp (lambda (x) (display x) >> (newline)))(load "randomwalk.scm")\n,time(main 8)' >> >> >> (define (reduce-map/index u r m l) >> (let loop ((l l) (ret u) (i 0)) >> (if (null? l) ret (loop (cdr l) (r (m (car l) i) ret) (+ i 1))))) >> >> (define (reduce-map-right/index u r m l) >> (let loop ((l l) (i 0)) >> (if (null? l) u (r (m (car l) i) (loop (cdr l) (+ i 1)))))) >> >> (define (reduce-map u r m l) >> (reduce-map/index u r (lambda (e i) (m e)) l)) >> ; (let loop ((l l) (ret u)) >> ; (if (null? l) ret (loop (cdr l) (r (m (car l)) ret))))) >> >> (define (map/index m l) >> (reduce-map-right/index '() cons m l)) >> >> (define (squared-L2-norm pos) >> (reduce-map 0 + (lambda (e) (* e e)) pos)) >> >> (define (next-position pos dim step) >> (let ((pos-vector (list->vector pos))) >> (vector-set! pos-vector dim (+ (vector-ref pos-vector dim) step)) >> (vector->list pos-vector))) >> >> (define (next-positions dimension pos) >> (let loop ((dim 0) (dir #t) (ret '())) >> (if (= dim dimension) ret >> (if dir >> (loop dim #f (cons (next-position pos dim -1) ret)) >> (loop (+ dim 1) #t (cons (next-position pos dim +1) ret)) )))) >> >> (define (walk dimension norm) >> (lambda (depth) >> (let step ((d 0) (pos (vector->list (make-vector dimension 0)))) >> (if (< d depth) >> (reduce-map 0 + (lambda (p) (step (+ d 1) p)) (next-positions >> dimension pos)) >> (norm pos) ) ))) >> >> ;;;fast version below >> >> (define (fast-squared-L2-norm-2 x y) >> (+ (* x x) (* y y))) >> >> (define (fast-walk-2 depth) >> (let step ((d 0) (x 0) (y 0) );#;(z 0)) >> (cond ((< d depth) >> (let ((d+1 (+ d 1))) >> (+ (step d+1 (+ x 1) y) >> (+ (step d+1 (- x 1) y) >> (+ (step d+1 x (+ y 1)) >> (step d+1 x (- y 1)) ))))) >> (else >> (fast-squared-L2-norm-2 x y))))) >> >> (define (main depth) >> (pp (/ ((if #f (walk 2 squared-L2-norm) fast-walk-2) depth) >> (expt 4 depth)))) >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From clements at brinckerhoff.org Thu Jun 11 18:40:47 2009 From: clements at brinckerhoff.org (John Clements) Date: Thu Jun 11 18:41:12 2009 Subject: [plt-scheme] How difficult would creating a collaborative multi-user online virtual world application be in PLT Scheme? In-Reply-To: References: Message-ID: <5A441D1B-7941-40AF-8DE5-62C33FB59C03@brinckerhoff.org> On Jun 11, 2009, at 1:30 AM, Benjamin L.Russell wrote: > > Unfortunately, Smalltalk is an object-oriented language. If possible, > I would like to see something similar in a more functional programming > language such as PLT Scheme. It's not my intent to dissuade you from contributing to PLT Scheme, but I would caution you against lumping Smalltalk in with languages like Java and C++; Smalltalk is the "real" OO (cf. Matthias' talk), and includes most of the features you'd expect to find in a functional language. In fact, Smalltalk's syntax for introducing a closure is lighter-weight than Scheme's, and allows a fairly natural-looking if that's a function rather than a special form. Honestly, calling a language "OO" doesn't really mean much, these days (cf. Shriram's "post-linnean" stuff). John Clements -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2484 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090611/992ba896/smime.bin From chust at web.de Thu Jun 11 20:18:29 2009 From: chust at web.de (Thomas Chust) Date: Thu Jun 11 20:18:49 2009 Subject: [plt-scheme] problem using sqlite and web server in combination (empty db file) In-Reply-To: <87566EDE-0EB0-4783-B63C-5E88220EBCCD@gmx.de> References: <87566EDE-0EB0-4783-B63C-5E88220EBCCD@gmx.de> Message-ID: <1c1a33bc0906111718w69f076d1v7724daf5790c0869@mail.gmail.com> Hello Sigrid, I'm not sure whether you are experiencing the same problem as me here, but at least the fact that a new empty database file shows up in an unexpected directory suggests that you may be. I ran into similar difficulties using SQLite3 from PLT Scheme and after some experiments I came to the conclusion that the current working directory as seen from PLT Scheme code is not always identical with the current working directory of the process as seen by the native SQLite3 code. Therefore specifying a relative path to a database file can easily cause SQLite3 to create a new empty database in some unexpected place. If I'm not mistaken, the value of current-directory disagrees with what the C library's getcwd returns as soon as the value of current-directory is parameterized. I would suggest to circumvent the problem by simply specifying an absolute path to the SQLite3 database. An arguably better solution would be to adapt the code in the SQLite3 binding you are using to automatically convert paths to an absolute form before they are passed to the native sqlite3_open call. cu, Thomas From DekuDekuplex at Yahoo.com Fri Jun 12 00:38:18 2009 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Fri Jun 12 00:39:04 2009 Subject: [plt-scheme] Re: How difficult would creating a collaborative multi-user online virtual world application be in PLT Scheme? References: <5A441D1B-7941-40AF-8DE5-62C33FB59C03@brinckerhoff.org> Message-ID: <9fl335pp1jr99hk2pmb66m2i0bfut63hd7@4ax.com> On Thu, 11 Jun 2009 15:40:47 -0700, John Clements wrote: > >On Jun 11, 2009, at 1:30 AM, Benjamin L.Russell wrote: > >> >> Unfortunately, Smalltalk is an object-oriented language. If possible, >> I would like to see something similar in a more functional programming >> language such as PLT Scheme. > >It's not my intent to dissuade you from contributing to PLT Scheme, >but I would caution you against lumping Smalltalk in with languages >like Java and C++; Smalltalk is the "real" OO (cf. Matthias' talk), >and includes most of the features you'd expect to find in a functional >language. In fact, Smalltalk's syntax for introducing a closure is >lighter-weight than Scheme's, and allows a fairly natural-looking if >that's a function rather than a special form. Honestly, calling a >language "OO" doesn't really mean much, these days (cf. Shriram's >"post-linnean" stuff). Actually, I never "lump[ed] Smalltalk in with languages like Java and C++"; in fact, if you read my post "Re: A question regarding a thesis.," dated "Wed, 10 Jun 2009 21:35:17 +0900," on comp.lang.functional (see http://groups.google.co.jp/group/comp.lang.functional/msg/934bbd4d6d550171), you will see that I have specifically distinguished between Smalltalk and such languages as Java and C++; _viz._: >[S]ome languages (such as Smalltalk >and Ruby) are pure object-oriented languages, whereas other languages >that claim to be "object-oriented," such as Java and C++, are really >procedural with some object-oriented features (see under the section >"Some Real Life Examples" in "What is Object-Oriented Software? An >Introduction" (http://www.softwaredesign.com/objects.html) for a more >detailed explanation of this difference). Rather, my concern comes from the fact that, being more used to thinking functionally than in an object-oriented manner, functional programming lies more in my comfort zone. The idea of a "comfort zone" for functional programming is perhaps best expressed by Paul Hudak in the following portion of his post regarding another functional programming language, Haskell, in his following post, entitled "a regressive view of support for imperative programming in Haskell," dated "Wed Aug 8 14:20:39 EDT 2007," on the Haskell-Cafe mailing list, as follows (see http://www.haskell.org/pipermail/haskell-cafe/2007-August/030178.html): >Functions are in my comfort zone; syntax that hides them takes me out of >my comfort zone. > >[...] > >Well, you could argue, monad syntax is what really made Haskell become >more accepted by the masses, and you may be right (although perhaps >Simon's extraordinary performance at OSCOM is more of what we need). On >the other hand, if we give imperative programmers the tools to do all >the things they are used to doing in C++, then we will be depriving them >of the joys of programming in the Functional Way. How many times have >we seen responses to newbie posts along the lines of, "That's how you'd >do it in C++, but in Haskell here's a better way...". This issue is not specific to Haskell, but common to other functional (and semi-functional) programming languages as well. It relates to being used to thinking in a particular paradigm (even though some may argue that paradigms in general are silly and meaningless, that issue is separate from the issue of being used to thinking in one). Smalltalk, as a pure object-oriented language, indeed has certain advantages over impure object-oriented languages, such as Java or C++, but it usually takes more time for a functional programmer who is used to thinking in purely functional concepts to learn to think in object-oriented concepts (even pure ones) than to learn a different functional programming language using functional concepts. Hence my search for a suitable language that would not require learning a different paradigm. -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ From mmrasheed at gmail.com Fri Jun 12 01:47:31 2009 From: mmrasheed at gmail.com (MD.MAHBUBUR RASHEED) Date: Fri Jun 12 01:53:27 2009 Subject: [plt-scheme] (newbie question) About Loop Message-ID: Hi,How can I implement loop in plt-scheme like in java- for(int i=0;i<10;){ for(int j=0;j<3;){ System.out.println(""+j); j++; } System.out.println(""+i); i++; } Thanks in advance. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090612/1633959c/attachment.html From rafkind at cs.utah.edu Fri Jun 12 02:00:09 2009 From: rafkind at cs.utah.edu (Jon Rafkind) Date: Fri Jun 12 02:00:32 2009 Subject: [plt-scheme] (newbie question) About Loop In-Reply-To: References: Message-ID: <4A31EEE9.1080104@cs.utah.edu> MD.MAHBUBUR RASHEED wrote: > Hi, > How can I implement loop in plt-scheme like in java- > > for(int i=0;i<10;){ > for(int j=0;j<3;){ > System.out.println(""+j); > j++; > } > System.out.println(""+i); > i++; > } > (for-each (lambda (i) (for-each (lambda (j) (printf "~a\n" j)) (build-list 3 (lambda (x) x))) (printf "~a\n" i)) (build-list 10 (lambda (x) x))) From mmrasheed at gmail.com Fri Jun 12 02:05:42 2009 From: mmrasheed at gmail.com (Captain___nemo) Date: Fri Jun 12 02:06:03 2009 Subject: [plt-scheme] Re: (newbie question) About Loop In-Reply-To: <4A31EEE9.1080104@cs.utah.edu> References: <4A31EEE9.1080104@cs.utah.edu> Message-ID: Thanks a lot :) Won't it be inefficient building list for large values (say thousands instead of 10)? Isn't there any direct loop syntax in Scheme? On Jun 12, 12:00?pm, Jon Rafkind wrote: > MD.MAHBUBUR RASHEED wrote: > > Hi, > > How can I implement loop in ?plt-scheme like in java- > > > for(int i=0;i<10;){ > > ? ? ?for(int j=0;j<3;){ > > ? ? ? ? ? System.out.println(""+j); > > ? ? ? ? ? j++; > > ? ? ?} > > ? ? ? System.out.println(""+i); > > ? ? ? i++; > > } > > (for-each (lambda (i) > ? ? ? ? ? ? ? ? ? (for-each (lambda (j) (printf "~a\n" j)) (build-list 3 > (lambda (x) x))) > ? ? ? ? ? ? ? ? ? (printf "~a\n" i)) > ? ? ? ? ? ? ? ? (build-list 10 (lambda (x) x))) > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From rafkind at cs.utah.edu Fri Jun 12 02:09:26 2009 From: rafkind at cs.utah.edu (Jon Rafkind) Date: Fri Jun 12 02:09:47 2009 Subject: [plt-scheme] Re: (newbie question) About Loop In-Reply-To: References: <4A31EEE9.1080104@cs.utah.edu> Message-ID: <4A31F116.6060009@cs.utah.edu> Captain___nemo wrote: > Thanks a lot :) > > Won't it be inefficient building list for large values (say thousands > instead of 10)? Isn't there any direct loop syntax in Scheme? > > Oh yea I guess you can use the for stuff that I keep forgetting about. (for ((i (in-range 0 10))) (for ((j (in-range 0 3))) (printf "~a\n" j)) (printf "~a\n" i)) From noelwelsh at gmail.com Fri Jun 12 02:10:33 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri Jun 12 02:10:52 2009 Subject: [plt-scheme] Re: (newbie question) About Loop In-Reply-To: References: <4A31EEE9.1080104@cs.utah.edu> Message-ID: On Fri, Jun 12, 2009 at 7:05 AM, Captain___nemo wrote: > Thanks a lot :) > > Won't it be inefficient building list for large values (say thousands > instead of 10)? Isn't there any direct loop syntax in Scheme? In PLT there are for comprehensions: (for ([i (in-range 10)]) ...) However, it is almost always bad style to use loops like you would in Java. Functional programmers think of expressions creating values, whereas Java's loops are fundamentally imperative. So rather than a for comprehension, I would expect someone to use for/list or another value returning comprehension. N. From noelwelsh at gmail.com Fri Jun 12 02:13:36 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri Jun 12 02:13:55 2009 Subject: [plt-scheme] problem using sqlite and web server in combination (empty db file) In-Reply-To: <1c1a33bc0906111718w69f076d1v7724daf5790c0869@mail.gmail.com> References: <87566EDE-0EB0-4783-B63C-5E88220EBCCD@gmx.de> <1c1a33bc0906111718w69f076d1v7724daf5790c0869@mail.gmail.com> Message-ID: On Fri, Jun 12, 2009 at 1:18 AM, Thomas Chust wrote: > I would suggest to circumvent the problem by simply specifying an > absolute path to the SQLite3 database. Use define-runtime-path to get a path that is relative to the file defining it. N. From keydana at gmx.de Fri Jun 12 05:49:04 2009 From: keydana at gmx.de (keydana@gmx.de) Date: Fri Jun 12 05:49:26 2009 Subject: [plt-scheme] problem using sqlite and web server in combination (empty db file) In-Reply-To: <1c1a33bc0906111718w69f076d1v7724daf5790c0869@mail.gmail.com> References: <87566EDE-0EB0-4783-B63C-5E88220EBCCD@gmx.de> <1c1a33bc0906111718w69f076d1v7724daf5790c0869@mail.gmail.com> Message-ID: Hi Thomas, hi Noel, thanks a lot for your answers. Seems I was totally wrong to think the problem had to do with the web server's behaviour itself - thanks for sharing the analysis of the problem! Using define-runtime-path it works fine now - I deleted the empty file and after a modification to the code, it was not created again. So thanks again for the quick help, Sigrid Am 12.06.2009 um 02:18 schrieb Thomas Chust: > Hello Sigrid, > > I'm not sure whether you are experiencing the same problem as me here, > but at least the fact that a new empty database file shows up in an > unexpected directory suggests that you may be. > > I ran into similar difficulties using SQLite3 from PLT Scheme and > after some experiments I came to the conclusion that the current > working directory as seen from PLT Scheme code is not always identical > with the current working directory of the process as seen by the > native SQLite3 code. Therefore specifying a relative path to a > database file can easily cause SQLite3 to create a new empty database > in some unexpected place. If I'm not mistaken, the value of > current-directory disagrees with what the C library's getcwd returns > as soon as the value of current-directory is parameterized. > > I would suggest to circumvent the problem by simply specifying an > absolute path to the SQLite3 database. > > An arguably better solution would be to adapt the code in the SQLite3 > binding you are using to automatically convert paths to an absolute > form before they are passed to the native sqlite3_open call. > > cu, > Thomas From lordgeoffrey at optushome.com.au Fri Jun 12 06:46:15 2009 From: lordgeoffrey at optushome.com.au (LordGeoffrey) Date: Fri Jun 12 06:53:11 2009 Subject: [plt-scheme] nested mutable lists in R6RS Message-ID: <4A3231F7.7000509@optushome.com.au> Is it possible to have nested mutable lists in R6RS? I ask because i have a nested list structure and i want to change the occasional value in the list, and possibly even restructure the tree. As part of that i like using find-tail and other common list functions. I assume i am merely including the wrong combination of libraries. Any advice? Thanks. From noelwelsh at gmail.com Fri Jun 12 07:11:49 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri Jun 12 07:12:08 2009 Subject: [plt-scheme] nested mutable lists in R6RS In-Reply-To: <4A3231F7.7000509@optushome.com.au> References: <4A3231F7.7000509@optushome.com.au> Message-ID: On Fri, Jun 12, 2009 at 11:46 AM, LordGeoffrey wrote: > Is it possible to have nested mutable lists in R6RS? Yes, a list can contain any value, including another list. > I ask because i have a nested list structure and i want to change the > occasional value in the list, and possibly even restructure the tree. > > As part of that i like using find-tail and other common list functions. > I assume i am merely including the wrong combination of libraries. > > Any advice? You don't actually mention any issues you're having, so I can't really say more. N. From lordgeoffrey at optushome.com.au Fri Jun 12 07:23:09 2009 From: lordgeoffrey at optushome.com.au (LordGeoffrey) Date: Fri Jun 12 07:23:32 2009 Subject: [plt-scheme] nested mutable lists in R6RS In-Reply-To: References: <4A3231F7.7000509@optushome.com.au> Message-ID: <4A323A9D.3090202@optushome.com.au> My pardon, i cant get mutable lists, srfi-1 and R6RS to execute in one file. I cant use mxxx procs on lists that srfi-1 will operate on. Noel Welsh wrote: > On Fri, Jun 12, 2009 at 11:46 AM, > LordGeoffrey wrote: > >> Is it possible to have nested mutable lists in R6RS? >> > > Yes, a list can contain any value, including another list. > > >> I ask because i have a nested list structure and i want to change the >> occasional value in the list, and possibly even restructure the tree. >> >> As part of that i like using find-tail and other common list functions. >> I assume i am merely including the wrong combination of libraries. >> >> Any advice? >> > > You don't actually mention any issues you're having, so I can't really say more. > > N. > > From beratn at gmail.com Fri Jun 12 07:21:30 2009 From: beratn at gmail.com (=?ISO-8859-9?Q?emre_berat_nebio=F0lu?=) Date: Fri Jun 12 07:27:45 2009 Subject: [plt-scheme] Re: (newbie question) About Loop In-Reply-To: References: <4A31EEE9.1080104@cs.utah.edu> Message-ID: Can we use while or do while in drscheme.Just i wonder.I mean that While(list != null) list=list.cdr On Fri, Jun 12, 2009 at 9:10 AM, Noel Welsh wrote: > On Fri, Jun 12, 2009 at 7:05 AM, Captain___nemo > wrote: > > Thanks a lot :) > > > > Won't it be inefficient building list for large values (say thousands > > instead of 10)? Isn't there any direct loop syntax in Scheme? > > In PLT there are for comprehensions: > > (for ([i (in-range 10)]) ...) > > However, it is almost always bad style to use loops like you would in > Java. Functional programmers think of expressions creating values, > whereas Java's loops are fundamentally imperative. So rather than a > for comprehension, I would expect someone to use for/list or another > value returning comprehension. > > N. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090612/80a507ea/attachment.htm From lordgeoffrey at optushome.com.au Fri Jun 12 07:34:22 2009 From: lordgeoffrey at optushome.com.au (LordGeoffrey) Date: Fri Jun 12 07:34:51 2009 Subject: [plt-scheme] nested mutable lists in R6RS In-Reply-To: <4A323A9D.3090202@optushome.com.au> References: <4A3231F7.7000509@optushome.com.au> <4A323A9D.3090202@optushome.com.au> Message-ID: <4A323D3E.3090909@optushome.com.au> I am working with the following, and uncommenting no difference (module cars scheme ; (require scheme/mpair) ; (require rnrs/mutable-pairs-6) (define x '(1 2 3)) ; (set-car! x (cddr x)) ; (set-mcar! x (cddr x)) ) LordGeoffrey wrote: > My pardon, i cant get mutable lists, srfi-1 and R6RS to execute in > one file. > I cant use mxxx procs on lists that srfi-1 will operate on. > > > Noel Welsh wrote: >> On Fri, Jun 12, 2009 at 11:46 AM, >> LordGeoffrey wrote: >> >>> Is it possible to have nested mutable lists in R6RS? >>> >> >> Yes, a list can contain any value, including another list. >> >> >>> I ask because i have a nested list structure and i want to change the >>> occasional value in the list, and possibly even restructure the tree. >>> >>> As part of that i like using find-tail and other common list functions. >>> I assume i am merely including the wrong combination of libraries. >>> >>> Any advice? >>> >> >> You don't actually mention any issues you're having, so I can't >> really say more. >> >> N. >> >> > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From matthias at ccs.neu.edu Fri Jun 12 07:37:20 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Fri Jun 12 07:37:52 2009 Subject: [plt-scheme] Re: (newbie question) About Loop In-Reply-To: References: <4A31EEE9.1080104@cs.utah.edu> Message-ID: Why would you want to use while in Scheme? You might as well use Java then :-) On Jun 12, 2009, at 7:21 AM, emre berat nebio?lu wrote: > Can we use while or do while in drscheme.Just i wonder.I mean that > > While(list != null) > list=list.cdr > > On Fri, Jun 12, 2009 at 9:10 AM, Noel Welsh > wrote: > On Fri, Jun 12, 2009 at 7:05 AM, > Captain___nemo wrote: > > Thanks a lot :) > > > > Won't it be inefficient building list for large values (say > thousands > > instead of 10)? Isn't there any direct loop syntax in Scheme? > > In PLT there are for comprehensions: > > (for ([i (in-range 10)]) ...) > > However, it is almost always bad style to use loops like you would in > Java. Functional programmers think of expressions creating values, > whereas Java's loops are fundamentally imperative. So rather than a > for comprehension, I would expect someone to use for/list or another > value returning comprehension. > > N. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090612/547202f2/attachment.html From pocmatos at gmail.com Fri Jun 12 07:39:24 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Fri Jun 12 07:40:06 2009 Subject: [plt-scheme] Re: (newbie question) About Loop In-Reply-To: References: <4A31EEE9.1080104@cs.utah.edu> Message-ID: <11b141710906120439m645db157gb9dd7774228c1a63@mail.gmail.com> On Fri, Jun 12, 2009 at 12:21 PM, emre berat nebio?lu wrote: > Can we use while or do while in drscheme.Just i wonder.I mean that > > While(list != null) > ???? list=list.cdr > (let loop ([lst list]) (if (null? lst) ... (loop (rest lst)))) this is my usual thing... no loops in 'your' sense of loop! > On Fri, Jun 12, 2009 at 9:10 AM, Noel Welsh wrote: >> >> On Fri, Jun 12, 2009 at 7:05 AM, Captain___nemo >> wrote: >> > Thanks a lot :) >> > >> > Won't it be inefficient building list for large values (say thousands >> > instead of 10)? Isn't there any direct loop syntax in Scheme? >> >> In PLT there are for comprehensions: >> >> (for ([i (in-range 10)]) ...) >> >> However, it is almost always bad style to use loops like you would in >> Java. Functional programmers think of expressions creating values, >> whereas Java's loops are fundamentally imperative. So rather than a >> for comprehension, I would expect someone to use for/list or another >> value returning comprehension. >> >> N. >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From sbloch at adelphi.edu Fri Jun 12 07:50:26 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Fri Jun 12 07:51:23 2009 Subject: [BULK] Re: [plt-scheme] Re: (newbie question) About Loop In-Reply-To: References: <4A31EEE9.1080104@cs.utah.edu> Message-ID: <0F79225D-73DB-413F-BA15-86A0E78DDD09@adelphi.edu> On Jun 12, 2009, at 7:21, emre berat nebio?lu wrote: > Can we use while or do while in drscheme.Just i wonder.I mean that > > While(list != null) > list=list.cdr There are ways to do that, but if you start with "I want to write a for-loop or a while-loop; what is the Scheme syntax for it?", you won't end up with a Scheme program, but rather a C program in Scheme syntax. Sort of like putting a passage of Shakespeare through Babelfish and translating each individual word into Russian. To get used to the Scheme "way", pretend for a moment there were no assignment statement in your favorite language (Java, C++, whatever): you can declare a variable with an initial value, but you can't change the value of an existing variable. Loops wouldn't work any more, because they rely on some variable taking on a different value each time through the loop... but conditionals and function calls would work just fine, so the natural analogue to the loops you're used to would be recursion. After a few days or weeks of programming that way, recursion would come easily to you, and you would wonder why anybody bothers with while-loops :-) A little later, you might get frustrated at writing the same recursive structure over and over, and you would learn about higher-order functions and comprehensions, which are far more powerful and flexible than while-loops, and you would start to pity people who are forced to live in a world of while-loops. Scheme DOES have assignment, but I don't teach it to my beginning programming students until they've seen these other techniques. Steve Bloch From sk at cs.brown.edu Fri Jun 12 08:36:11 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Fri Jun 12 08:36:49 2009 Subject: [plt-scheme] Re: How difficult would creating a collaborative multi-user online virtual world application be in PLT Scheme? In-Reply-To: <9fl335pp1jr99hk2pmb66m2i0bfut63hd7@4ax.com> References: <5A441D1B-7941-40AF-8DE5-62C33FB59C03@brinckerhoff.org> <9fl335pp1jr99hk2pmb66m2i0bfut63hd7@4ax.com> Message-ID: Benjamin, We (well, I) don't have an archive of all your posts in our (my) head --and frankly, your posting history on this is beside the point. John's point stands about Smalltalk. And his bigger but subtler point (his "post-linnaean" remark) seems to have slid by you entirely as you composed your spirited defense, which ends in the same tone that John was trying to correct. Shriram From matthias at ccs.neu.edu Fri Jun 12 08:40:54 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Fri Jun 12 08:41:35 2009 Subject: [plt-scheme] Re: (newbie question) About Loop In-Reply-To: References: <4A31EEE9.1080104@cs.utah.edu> Message-ID: <855AC4B1-D4A7-4046-8EAD-D7EEA64C2605@ccs.neu.edu> Of course: #lang scheme (define-syntax-rule (while tst {body ...}) (let L () (when tst body ... (L)))) (define-syntax-rule (:= lhs rhs) (set! lhs rhs)) (define ! not) ;; --- (define l (mcons 1 null)) (while (! (null? l)) { (printf "~s\n" (mcar l)) ; (:= l (mcdr l)) }) On Jun 12, 2009, at 7:57 AM, emre berat nebio?lu wrote: > I just wonder someone This is possible.Thats it :D > > On Fri, Jun 12, 2009 at 2:37 PM, Matthias Felleisen > wrote: > > Why would you want to use while in Scheme? You might as well use > Java then :-) > > > > > On Jun 12, 2009, at 7:21 AM, emre berat nebio?lu wrote: > >> Can we use while or do while in drscheme.Just i wonder.I mean that >> >> While(list != null) >> list=list.cdr >> >> On Fri, Jun 12, 2009 at 9:10 AM, Noel Welsh >> wrote: >> On Fri, Jun 12, 2009 at 7:05 AM, >> Captain___nemo wrote: >> > Thanks a lot :) >> > >> > Won't it be inefficient building list for large values (say >> thousands >> > instead of 10)? Isn't there any direct loop syntax in Scheme? >> >> In PLT there are for comprehensions: >> >> (for ([i (in-range 10)]) ...) >> >> However, it is almost always bad style to use loops like you would in >> Java. Functional programmers think of expressions creating values, >> whereas Java's loops are fundamentally imperative. So rather than a >> for comprehension, I would expect someone to use for/list or another >> value returning comprehension. >> >> N. >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090612/34f8eeda/attachment.htm From noelwelsh at gmail.com Fri Jun 12 09:28:57 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri Jun 12 09:29:18 2009 Subject: [plt-scheme] Re: How difficult would creating a collaborative multi-user online virtual world application be in PLT Scheme? In-Reply-To: References: Message-ID: On Thu, Jun 11, 2009 at 12:12 PM, Benjamin L.Russell wrote: > Well, I'm basically looking for that kind of collaboration. > > Distributed collaborative editing might be useful, but it isn't nearly > so fun. OK, here's how I'd do it: - Define a virtual machine with a bunch of instructions specific to what you want to do (e.g. 3D modelling primitives, gestures, or whatever) - Make the instructions serialisable - Squirt instructions across the network to communicate between machines This is kinda special case of serialising continuations, so you might be able to leverage the web server's support for this to get this project going in a hurry. All up it would be relatively simple to get a prototype of this going. Perhaps a day's work? There is good support in PLT for restricting evaluation (e.g. the sandbox) so you would be able to reuse large parts of the PLT runtime and not worry about security etc. N. From morazanm at gmail.com Fri Jun 12 09:30:49 2009 From: morazanm at gmail.com (Marco Morazan) Date: Fri Jun 12 09:38:43 2009 Subject: [plt-scheme] HTDP Excercise 14.1.5 In-Reply-To: <73045cca0906111107h4228a68br1aadd0996b904e99@mail.gmail.com> References: <73045cca0906111107h4228a68br1aadd0996b904e99@mail.gmail.com> Message-ID: <9b1fff280906120630k656c5efbu671910f3a75689d0@mail.gmail.com> Let's take a look: ;Purpose : This function takes a family tree node and constructs an eye-color ; list for that node ( eye-color) can occur more. (define eye-color (lambda (ftn) (cond [(empty? ftn) empty] [else (append (list(child-eyes ftn)) (list(eye-color(child-father ftn))) (list(eye-color(child-mother ftn))))]))) Now, let's look at the result obtained from one of your examples: > (eye-color Gustav) (brown (pink () ()) (blue (green () ()) (green () ()))) > That is *not* a list of eye-color. You need the answer to be (brown pink blue green green). Your job is not done yet (although you are very close to the solution). > My question here is :In the question it is asked to use append , and I am > appending lists with each other.Is this the right solution ? Also I think > cons could have been used to construct a single list for a particulat > family-tree-node then why to use append.? No, you can not use cons. Go ahead. Change append for cons. What result do you get? Why? Go to the help desk and look at the contracts for append and cons. You should be able to determine when you need to use one or another. -- Cheers, Marco From grettke at acm.org Fri Jun 12 12:06:26 2009 From: grettke at acm.org (Grant Rettke) Date: Fri Jun 12 12:06:45 2009 Subject: [plt-scheme] Re: How difficult would creating a collaborative multi-user online virtual world application be in PLT Scheme? In-Reply-To: References: <5A441D1B-7941-40AF-8DE5-62C33FB59C03@brinckerhoff.org> <9fl335pp1jr99hk2pmb66m2i0bfut63hd7@4ax.com> Message-ID: <756daca50906120906i6922583em77dfb4886c586fce@mail.gmail.com> On Fri, Jun 12, 2009 at 7:36 AM, Shriram Krishnamurthi wrote: > which ends in the same tone that John was trying to correct. What is the post-linnaean tone and how does it apply here? Or should one just read the paper? From npt11tpn at googlemail.com Thu Jun 11 04:10:26 2009 From: npt11tpn at googlemail.com (N T) Date: Fri Jun 12 13:42:24 2009 Subject: [plt-scheme] Re: Load and require in PLT In-Reply-To: <18992.10889.612543.583530@winooski.ccs.neu.edu> References: <736557E5-029F-4FBE-872A-ED78FA7DEE06@ccs.neu.edu> <18992.10889.612543.583530@winooski.ccs.neu.edu> Message-ID: mzscheme -r test.ss indeed works! Had #lang scheme in test.ss which caused: /test.ss:5:10: compile: unbound identifier in module in: x Thank you very much for your suggestions! parameters.ss is a user-options input file which is specific for each run of test.ss and thought it would be simpler if used with load (i.e. just (define x 1) etc) rather than as a module, but perhaps this is not true ... Nik On Jun 10, 10:50?pm, Eli Barzilay wrote: > Looks like the problem might be due to using `mzscheme ' instead > of `mzscheme -r '. ?(But a better solution is to dump the `load' > stuff, and use modules.) > > On Jun 10, Matthias Felleisen wrote: > > > > > > > I used this load trick in script that has minimally evolved since ? > > 1995 when I first wrote it. What's the problem? Looks fine. > > > On Jun 10, 2009, at 10:24 AM, N T wrote: > > > > Hi guys, > > > I am trying to find an equivalent way to run the following test.scm > > > script with mzscheme. > > > I would like to to keep s as a variable, so that it could be passed as > > > a command-line argument. > > > (require "parameters.scm") works in mzscheme while (require s) does > > > not. From what i gathered from reading the plt archives using units > > > could be the way to do it ... > > > Help will be very much appreciated! > > > Nik > > > > csi test.scm > > > > ;; test.scm > > > (define s "parameters.scm") > > > (load s) > > > (display ?x) > > > > ;; parameters.scm > > > (define x 1) > > > _________________________________________________ > > > ? For list-related administrative tasks: > > > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > > _________________________________________________ > > ? For list-related administrative tasks: > > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -- > ? ? ? ? ? ((lambda (x) (x x)) (lambda (x) (x x))) ? ? ? ? ?Eli Barzilay: > ? ? ? ? ? ? ? ? ?http://www.barzilay.org/? ? ? ? ? ? ? ? Maze is Life! > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From dhurtt at sprintmail.com Fri Jun 12 00:00:51 2009 From: dhurtt at sprintmail.com (Dale Hurtt) Date: Fri Jun 12 13:42:33 2009 Subject: [plt-scheme] Re: How difficult would creating a collaborative multi-user online virtual world application be in PLT Scheme? In-Reply-To: References: Message-ID: <61d00a10-f649-4472-a810-c78c29e741bf@k2g2000yql.googlegroups.com> On Jun 11, 2:59?am, Noel Welsh wrote: > The big problem would, I expect, be serialising data from one machine > to another. Not every value in PLT Scheme can be serialised. > Functions, I think, are the prime example. Interesting that you mention that. I was just reading about newLISP (http://www.newlisp.org/) and one of the features with the language is that functions are first class lists. I was wondering about the value of that feature and it sounds like you just answered it. Not a reason necessarily to give up the ghost on Scheme, but it helps me understand the benefits of the feature. Dale From ebzzry at gmail.com Fri Jun 12 14:53:03 2009 From: ebzzry at gmail.com (Rommel Martinez) Date: Fri Jun 12 15:23:05 2009 Subject: [plt-scheme] Movable tabs Message-ID: <391934950906121153v26214111q4632c73df2db71a9@mail.gmail.com> Is the idea of movable tabs in DrScheme reasonable? In this context, "movable" would mean something like the DND operations of an application like Firefox to reorganize the tabs. If yes, would this qualify as a feature request? Is it difficult to implement? Would it mean breaking a lot of things? Would the toolkit being used by DrScheme allow such operations? -- Rommel M. Martinez http://www.bespin.org/~ebzzry From benjisimon at gmail.com Fri Jun 12 15:19:22 2009 From: benjisimon at gmail.com (Ben Simon) Date: Fri Jun 12 15:27:40 2009 Subject: [plt-scheme] Scripting Excel with MysterX Message-ID: Howdy all, I've got a project coming up that looks like it's going to require me to write some VB code in Excel. That is, unless I can put together a Scheme solution first :-). I've made some progress with MysterX and scripting excel by following the example here: http://www.perlmonks.org/index.pl?node_id=153486 Here's what I have so far: (require mysterx) (let* ([excel (com-get-active-object-from-coclass "Microsoft Office Excel Application")] [book (com-invoke (com-get-property excel "Workbooks") "Add")]) (com-get-property book "Worksheets")) What I'm stuck on, is that I believe Worksheets is an associative array, and I'm trying to get a hold of Sheet1. Or, as they say in perl: my $Sheet = $Book->Worksheets("Sheet1"); I can get the value of the Worksheets property, but I can't index into it. Essentially, I'm asking the same question raised here: http://tinyurl.com/mmuffa - as next I need to figure out how to access ranges and other goodies. Thanks for the help - and an especially big thanks if you get me out of coding in VB ;-) -Ben -- Have an idea for software? I can make it happen - http://www.ideas2executables.com My Blog: http://benjisimon.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090612/5ed3afa8/attachment.html From namekuseijin at gmail.com Fri Jun 12 15:28:33 2009 From: namekuseijin at gmail.com (namekuseijin) Date: Fri Jun 12 15:34:24 2009 Subject: [plt-scheme] (newbie question) About Loop In-Reply-To: References: Message-ID: <67d0527e0906121228u62d56aa8qa9ae3d2607fee33c@mail.gmail.com> On Fri, Jun 12, 2009 at 2:47 AM, MD.MAHBUBUR RASHEED wrote: > Hi, > How can I implement?loop in ?plt-scheme like in java- > > for(int i=0;i<10;){ > ?? ? for(int j=0;j<3;){ > ?? ? ? ? ?System.out.println(""+j); > ?? ? ? ? ?j++; > ?? ? } > ?? ? ?System.out.println(""+i); > ?? ? ?i++; > } straightforward, standard and with no intermediary list building: (do ((i 0 (+ 1 i))) ((>= i 10)) (do ((j 0 (+ 1 j))) ((>= j 3)) (display j)(newline)) (display i)(newline)) do construct is: (do (inits ...) (stop? optional-final-exp) optional-expressions ...) where one init is (var initial-value update-expression) as in RNRS... From d.j.gurnell at gmail.com Fri Jun 12 15:38:43 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Fri Jun 12 15:46:36 2009 Subject: [plt-scheme] Movable tabs In-Reply-To: <391934950906121153v26214111q4632c73df2db71a9@mail.gmail.com> References: <391934950906121153v26214111q4632c73df2db71a9@mail.gmail.com> Message-ID: <2C981F04-5DA2-496E-A468-5EFD222C90E7@gmail.com> +1. This would be a killer feature. Rommel M. Martinez wrote: > Is the idea of movable tabs in DrScheme reasonable? In this context, > "movable" would mean something like the DND operations of an > application like Firefox to reorganize the tabs. > > If yes, would this qualify as a feature request? Is it difficult to > implement? Would it mean breaking a lot of things? Would the toolkit > being used by DrScheme allow such operations? From grettke at acm.org Fri Jun 12 15:49:34 2009 From: grettke at acm.org (Grant Rettke) Date: Fri Jun 12 15:49:57 2009 Subject: [plt-scheme] Movable tabs In-Reply-To: <391934950906121153v26214111q4632c73df2db71a9@mail.gmail.com> References: <391934950906121153v26214111q4632c73df2db71a9@mail.gmail.com> Message-ID: <756daca50906121249i83d3205mf163606623cde7f4@mail.gmail.com> On Fri, Jun 12, 2009 at 1:53 PM, Rommel Martinez wrote: > Is the idea of movable tabs in DrScheme reasonable? In this context, > "movable" would mean something like the DND operations of an > application like Firefox to reorganize the tabs. That is a nice feature. From a.rottmann at gmx.at Fri Jun 12 15:54:56 2009 From: a.rottmann at gmx.at (Andreas Rottmann) Date: Fri Jun 12 15:55:20 2009 Subject: [plt-scheme] nested mutable lists in R6RS In-Reply-To: <4A323A9D.3090202@optushome.com.au> (lordgeoffrey@optushome.com.au's message of "Fri, 12 Jun 2009 21:23:09 +1000") References: <4A3231F7.7000509@optushome.com.au> <4A323A9D.3090202@optushome.com.au> Message-ID: <87vdn1ut0v.fsf@delenn.lan> LordGeoffrey writes: > My pardon, i cant get mutable lists, srfi-1 and R6RS to execute in > one file. > I cant use mxxx procs on lists that srfi-1 will operate on. > Yeah, the implementation of SRFI-1 shipped with PLT is incompatible with both R5RS *and* R6RS, both of which assume mutable lists. Regards, Rotty From neil at neilvandyke.org Fri Jun 12 15:56:40 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Fri Jun 12 15:57:16 2009 Subject: [plt-scheme] (newbie question) About Loop In-Reply-To: <67d0527e0906121228u62d56aa8qa9ae3d2607fee33c@mail.gmail.com> References: <67d0527e0906121228u62d56aa8qa9ae3d2607fee33c@mail.gmail.com> Message-ID: <4A32B2F8.3000507@neilvandyke.org> > straightforward, standard and with no intermediary list building: > > (do ((i 0 (+ 1 i))) > "do" is standard for now, but I dream that we will someday right that wrong. "do" is a cryptic bit of syntactic sugar that gets in the way of refining functional algorithms. Instead of "do", I suggest using named-"let" unless "map", "for-each", folds, etc. fit the problem naturally. I think that the benefit of avoiding "do" will be more obvious when writing idiomatic Scheme code for problems that actually occur in nature, not contrived exercises (like, e.g., "do this 7 times for no particular reason and with no data being processed"). -- http://www.neilvandyke.org/ From namekuseijin at gmail.com Fri Jun 12 16:47:14 2009 From: namekuseijin at gmail.com (namekuseijin) Date: Fri Jun 12 16:47:35 2009 Subject: [plt-scheme] (newbie question) About Loop In-Reply-To: <67d0527e0906121346y2f641a0bq88fc721c5a3aa4ab@mail.gmail.com> References: <67d0527e0906121228u62d56aa8qa9ae3d2607fee33c@mail.gmail.com> <4A32B2F8.3000507@neilvandyke.org> <67d0527e0906121346y2f641a0bq88fc721c5a3aa4ab@mail.gmail.com> Message-ID: <67d0527e0906121347m32a3b1aej5d2826e1dfc226e7@mail.gmail.com> I've seen this discussion before... http://groups.google.com/group/comp.lang.scheme/msg/e3643edd67abf508 On Fri, Jun 12, 2009 at 4:56 PM, Neil Van Dyke wrote: > >> straightforward, standard and with no intermediary list building: >> >> (do ((i 0 (+ 1 i))) >> > > "do" is standard for now, but I dream that we will someday right that wrong. > ?"do" is a cryptic bit of syntactic sugar that gets in the way of refining > functional algorithms. > > Instead of "do", I suggest using named-"let" unless "map", "for-each", > folds, etc. fit the problem naturally. Fact is: ?do *is* named let, only more convenient and a bit more limited. > I think that the benefit of avoiding "do" will be more obvious when writing > idiomatic Scheme code for problems that actually occur in nature, not > contrived exercises (like, e.g., "do this 7 times for no particular reason > and with no data being processed"). The guy wanted a simple loop and simple loops are pretty common in everyday programming. ?do fits the bill just nicely and without fuss, rather than requiring him to manually name a loop and explicitly call it recursively. ?I hope that right is not wronged. :) From noelwelsh at gmail.com Fri Jun 12 17:03:09 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri Jun 12 17:03:29 2009 Subject: [plt-scheme] (newbie question) About Loop In-Reply-To: <67d0527e0906121347m32a3b1aej5d2826e1dfc226e7@mail.gmail.com> References: <67d0527e0906121228u62d56aa8qa9ae3d2607fee33c@mail.gmail.com> <4A32B2F8.3000507@neilvandyke.org> <67d0527e0906121346y2f641a0bq88fc721c5a3aa4ab@mail.gmail.com> <67d0527e0906121347m32a3b1aej5d2826e1dfc226e7@mail.gmail.com> Message-ID: On Fri, Jun 12, 2009 at 9:47 PM, namekuseijin wrote: > On Fri, Jun 12, 2009 at 4:56 PM, Neil Van Dyke wrote: >> "do" is standard for now, but I dream that we will someday right that wrong. >> ?"do" is a cryptic bit of syntactic sugar that gets in the way of refining >> functional algorithms. >> >> Instead of "do", I suggest using named-"let" unless "map", "for-each", >> folds, etc. fit the problem naturally. > > Fact is: ?do *is* named let, only more convenient and a bit more limited. I've found comprehensions a better solution in almost all cases. For reals. N. From neil at neilvandyke.org Fri Jun 12 17:04:07 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Fri Jun 12 17:04:44 2009 Subject: [plt-scheme] (newbie question) About Loop In-Reply-To: <67d0527e0906121347m32a3b1aej5d2826e1dfc226e7@mail.gmail.com> References: <67d0527e0906121228u62d56aa8qa9ae3d2607fee33c@mail.gmail.com> <4A32B2F8.3000507@neilvandyke.org> <67d0527e0906121346y2f641a0bq88fc721c5a3aa4ab@mail.gmail.com> <67d0527e0906121347m32a3b1aej5d2826e1dfc226e7@mail.gmail.com> Message-ID: <4A32C2C7.7030102@neilvandyke.org> namekuseijin wrote at 06/12/2009 04:47 PM: > Fact is: do *is* named let, only more convenient and a bit more limited. > I disagree. People are free to use "do", just as people are free to eat paste, but neither practice should be advocated . -- http://www.neilvandyke.org/ From matthias at ccs.neu.edu Fri Jun 12 17:09:10 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Fri Jun 12 17:09:47 2009 Subject: [plt-scheme] fp source, fp speed (was: something else) In-Reply-To: References: <4A31EEE9.1080104@cs.utah.edu> Message-ID: <0C2C8A47-39C5-4F21-A44C-DD9D8C652A5F@ccs.neu.edu> On Jun 12, 2009, at 2:05 AM, Captain___nemo wrote: > Thanks a lot :) > > Won't it be inefficient building list for large values (say thousands > instead of 10)? Isn't there any direct loop syntax in Scheme? This is a pretty naive view of the world (where naive is a technical word, not a human word with other connotations). (for-each (curry printf "~s\n") (build-list n values)) might not be pretty for for(i = 0; i < n; i++) printf("~s\n",i) but jumping to the conclusion that this expression builds an intermediate list of 1,000,000 numbers, just because n = 1,000,000 is a pretty fast one. Aggressive compilers have eliminated such lists (and arrays) for about two decades now, both as deforesters in the FP world and as loop fusers in the Fortran realm. Having said, mz isn't an aggressive compiler yet. To get there, you will have to sign up as a compiler writer PhD student with Matthew -- Matthias From namekuseijin at gmail.com Fri Jun 12 17:08:23 2009 From: namekuseijin at gmail.com (namekuseijin) Date: Fri Jun 12 17:14:09 2009 Subject: [plt-scheme] (newbie question) About Loop In-Reply-To: <4A32C2C7.7030102@neilvandyke.org> References: <67d0527e0906121228u62d56aa8qa9ae3d2607fee33c@mail.gmail.com> <4A32B2F8.3000507@neilvandyke.org> <67d0527e0906121346y2f641a0bq88fc721c5a3aa4ab@mail.gmail.com> <67d0527e0906121347m32a3b1aej5d2826e1dfc226e7@mail.gmail.com> <4A32C2C7.7030102@neilvandyke.org> Message-ID: <67d0527e0906121408j1cf235acsc5cd039dc78e6ae4@mail.gmail.com> On Fri, Jun 12, 2009 at 6:04 PM, Neil Van Dyke wrote: > namekuseijin wrote at 06/12/2009 04:47 PM: >> >> Fact is: ?do *is* named let, only more convenient and a bit more limited. >> > > I disagree. ?People are free to use "do", just as people are free to eat > paste, but neither practice should be advocated . more like pasta! yum... :) From sk at cs.brown.edu Fri Jun 12 17:29:01 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Fri Jun 12 17:29:22 2009 Subject: [plt-scheme] Re: How difficult would creating a collaborative multi-user online virtual world application be in PLT Scheme? In-Reply-To: <756daca50906120906i6922583em77dfb4886c586fce@mail.gmail.com> References: <5A441D1B-7941-40AF-8DE5-62C33FB59C03@brinckerhoff.org> <9fl335pp1jr99hk2pmb66m2i0bfut63hd7@4ax.com> <756daca50906120906i6922583em77dfb4886c586fce@mail.gmail.com> Message-ID: Guess. On Jun 12, 2009 12:06 PM, "Grant Rettke" wrote: On Fri, Jun 12, 2009 at 7:36 AM, Shriram Krishnamurthi wrote: > which ends in the s... What is the post-linnaean tone and how does it apply here? Or should one just read the paper? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090612/5c811cb8/attachment.html From ramalho at gmail.com Fri Jun 12 17:39:58 2009 From: ramalho at gmail.com (Luciano Ramalho) Date: Fri Jun 12 17:45:31 2009 Subject: [plt-scheme] (newbie question) About Loop In-Reply-To: References: Message-ID: <4331ad810906121439wed15295y3d30320b14b311ea@mail.gmail.com> On Fri, Jun 12, 2009 at 2:47 AM, MD.MAHBUBUR RASHEED wrote: > Hi, > How can I implement?loop in ?plt-scheme like in java- > > for(int i=0;i<10;){ > ?? ? for(int j=0;j<3;){ > ?? ? ? ? ?System.out.println(""+j); > ?? ? ? ? ?j++; > ?? ? } > ?? ? ?System.out.println(""+i); > ?? ? ?i++; > } > Thanks in advance. Rasheed, I strongly recommend that you read "The Little Schemer". If you sit down for about 12 hours over a few days and do the exercises, "The Little Schemer" will teach you to think in the Scheme way, which is quite different from the Java way. It taught me, after 20 years of programming *the other way*, and it was a wonderful learning experience. http://www.amazon.com/Little-Schemer-Daniel-P-Friedman/dp/0262560992 Cheers, Luciano PS. After you finish "The Little Schemer" you will probably be hooked, and will want to get "The Seasoned Schemer" as well... From adityashukla1983 at gmail.com Fri Jun 12 18:16:55 2009 From: adityashukla1983 at gmail.com (aditya shukla) Date: Fri Jun 12 18:17:14 2009 Subject: [plt-scheme] HTDP Excercise 14.1.5 In-Reply-To: <9b1fff280906120630k656c5efbu671910f3a75689d0@mail.gmail.com> References: <73045cca0906111107h4228a68br1aadd0996b904e99@mail.gmail.com> <9b1fff280906120630k656c5efbu671910f3a75689d0@mail.gmail.com> Message-ID: <73045cca0906121516p2f9e4f59jf073a26daed96c88@mail.gmail.com> Thanks I got it now.I have one question though , in the documentation of append it is given that (append lst ...) → list? lst : list? (append lst ... v) → any/c lst : list? v : any/c When given all list arguments, the result is a lists that contains all of the elements of the given lists in order. The last argument is used directly in the tail of the result. The last argument need not be a list, in which case the result is an “improper list. Can someone please explain what does an improper list means? Aditya -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090612/c1fa1f0a/attachment.htm From grettke at acm.org Fri Jun 12 17:52:13 2009 From: grettke at acm.org (Grant Rettke) Date: Fri Jun 12 18:23:00 2009 Subject: [plt-scheme] Re: How difficult would creating a collaborative multi-user online virtual world application be in PLT Scheme? In-Reply-To: References: <5A441D1B-7941-40AF-8DE5-62C33FB59C03@brinckerhoff.org> <9fl335pp1jr99hk2pmb66m2i0bfut63hd7@4ax.com> <756daca50906120906i6922583em77dfb4886c586fce@mail.gmail.com> Message-ID: <756daca50906121452n7adc9b00qf0b0a70c0e09b063@mail.gmail.com> On Fri, Jun 12, 2009 at 4:29 PM, Shriram Krishnamurthi wrote: >> On Jun 12, 2009 12:06 PM, "Grant Rettke" wrote: >>> On Fri, Jun 12, 2009 at 7:36 AM, Shriram Krishnamurthi >>> wrote: > which ends in the s... >> >> What is the post-linnaean tone and how does it apply here? >> >> Or should one just read the paper? > > Guess. OK I knew the answer. The answer is "go read it here": http://www.cs.brown.edu/~sk/Publications/Papers/Published/sk-teach-pl-post-linnaean/ From carl.eastlund at gmail.com Fri Jun 12 18:24:46 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Fri Jun 12 18:25:05 2009 Subject: [plt-scheme] HTDP Excercise 14.1.5 In-Reply-To: <73045cca0906121516p2f9e4f59jf073a26daed96c88@mail.gmail.com> References: <73045cca0906111107h4228a68br1aadd0996b904e99@mail.gmail.com> <9b1fff280906120630k656c5efbu671910f3a75689d0@mail.gmail.com> <73045cca0906121516p2f9e4f59jf073a26daed96c88@mail.gmail.com> Message-ID: <990e0c030906121524g7f84d020ia7c77bd9b3464d07@mail.gmail.com> 2009/6/12 aditya shukla : > Thanks I got it now.I have one question though , in the documentation of > append it is given that > > (append lst ...) → list? > lst : list? > (append lst ... v) → any/c > lst : list? > v : any/c > > When given all list arguments, the result is a lists that contains all of > the elements of the given lists in order. The last argument is used directly > in the tail of the result. > > The last argument need not be a list, in which case the result is an > "improper list. > > > Can someone please explain what does an improper list means? > > Aditya An improper list is a list terminated by a value other than empty. Some examples follow. Proper lists: empty (cons 3 empty) (cons 2 (cons 3 empty)) (cons 1 (cons 2 (cons 3 empty))) Improper lists: 3 (cons 2 3) (cons 1 (cons 2 3)) -- Carl Eastlund From adityashukla1983 at gmail.com Fri Jun 12 18:25:42 2009 From: adityashukla1983 at gmail.com (aditya shukla) Date: Fri Jun 12 18:26:00 2009 Subject: [plt-scheme] HTDP Excercise 14.1.5 In-Reply-To: <990e0c030906121524g7f84d020ia7c77bd9b3464d07@mail.gmail.com> References: <73045cca0906111107h4228a68br1aadd0996b904e99@mail.gmail.com> <9b1fff280906120630k656c5efbu671910f3a75689d0@mail.gmail.com> <73045cca0906121516p2f9e4f59jf073a26daed96c88@mail.gmail.com> <990e0c030906121524g7f84d020ia7c77bd9b3464d07@mail.gmail.com> Message-ID: <73045cca0906121525w443ae86ek3a3c3f1964a93c0b@mail.gmail.com> Ok.Thanks i got it now. Aditya -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090612/8eaa315f/attachment.html From armageddon00 at gmail.com Fri Jun 12 14:11:56 2009 From: armageddon00 at gmail.com (Daniel King) Date: Fri Jun 12 21:51:11 2009 Subject: [plt-scheme] Scroll speed in DrScheme 4.2 Message-ID: Hi all, I updated to DrScheme 4.2 and noticed that the scroll speed in the definitions and interactions window and the program contour has been significantly reduced. One half rotation of my scroll wheel equates to about 7 lines of movement. Other scroll-able areas may also be affected by this, but those are the three which I have experienced the problem. Curiously, I noticed that the "Open File" dialog does not exhibit this slow scrolling behavior. My System: 32-bit Ubuntu Juanty DrScheme "version 4.2 [3m]" I have the Emacs style key bindings enabled, but I experienced the same behavior with the menu key bindings enabled. Thanks! -- Dan King College of Computer and Information Science Northeastern University From lordgeoffrey at optushome.com.au Fri Jun 12 22:30:34 2009 From: lordgeoffrey at optushome.com.au (LordGeoffrey) Date: Fri Jun 12 22:31:15 2009 Subject: [plt-scheme] Scroll speed in DrScheme 4.2 In-Reply-To: References: Message-ID: <4A330F4A.2000702@optushome.com.au> same for me. Daniel King wrote: > Hi all, > > I updated to DrScheme 4.2 and noticed that the scroll speed in the > definitions and interactions window and the program contour has been > significantly reduced. One half rotation of my scroll wheel equates > to about 7 lines of movement. Other scroll-able areas may also be > affected by this, but those are the three which I have experienced the > problem. Curiously, I noticed that the "Open File" dialog does not > exhibit this slow scrolling behavior. > > My System: > > 32-bit Ubuntu Juanty > DrScheme "version 4.2 [3m]" > > I have the Emacs style key bindings enabled, but I experienced the > same behavior with the menu key bindings enabled. > > Thanks! > > From noelwelsh at gmail.com Sat Jun 13 02:49:12 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Sat Jun 13 02:49:31 2009 Subject: [plt-scheme] Scroll speed in DrScheme 4.2 In-Reply-To: References: Message-ID: On Fri, Jun 12, 2009 at 7:11 PM, Daniel King wrote: > I updated to DrScheme 4.2 and noticed that the scroll speed in the > definitions and interactions window and the program contour has been > significantly reduced. Most likely this is to do with the editor code being rewritten from C++ to Scheme. See the release announcement for more. N. From noelwelsh at gmail.com Sat Jun 13 03:08:40 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Sat Jun 13 03:09:02 2009 Subject: [plt-scheme] Nanojit - an alternative to LLVM Message-ID: A little while ago someone asked about using LLVM as an alternative compiler backend to Lightning. Another alternative, with perhaps a better set of tradeoffs (much smaller but lower performance than LLVM) is Nanojit, used in the pre-release versions of Firefox: https://developer.mozilla.org/En/Nanojit It currently support x86 and ARM. I believe Sparc support is at least on the wishlist. [Another alternative is libjit, but their website is makes ridiculous claims, which doesn't inspire confidence in the project.] [Implementing a trace based compiler should lead to publishable research, so it might be more appealing to those likely to actual do the work.] N. From jpc-ml at zenburn.net Sat Jun 13 04:37:16 2009 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Sat Jun 13 05:07:15 2009 Subject: [plt-scheme] Scroll speed in DrScheme 4.2 In-Reply-To: References: Message-ID: <4A33653C.5060200@zenburn.net> On 6/13/09 8:49 AM, Noel Welsh wrote: > On Fri, Jun 12, 2009 at 7:11 PM, Daniel King wrote: >> I updated to DrScheme 4.2 and noticed that the scroll speed in the >> definitions and interactions window and the program contour has been >> significantly reduced. > > Most likely this is to do with the editor code being rewritten from > C++ to Scheme. See the release announcement for more. Same for me on OS X 10.5. It probably has something to do with the rewrite but OTOH neither version generates much CPU load while scrolling (? 20%) so probably it's only some change in the way mouse wheel events are handled. -- regards, Jakub Piotr C?apa From lordgeoffrey at optushome.com.au Sat Jun 13 05:20:56 2009 From: lordgeoffrey at optushome.com.au (LordGeoffrey) Date: Sat Jun 13 05:21:17 2009 Subject: [plt-scheme] Scroll speed in DrScheme 4.2 In-Reply-To: <4A330F4A.2000702@optushome.com.au> References: <4A330F4A.2000702@optushome.com.au> Message-ID: <4A336F78.9060901@optushome.com.au> Actually for me, its not just the scroll wheel its all navigation, definitely sluggish. (Noel's comment seems to be the obvious reason) From mflatt at cs.utah.edu Sat Jun 13 09:27:43 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Sat Jun 13 09:28:06 2009 Subject: [plt-scheme] Scroll speed in DrScheme 4.2 In-Reply-To: <4A33653C.5060200@zenburn.net> References: <4A33653C.5060200@zenburn.net> Message-ID: <20090613132746.C29666500FE@mail-svr1.cs.utah.edu> At Sat, 13 Jun 2009 10:37:16 +0200, Jakub Piotr C?apa wrote: > On 6/13/09 8:49 AM, Noel Welsh wrote: > > On Fri, Jun 12, 2009 at 7:11 PM, Daniel King wrote: > >> I updated to DrScheme 4.2 and noticed that the scroll speed in the > >> definitions and interactions window and the program contour has been > >> significantly reduced. > > > > Most likely this is to do with the editor code being rewritten from > > C++ to Scheme. See the release announcement for more. > > Same for me on OS X 10.5. It probably has something to do with the > rewrite Yes, I missed a wheel-step multiplier in the new version. It's fixed in SVN for the next version. Thanks for the report, Matthew From filip.stadnik at gmail.com Sat Jun 13 12:39:15 2009 From: filip.stadnik at gmail.com (Filip Stadnik) Date: Sat Jun 13 12:45:28 2009 Subject: [plt-scheme] Scripting Excel with MysterX In-Reply-To: References: Message-ID: Hi Ben, Here is a small workspace I was playing in not a long time ago before I lost my patience and proceeded in javascript/cscript.exe :). Maybe you can get some inspiration... #lang scheme (require mysterx) (define IN "d:\\csv.txt") (define XLS (cocreate-instance-from-progid "Excel.Application")) (com-set-property! XLS "Visible" true) (define Workbooks (com-get-property XLS "Workbooks")) (com-invoke Workbooks "OpenText" IN 65001 ;Origin UTF8(65001) 1 ;StartRow 1 1 ;DataType xlDelimited(1) xlFixedWidth(2) 1 ;TextQualifier xlTextQualifierDoubleQuote(1), none(-4142), single(2) #f ;ConsecutiveDelimiters as one (false) #f ;Tab #f ;Semicolon #t ;Comma #f ;Space #f ;Other com-omit ;OtherChar ;FieldInfo[colNum, type] XlColumnDataType: xlTextFormat(2) com-omit ;FieldInfo example: (vector (vector 1 2) (vector 2 2)) ; rest skipped ) (define ActiveSheet (com-get-property XLS "ActiveSheet")) (com-set-property! ActiveSheet "Name" "Print") (define Cells (com-get-property XLS "Cells")) (com-invoke Cells "Select") (define Selection (com-get-property XLS "Selection")) (define Font (com-get-property Selection "Font")) (com-set-property! Font "Name" "Arial") (com-set-property! Font "Size" 7) (define EntireColumn (com-get-property Cells "EntireColumn")) (com-invoke EntireColumn "AutoFit") ;; additional formatting ;(define R1 (com-invoke ActiveSheet "Rows" "2:2")) ;(com-invoke R1 "Select") ;(com-invoke Selection "Insert" -4121 0) ; xlDown xlFormatFromLeftOrAbove ;(define R2 (com-get-property XLS "Range" "A2")) ;(com-invoke R2 "Select") (custodian-shutdown-all (current-custodian)) ;(define ActiveWorkbook (com-get-property XLS "ActiveWorkbook")) ;(com-invoke ActiveWorkbook "SaveAs" OUT 56 com-omit com-omit #t) ;xlExcel8, ReadOnlyRecommended ;(com-invoke ActiveWorkbook "Close") ;(com-invoke XLS "Quit") Cheers, Filip 2009/6/12 Ben Simon > Howdy all, > > I've got a project coming up that looks like it's going to require me to > write some VB code in Excel. That is, unless I can put together a Scheme > solution first :-). > > I've made some progress with MysterX and scripting excel by following the > example here: > http://www.perlmonks.org/index.pl?node_id=153486 > > Here's what I have so far: > > (require mysterx) > (let* ([excel (com-get-active-object-from-coclass "Microsoft Office Excel > Application")] > [book (com-invoke (com-get-property excel "Workbooks") "Add")]) > (com-get-property book "Worksheets")) > > What I'm stuck on, is that I believe Worksheets is an associative array, > and I'm trying to get a hold of Sheet1. Or, as they say in perl: > > my $Sheet = $Book->Worksheets("Sheet1"); > > I can get the value of the Worksheets property, but I can't index into it. > > Essentially, I'm asking the same question raised here: > http://tinyurl.com/mmuffa - as next I need to figure out how to access > ranges and other goodies. > > Thanks for the help - and an especially big thanks if you get me out of > coding in VB ;-) > > -Ben > > -- > Have an idea for software? I can make it happen - > http://www.ideas2executables.com > My Blog: http://benjisimon.blogspot.com > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090613/44972749/attachment.htm From adityashukla1983 at gmail.com Sat Jun 13 14:23:18 2009 From: adityashukla1983 at gmail.com (aditya shukla) Date: Sat Jun 13 14:23:38 2009 Subject: [plt-scheme] Reading and understanding large programs Message-ID: <73045cca0906131123w32656b34j1d12a7e438fb1437@mail.gmail.com> Hello Everyone I was wondering about how to go about reading large programs and making sense out of them .Are there any particular approaches that can be used as guidelines. Thanks Aditya -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090613/b6003cb7/attachment.html From troelskn at gmail.com Sat Jun 13 15:58:31 2009 From: troelskn at gmail.com (troels knak-nielsen) Date: Sat Jun 13 16:29:37 2009 Subject: [plt-scheme] patch: string->xexpr Message-ID: <98b8086f0906131258v74b0e0fes912e1954af86da17@mail.gmail.com> No sure if this is the right place, but I was looking in vain for `string->xexpr`. It might be useful to add it to `collects/xml/private/xexpr.ss` (define (string->xexpr str) (xml->xexpr (read-xml/element (open-input-string str)))) (provide/contract [string->xexpr (string? . -> . xexpr/c)]) -- troels From toddobryan at gmail.com Sat Jun 13 17:45:42 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sat Jun 13 17:46:02 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? Message-ID: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> I'm starting to get really frustrated, because there are lots of languages that have some of what I want in a beginning language, but nothing that has everything. I'm beginning to worry that I'm going to have to design my own language--worry because I have neither the time nor background to do a good job of it. Here's what I'm looking for and I'm beginning to be afraid that the intersection of this set is empty, not just because no one's thought to do it, but because I'm convoluting language layers in an impossible way. Here are my desiderata for a language to teach introductory programming, through at least data structures: ------------------------- 1. Language Levels The PLT/HtDP people are the only group I've seen who realize how important this is, especially with sufficiently powerful languages, and after seeing how useful it is for my students, I wouldn't trade the idea for anything. Giving students access to only the stuff they understand and tailoring error messages for the kinds of programs that they should be writing is just too useful. This, of course, leaves out every language but Scheme and Java as implemented in the HtDP and HtDC language levels. 2. Types in the Language Here's a sample Python interaction: (For the uninitiated, >>> is the Python REPL prompt, the next line is the result.) >>> int >>> type(int) >>> type(3) >>> isinstance(3, int) True >>> isinstance(3, float) False >>> class Foo: ... pass ... >>> Foo >>> x = Foo() >>> isinstance(x, Foo) True >>> type(isinstance) OK, the last line is not particularly useful, but every Python value knows what it is, these types are real objects in the language, and programs can manipulate and ask questions about them. The contract is the first step of the design recipe for a very good reason--students need to think about what kinds of values a function consumes and what kind(s) of value it should produce. The problem is that, in HtDP, contracts are just comments, and students figure this out very quickly. I want types to impact students' programming, because a huge proportion of the mistakes my students make have to do with muddy thinking about types, and I think the programming environment should make them be explicit about what they think is going on and help them when they're wrong. Too many type-caused errors don't get caught until several layers of redirection, leaving students with stack traces that are, if not hard to follow, at least intimidating. Even if Typed Scheme were all done and perfect, it wouldn't provide this kind of support, mostly because that's not what it's designed to do. 3. Static Typing Yea for Python--I can play with types in the language. Boo for Python--I can only find typing problems once I let the program run and only if I happen to create a type problem. A program could be completely brittle in terms of types and I'd never realize it. This is exactly what statically-typed languages are designed to prevent, and what Typed Scheme seems to be doing a really good job of. (Unfortunately, I'm discovering just how many unfounded assumptions about types I make as I'm writing in Typed Scheme, but I'm sure it's on a par with how many unfounded assumptions I make in general.) I want a language that screams bloody murder if the pieces don't fit together right, even if some lazy student hasn't provided test cases that trigger a problem. ----------------------- There are lots of others--easily grokked syntax, a REPL, good libraries that let students explore stuff if they want to, etc.--but I think these three meet a need that I feel somewhere deep inside my innermost being. (You know, the place where butterflies and rainbows live...) So, are two and three mutually incompatible? Does the ability to define new types, to write functions on types, to create new types programmatically make it impossible to do static type checking, even if you force the programmer to declare types? If so, does it make it impossible generally, but still make it possible to write the kinds of programs that first-year students should write or is it just impossible for any useful subset of languages? I hesitate to ask this, given an audience of people who really like at least one dynamically-typed language, but am I just assigning too much importance to static/declared types? Should I stop worshipping at the altar of types and realize that, even if my students could get their types checked by the language, the ones with muddy thinking would just transfer the scene of their confusion to some other step in the design process? School ended a week ago, and I'm trying to plan out next year. I get philosophical at this point every year and start re-questioning all my assumptions. I thought Typed Scheme would be a way to get types into my intro class, but then I realized it tackles 3 really well, but not 2. What I'd really like to be able to do in Beginning Student Scheme is something like: > N N > (type-of 3) N > (type-of -4) Integer > (is-of-type 3 Integer) true > (type N) Type > (U N Integer) Integer > (U true false) Boolean and then be able to use these types--and others that students could define--to statically type programs in the vein of Typed Scheme. So, back to the subject line: Is this too much to ask for? Todd From sk at cs.brown.edu Sat Jun 13 18:00:47 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Sat Jun 13 18:01:31 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> Message-ID: > 2. Types in the Language These are not types. These are simply inspectors on the run-time tags. Your own example illustrates the point: >>>> type(isinstance) > The *type* of isinstance would be something like isinstance :: value x type -> boolean [Never mind that type should not be a type.] In contrast, the run-time tag is "some kind of applicable object", and that's what Python gives you. > OK, the last line is not particularly useful, but every Python value > knows what it is, these types are real objects in the language, and > programs can manipulate and ask questions about them. 1. I see no pedagogic value in this. 2. Scheme doesn't like to build in a bunch of crud. You can choose whatever representation you want for run-time tags and construct essentially the same in Scheme using the built-in predicates. If you think this is so useful for teaching, write a Teachpack that exports and standard interface for this. I leave it as an exercise because it's not a very hard one. > I want types to impact students' programming, > because a huge proportion of the mistakes my students make have to do > with muddy thinking about types, and I think the programming > environment should make them be explicit about what they think is > going on and help them when they're wrong. If you want this, and you want dynamic enforcement (which you seem to), use the PLT contract system (not to be confused with "contracts as comments" a la HtDP), which is about as sophisticated as you will find in any language. > 3. Static Typing > Yea for Python--I can play with types in the language. No you can't. You can play with run-time tags, as you can in lots of other languages. Shriram From samth at ccs.neu.edu Sat Jun 13 18:03:47 2009 From: samth at ccs.neu.edu (Sam TH) Date: Sat Jun 13 18:04:05 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> Message-ID: <63bb19ae0906131503t4dd1ba0qafa2ac8e8ba5f051@mail.gmail.com> On Sat, Jun 13, 2009 at 5:45 PM, Todd O'Bryan wrote: > >> N > N >> (type-of 3) > N >> (type-of -4) > Integer >> (is-of-type 3 Integer) > true >> (type N) > Type >> (U N Integer) > Integer >> (U true false) > Boolean You haven't given any examples of computing with the types. It would certainly be possible to make all of these work in Typed Scheme, although it would probably look more like: > (:type N) N or something similar. But if you really want to compute with the types, like this: (if (equal? (type-of 3) (type-of -3)) 'yes 'no) then that's more difficult to support, and if you want to do something like this: (: x (if stuff? Number String)) (define x ...) then static checking is suddenly much harder. So, I would say, try to come up with specific use cases for computation with types, and then your question will be easier to answer. -- sam th samth@ccs.neu.edu From toddobryan at gmail.com Sat Jun 13 18:33:41 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sat Jun 13 18:34:01 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <63bb19ae0906131503t4dd1ba0qafa2ac8e8ba5f051@mail.gmail.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <63bb19ae0906131503t4dd1ba0qafa2ac8e8ba5f051@mail.gmail.com> Message-ID: <904774730906131533j4e827f76m876fb60ee309568c@mail.gmail.com> On Sat, Jun 13, 2009 at 6:03 PM, Sam TH wrote: > On Sat, Jun 13, 2009 at 5:45 PM, Todd O'Bryan wrote: > > But if you really want to compute with the types, like this: > > (if (equal? (type-of 3) (type-of -3)) 'yes 'no) > > then that's more difficult to support, This is the kind of stuff I would like to do, yes. I guess I'm asking for run-time type annotations, as Shriram correctly inferred from my none-too-clear text, with a sufficiently developed semantics to handle subtypes, unification, etc. > and if you want to do something > like this: > > (: x (if stuff? Number String)) > (define x ...) > > then static checking is suddenly much harder. This is clearly insane--I have never even considered such an idea. :-) And it goes to show how naive about this stuff I am. If you limit yourself to types, unions, parametric types, etc. in type declarations and don't allow general Scheme code, I gather that the system doesn't explode. I'm more than willing to do that--thank you for pointing out how taking my previous statement at face value would have caused a mess to happen. > So, I would say, try to come up with specific use cases for > computation with types, and then your question will be easier to > answer. Thanks. I'm trying to work through HtDP the way I wish it worked. I'll send examples as I come up with them. Maybe Shriram can intuit what I really want and you can explain how to get at it. Todd From ramalho at gmail.com Sat Jun 13 18:45:57 2009 From: ramalho at gmail.com (Luciano Ramalho) Date: Sat Jun 13 18:46:16 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> Message-ID: <4331ad810906131545m2d04d981p658d4f4e5569d874@mail.gmail.com> On Sat, Jun 13, 2009 at 7:00 PM, Shriram Krishnamurthi wrote: >> 2. Types in the Language > > These are not types. ?These are simply inspectors on the run-time > tags. ?Your own example illustrates the point: > >>>>> type(isinstance) >> > > The *type* of isinstance would be something like > > ?isinstance :: value x type -> boolean > > [Never mind that type should not be a type.] ?In contrast, the > run-time tag is "some kind of applicable object", and that's what > Python gives you. Python builtins are an exception, but usually what you get from type() is much more than a description: you get the actual class object: >>> l = [1, 2, 3] >>> type(l) >>> my_type = type(l) >>> l2 = my_type() >>> l2 [] >>> type(l2) >>> Is there a Scheme equivalent of this interaction? How is it? Cheers, Luciano From toddobryan at gmail.com Sat Jun 13 19:04:18 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sat Jun 13 19:04:37 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> Message-ID: <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> On Sat, Jun 13, 2009 at 6:00 PM, Shriram Krishnamurthi wrote: >> 2. Types in the Language > > These are not types. ?These are simply inspectors on the run-time > tags. ?Your own example illustrates the point: > >>>>> type(isinstance) >> > > The *type* of isinstance would be something like > > ?isinstance :: value x type -> boolean > > [Never mind that type should not be a type.] ?In contrast, the > run-time tag is "some kind of applicable object", and that's what > Python gives you. You're absolutely correct, and that's the confusion I was suffering from. I *do* want run-time type annotations/tags that ride along with values, so that students can make assertions and ask questions about them. You're exactly right that the type of isinstance should be more specific, and I'd want something like > (type is-of-type) Any Type -> Boolean in the Scheme version (where Type is the top of the hierarchy of run-time tags that describe types). >> OK, the last line is not particularly useful, but every Python value >> knows what it is, these types are real objects in the language, and >> programs can manipulate and ask questions about them. > > 1. I see no pedagogic value in this. Have you never had a student try to return a number instead of a posn? Or (much more common and much more painful) in the chapters on binary trees and family trees, students get confused about the kinds of structures they're building and bury a mistake so deep in a structure that by the time they get the error message it's not clear where they painted themselves into a corner. These are the problems that they spend ten or fifteen minutes staring at, and when I get there, I know it's a type problem, but there are three or four functions, all with working test cases that could have triggered the problem, and I have to spend 5 minutes unwinding everything with them. Outside of Scheme programming, I think there's a great deal of pedagogic value in getting them to think about types. All of my students get to AP Calculus AB or BC by their senior year and many of them don't understand the relationship between the sets of numbers they work with--naturals, integers, reals, rationals, irrationals, and complex. It's not their fault--the curriculum I went through at the same high school made that abundantly clear. Sometime in the 90's, we went to something that was less theoretically rigorous and concentrated more on applications. I'd like to drill them on type judgments and the best way to do that is to have them be able to check their judgments with a program that gives the right answer. > 2. Scheme doesn't like to build in a bunch of crud. ?You can choose > whatever representation you want for run-time tags and construct > essentially the same in Scheme using the built-in predicates. ?If you > think this is so useful for teaching, write a Teachpack that exports > and standard interface for this. ?I leave it as an exercise because > it's not a very hard one. I think that's what I'd like to do. Unfortunately, I'm running into my ignorance of Scheme beyond HtDP. If you think it's pretty easy, I'd like to give it a go, but I'm at a bit of a loss as to where to start. Should I implement the run-time tags as objects because of the natural sub-classing/sub-typing relationships, should a tag be a struct, should I just have a bunch of symbols? Can you constrain the exercise a bit? >> I want types to impact students' programming, >> because a huge proportion of the mistakes my students make have to do >> with muddy thinking about types, and I think the programming >> environment should make them be explicit about what they think is >> going on and help them when they're wrong. > > If you want this, and you want dynamic enforcement (which you seem > to), use the PLT contract system (not to be confused with "contracts > as comments" a la HtDP), which is about as sophisticated as you will > find in any language. Exactly! I got so excited when I found the contract system, except it only works across module boundaries and I want students' functions checked within the file where they're defined. Is there any way to (a) allow students to declare a contract in a fairly easy to understand way, and (b) check the contract against all of the other uses in the same module? >> 3. Static Typing >> Yea for Python--I can play with types in the language. > > No you can't. ?You can play with run-time tags, as you can in lots of > other languages. > Exactly. Is it safe to say that, for each type in the language, I want a run-time-accessible value that corresponds with that type that can be manipulated by the language--including some specific functions like unify types, check if a value is of a type, etc.--or am I still not correctly verbalizing/understanding what I'm asking for? > Shriram Thanks for correcting my misapprehensions! Todd From matthias at ccs.neu.edu Sat Jun 13 19:36:47 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sat Jun 13 19:37:21 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> Message-ID: <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> On Jun 13, 2009, at 7:04 PM, Todd O'Bryan wrote: > or am I still not correctly verbalizing/understanding what I'm > asking for? You are but like a typical consumer and many computer scientists, you are proposing a solution instead of stating and describing the problem. ;; --- 1. We made the decision to go without static types for good reason. You don't want types (at the beginning). 2. What we call contracts in BSL and what we call contracts in PLT Scheme is only loosely related. So you don't want contracts either. 3. In the German version of HtDP, dubbed DeinProgram, you state HtDP- style contracts in a formal language and they are checked as your BSL/ ISL programs are run. It would cut down your students' 'debugging' time a lot. See DeinProgram in DrScheme, but you may need to know a bit of German. 4. We intend to support something like this sooner or later. Robby has been working on this since 2004. 5. I don't understand how your students can have test cases for each function and NOT see that their functions are producing the wrong things. Code excerpts would be helpful. All in all you aren't asking for a perfect language. You're asking for very doable things. (Python's nonsense confused the heck out of you. Give up on it. Study ML and then jump to Cayenne. Students will never mistakes again, because they won't get any programs past the type checkers :-) -- Matthias ;; ---- P.S. For your reading pleasure, a first draft of the proposed teachpack for providing type-of and friends: #lang scheme (require lang/prim) (provide type-of) ;; Any -> Type (define (type-of a) (cond [(number? a) Number] [(string? a) String] [(boolean? a) Boolean] [(procedure? a) Procedure] [(type? a) Type])) (define-syntax-rule (def-types type? Name ...) (begin (provide type? Name ...) (define (type? x) (member x (list Name ...))) (define Name (gensym 'Name)) ...)) (def-types type? Type Number String Boolean Procedure) I took the liberty of writing a macro to define the types. You can define them one by one, w/i the BSL language!!! Here is an interaction: Welcome to DrScheme, version 4.2.0.3-svn12jun2009 [3m]. Language: Intermediate Student. This program should be tested. > (type-of 3) 'Number3989 > (type-of cons) 'Procedure3992 > (type-of true) 'Boolean3991 > (type-of (type-of true)) 'Type3988 > From gfb at cs.toronto.edu Sat Jun 13 20:32:59 2009 From: gfb at cs.toronto.edu (Gary Baumgartner) Date: Sat Jun 13 20:33:23 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> Message-ID: <20090614003259.GA32348@cs.toronto.edu> On Sat, Jun 13, 2009 at 05:45:42PM -0400, Todd O'Bryan wrote: > I'm starting to get really frustrated, because there are lots of > languages that have some of what I want in a beginning language, but > nothing that has everything. I'm beginning to worry that I'm going to > have to design my own language--worry because I have neither the time > nor background to do a good job of it. Since the implementation takes time and background, it is part of the consideration. Are you thinking of that as minor in comparison to the design, else can you break down your worry a bit more into how much of it is about design, and how much of it is being able to implement the design? > Here's what I'm looking for and > I'm beginning to be afraid that the intersection of this set is empty, > not just because no one's thought to do it, but because I'm > convoluting language layers in an impossible way. That's a correct "open-minded" attitude. > Here are my desiderata for a language to teach introductory > programming, through at least data structures: [...] Your description of desiderata contains some detail, and you were probably hoping that, while imprecise, might trigger a pointer to something precise that you haven't heard of. It doesn't for me, nor Shriram. So, instead of working with your list, let's try a different angle I find useful in such discussions: take a concrete example/proposal, and try to evaluate its suitability. If some of the people involved are only responding to a request to satisfy the others' criteria, the others try also to fix the example / propose a different one. To start, can you respond to my example of a parser language. More simply, just (the example of) specifying one in it: (cfg ( ( ) ('e)) ( ("0") ("1"))) How suitable is this? E.g., since you are now talking about 'types', would it be important that the resulting value be easily introspectable as a "CFG", and with what syntax? Of course since you were interested in parsing as an example of computation, how suitable is this syntax, and the resulting parser behaviour, for that? In particular, how would you want to express the above grammar and use the resulting parser? > easily grokked syntax, a REPL, good > libraries that let students explore stuff if they want to, etc We're all, present company, I believe working on that, as you suspected, (i.e. it's not that we haven't thought of it). And, if I can presume to speak collectively but not as someone who can take credit for PLT, succeeding and proceeding much more than the average. By the way, in case you are arguing for a certain unknown syntax, sexpressions have solved the syntax problem, to the extent that one wants an easily grokked syntax for *all* programming (i.e. algorithms, i.e. constructive mathematic). PLT has testimonials covering essentially all backgrounds, the theoretical complexity is provably low, and only people used to other universal notations who haven't spent the same amount of time with sexps, or people used to specific notations for *very* specific domains and a vanishingly (over time!) small number of programming applications, disagree. For more evidence, consider that for general 'data' definition alone, XML is the main competing proposal. Of course good sub-syntax, if I can call it that, as e.g. Scheme macros specify, is specific to each domain, and talking about its absolute grokkability independent of its semantics is pointless. 'Solving' it is as impossible/meaningless as making all meaning easily grokkable. In particular it would require unifying all special notations people consider natural in all specialized domains, and one would have to wonder why different human languages didn't converge to it. Before machines, no one was asking/searching for some 'easily grokkable syntax' for all constructive mathematics / non-fiction. No one outside (naive) programming language design would consider that anything but absurd. And even they don't go that far, instead making an implementable claim that, sinces it's impossible to solve, "every line should be easily readable / understandable" out of context, by restricting it to certain primitives that appear syntactically in the line (i.e. aren't abstracted by macros, though for some reason classes, call-by-value functions, etc, are okay, with the exact mix depending on a designer's prejudice, for a particular calendar year). But that's as absurd as saying that essays, specifications, etc, should be written in grade school language, with the ability to make definitions restricted in certain arbitrary ways (e.g. no "until", verbs and only certain kinds of nouns) and then philosophy essays would be easy to write, and children could read and understand them. The mistake is an exercise for the reader (though (almost?) no readers of this list), since at this point every one I've asked knows it *is* a mistake there, and then translating the mistake back to programming completes the exercise. To close, let me double-check that you aren't expecting the language to do anything for you that it can't: no language will let students understand a parsing program for cfgs without understanding what a cfg is. It is *very* common, for students adapting to new syntax, to claim they "know how to program it", but just not the syntax. Experienced instructors know that this student inrospection is almost always false, and that once the algorithm is truly understood, with precision (to the level of mathematics / theory of CS), the student has no problem with the syntax (I've had countless examples of this, using diagrams, memory models, instructions for another human who doesn't know the purpose of the instructions, etc, and then when understood having the student exclaim "Oh!, then it's just [...] in [language X]." I hope the length and content wasn't condescending, but the industry is so muddled on this point that the following comic is ineresting and/or funny to many: http://www.xkcd.com/568/ From robby at eecs.northwestern.edu Sat Jun 13 20:35:05 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sat Jun 13 20:35:27 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> Message-ID: <932b2f1f0906131735r7c0bfaf2uafe0768deffdc8cf@mail.gmail.com> "working on" in the very loosest sense of the world. :) Robby On Sat, Jun 13, 2009 at 6:36 PM, Matthias Felleisen wrote: > > On Jun 13, 2009, at 7:04 PM, Todd O'Bryan wrote: > >> or am I still not correctly verbalizing/understanding what I'm asking for? > > You are but like a typical consumer and many computer scientists, you are > proposing a solution instead of stating and describing the problem. > > ;; --- > > 1. We made the decision to go without static types for good reason. You > don't want types (at the beginning). > > 2. What we call contracts in BSL and what we call contracts in PLT Scheme is > only loosely related. So you don't want contracts either. > > 3. In the German version of HtDP, dubbed DeinProgram, you state HtDP-style > contracts in a formal language and they are checked as your BSL/ISL programs > are run. It would cut down your students' 'debugging' time a lot. See > DeinProgram in DrScheme, but you may need to know a bit of German. > > 4. We intend to support something like this sooner or later. Robby has been > working on this since 2004. > > 5. I don't understand how your students can have test cases for each > function and NOT see that their functions are producing the wrong things. > Code excerpts would be helpful. > > All in all you aren't asking for a perfect language. You're asking for very > doable things. (Python's nonsense confused the heck out of you. Give up on > it. Study ML and then jump to Cayenne. Students will never mistakes again, > because they won't get any programs past the type checkers :-) > > -- Matthias > > > ;; ---- > > > P.S. For your reading pleasure, a first draft of the proposed teachpack for > providing type-of and friends: > > #lang scheme > > (require lang/prim) > > (provide type-of) > > ;; Any -> Type > (define (type-of a) > ?(cond > ? ?[(number? a) Number] > ? ?[(string? a) String] > ? ?[(boolean? a) Boolean] > ? ?[(procedure? a) Procedure] > ? ?[(type? a) Type])) > > (define-syntax-rule (def-types type? Name ...) > ?(begin (provide type? Name ...) > ? ? ? ? (define (type? x) > ? ? ? ? ? (member x (list Name ...))) > ? ? ? ? (define Name (gensym 'Name)) > ? ? ? ? ...)) > > (def-types type? Type Number String Boolean Procedure) > > > I took the liberty of writing a macro to define the types. You can define > them one by one, w/i the BSL language!!! > > Here is an interaction: > > Welcome to DrScheme, version 4.2.0.3-svn12jun2009 [3m]. > Language: Intermediate Student. > This program should be tested. >> (type-of 3) > 'Number3989 >> (type-of cons) > 'Procedure3992 >> (type-of true) > 'Boolean3991 >> (type-of (type-of true)) > 'Type3988 >> > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From sk at cs.brown.edu Sat Jun 13 20:39:13 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Sat Jun 13 20:39:53 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <4331ad810906131545m2d04d981p658d4f4e5569d874@mail.gmail.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <4331ad810906131545m2d04d981p658d4f4e5569d874@mail.gmail.com> Message-ID: That's an implementation. State a specification instead. [Hint: I actually did describe an implementation of an "equivalent" specification in my previous message. The burden is on you to show why it's not "equivalent".] Shriram On Sat, Jun 13, 2009 at 6:45 PM, Luciano Ramalho wrote: > On Sat, Jun 13, 2009 at 7:00 PM, Shriram Krishnamurthi wrote: >>> 2. Types in the Language >> >> These are not types. ?These are simply inspectors on the run-time >> tags. ?Your own example illustrates the point: >> >>>>>> type(isinstance) >>> >> >> The *type* of isinstance would be something like >> >> ?isinstance :: value x type -> boolean >> >> [Never mind that type should not be a type.] ?In contrast, the >> run-time tag is "some kind of applicable object", and that's what >> Python gives you. > > Python builtins are an exception, but usually what you get from type() > is much more than a description: you get the actual class object: > >>>> l = [1, 2, 3] >>>> type(l) > >>>> my_type = type(l) >>>> l2 = my_type() >>>> l2 > [] >>>> type(l2) > >>>> > > Is there a Scheme equivalent of this interaction? How is it? > > Cheers, > > Luciano > From benjisimon at gmail.com Sat Jun 13 21:48:35 2009 From: benjisimon at gmail.com (Ben Simon) Date: Sat Jun 13 21:56:10 2009 Subject: [plt-scheme] Scripting Excel with MysterX In-Reply-To: References: Message-ID: On Sat, Jun 13, 2009 at 12:39 PM, Filip Stadnik wrote: > > Here is a small workspace I was playing in not a long time ago before I > lost my patience and proceeded in javascript/cscript.exe :). > > Maybe you can get some inspiration... > Filip, that's terrifically helpful, thanks! And thanks, Noel, for the excel solution too. While I don't think that will work for this project, it's very helpful to know about. -Ben -- Have an idea for software? I can make it happen - http://www.ideas2executables.com My Blog: http://benjisimon.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090613/53008281/attachment.html From toddobryan at gmail.com Sat Jun 13 22:43:50 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sat Jun 13 22:44:12 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <20090614003259.GA32348@cs.toronto.edu> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <20090614003259.GA32348@cs.toronto.edu> Message-ID: <904774730906131943u3c0f2c44mf19e03c1a13fc32f@mail.gmail.com> SORRY! I should have made it clear that the CFG parser thread and this thread were completely unrelated. The CFG parser is an idea for a single assignment or a short set of assignments for my class next year and I'm trying to implement that in Typed Scheme. This thread is about my frustration that HtDP's current languages aren't perfect. I teach about 80 high school students each year using HtDP and then continue with about 45 more using HtDC. I'm one of the curriculum's biggest cheerleaders, so any criticism comes from a place of love. :-) As to the parser, I'm implementing a Tomita parser. It has the advantage that it handles left-recursion, ambiguity, is fairly fast, and produces all possible parses of a given input. I've gotten to the point where I've created the non-deterministic finite state automaton for a given grammar and now need to convert that to a DFA. I've put that on a back burner for a bit, because the most efficient way to implement it is some sort of hash-table, but I have to be careful that I have a representation of a subset of NFA states that works as a key and I haven't had time to digest the hash-table stuff, yet. Todd On Sat, Jun 13, 2009 at 8:32 PM, Gary Baumgartner wrote: > On Sat, Jun 13, 2009 at 05:45:42PM -0400, Todd O'Bryan wrote: >> I'm starting to get really frustrated, because there are lots of >> languages that have some of what I want in a beginning language, but >> nothing that has everything. I'm beginning to worry that I'm going to >> have to design my own language--worry because I have neither the time >> nor background to do a good job of it. > > Since the implementation takes time and background, it is part of > ?the consideration. Are you thinking of that as minor in comparison > ?to the design, else can you break down your worry a bit more into > ?how much of it is about design, and how much of it is being able to > ?implement the design? > >> Here's what I'm looking for and >> I'm beginning to be afraid that the intersection of this set is empty, >> not just because no one's thought to do it, but because I'm >> convoluting language layers in an impossible way. > > That's a correct "open-minded" attitude. > >> Here are my desiderata for a language to teach introductory >> programming, through at least data structures: > [...] > > Your description of desiderata contains some detail, and you were > ?probably hoping that, while imprecise, might trigger a pointer to > ?something precise that you haven't heard of. It doesn't for me, nor > ?Shriram. > > So, instead of working with your list, let's try a different angle I > ?find useful in such discussions: take a concrete example/proposal, > ?and try to evaluate its suitability. If some of the people involved > ?are only responding to a request to satisfy the others' criteria, > ?the others try also to fix the example / propose a different one. > > To start, can you respond to my example of a parser language. > ?More simply, just (the example of) specifying one in it: > > ?(cfg > ? ?( ( ) > ? ? ? ? ? ? ('e)) > ? ?( ("0") ("1"))) > > How suitable is this? E.g., since you are now talking about 'types', > ?would it be important that the resulting value be easily introspectable > ?as a "CFG", and with what syntax? Of course since you were interested > ?in parsing as an example of computation, how suitable is this syntax, > ?and the resulting parser behaviour, for that? In particular, how would > ?you want to express the above grammar and use the resulting parser? > >> easily grokked syntax, a REPL, good >> libraries that let students explore stuff if they want to, etc > > We're all, present company, I believe working on that, as you suspected, > ?(i.e. it's not that we haven't thought of it). And, if I can presume > ?to speak collectively but not as someone who can take credit for PLT, > ?succeeding and proceeding much more than the average. > > By the way, in case you are arguing for a certain unknown syntax, > ?sexpressions have solved the syntax problem, to the extent that > ?one wants an easily grokked syntax for *all* programming (i.e. > ?algorithms, i.e. constructive mathematic). PLT has testimonials > ?covering essentially all backgrounds, the theoretical complexity > ?is provably low, and only people used to other universal notations > ?who haven't spent the same amount of time with sexps, or people > ?used to specific notations for *very* specific domains and a > ?vanishingly (over time!) small number of programming applications, > ?disagree. For more evidence, consider that for general 'data' > ?definition alone, XML is the main competing proposal. > > Of course good sub-syntax, if I can call it that, as e.g. Scheme > ?macros specify, is specific to each domain, and talking about its > ?absolute grokkability independent of its semantics is pointless. > ?'Solving' it is as impossible/meaningless as making all meaning > ?easily grokkable. In particular it would require unifying all > ?special notations people consider natural in all specialized domains, > ?and one would have to wonder why different human languages didn't > ?converge to it. Before machines, no one was asking/searching for > ?some 'easily grokkable syntax' for all constructive mathematics / > ?non-fiction. > > No one outside (naive) programming language design would consider that > ?anything but absurd. And even they don't go that far, instead making > ?an implementable claim that, sinces it's impossible to solve, > ?"every line should be easily readable / understandable" out of context, > ?by restricting it to certain primitives that appear syntactically in > ?the line (i.e. aren't abstracted by macros, though for some reason > ?classes, call-by-value functions, etc, are okay, with the exact mix > ?depending on a designer's prejudice, for a particular calendar year). > > But that's as absurd as saying that essays, specifications, etc, > ?should be written in grade school language, with the ability to make > ?definitions restricted in certain arbitrary ways (e.g. no "until", > ?verbs and only certain kinds of nouns) and then philosophy essays > ?would be easy to write, and children could read and understand them. > ?The mistake is an exercise for the reader (though (almost?) no > ?readers of this list), since at this point every one I've asked > ?knows it *is* a mistake there, and then translating the mistake > ?back to programming completes the exercise. > > To close, let me double-check that you aren't expecting the language > ?to do anything for you that it can't: no language will let students > ?understand a parsing program for cfgs without understanding what a > ?cfg is. It is *very* common, for students adapting to new syntax, > ?to claim they "know how to program it", but just not the syntax. > ?Experienced instructors know that this student inrospection is almost > ?always false, and that once the algorithm is truly understood, with > ?precision (to the level of mathematics / theory of CS), the student > ?has no problem with the syntax (I've had countless examples of this, > ?using diagrams, memory models, instructions for another human who > ?doesn't know the purpose of the instructions, etc, and then when > ?understood having the student exclaim "Oh!, then it's just [...] > ?in [language X]." > > I hope the length and content wasn't condescending, but the industry > ?is so muddled on this point that the following comic is ineresting > ?and/or funny to many: > > ?http://www.xkcd.com/568/ > From sbloch at adelphi.edu Sat Jun 13 23:10:26 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Sat Jun 13 23:11:19 2009 Subject: [BULK] Re: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> Message-ID: <1D1394F3-C8B7-4135-9449-72C73DE0B074@adelphi.edu> On Jun 13, 2009, at 18:00, Shriram Krishnamurthi wrote: > > The *type* of isinstance would be something like > > isinstance :: value x type -> boolean > > [Never mind that type should not be a type.] I'm missing something. Why shouldn't type be a type? > If you want this, and you want dynamic enforcement (which you seem > to), use the PLT contract system (not to be confused with "contracts > as comments" a la HtDP), which is about as sophisticated as you will > find in any language. Is there a way to get enforced contracts in PLT Scheme within a single module? Steve Bloch From carl.eastlund at gmail.com Sat Jun 13 23:20:55 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Sat Jun 13 23:21:20 2009 Subject: [BULK] Re: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <1D1394F3-C8B7-4135-9449-72C73DE0B074@adelphi.edu> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <1D1394F3-C8B7-4135-9449-72C73DE0B074@adelphi.edu> Message-ID: <990e0c030906132020td0736ech4be5d89dd8cdb9ff@mail.gmail.com> On Sat, Jun 13, 2009 at 11:10 PM, Stephen Bloch wrote: > > Is there a way to get enforced contracts in PLT Scheme within a single > module? Yes, the new "with-contract" construct allows contract boundaries at arbitrary places in programs: http://blog.plt-scheme.org/2009/02/new-contract-related-features.html http://docs.plt-scheme.org/reference/Attaching_Contracts_to_Values.html#(form._((lib._scheme/private/contract..ss)._with-contract)) -- Carl Eastlund From toddobryan at gmail.com Sat Jun 13 23:22:03 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sat Jun 13 23:22:29 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> Message-ID: <904774730906132022v495f03f7v7eee967ed9512b8@mail.gmail.com> On Sat, Jun 13, 2009 at 7:36 PM, Matthias Felleisen wrote: > > On Jun 13, 2009, at 7:04 PM, Todd O'Bryan wrote: > >> or am I still not correctly verbalizing/understanding what I'm asking for? > > You are but like a typical consumer and many computer scientists, you are > proposing a solution instead of stating and describing the problem. > That's largely because the problem reduces to, "I think there's something wrong that could be improved and I have a vague sense of what's wrong and what might fix it." Thanks for bearing with me. > 1. We made the decision to go without static types for good reason. You > don't want types (at the beginning). I really do (maybe wrongly). Because if I don't have types at the beginning, by the time types really count, students don't take them seriously. > 2. What we call contracts in BSL and what we call contracts in PLT Scheme is > only loosely related. So you don't want contracts either. Well, in the sense that contracts do dynamic type-checking, I think Shriram's right and I do kind of want something like contracts within modules. > 3. In the German version of HtDP, dubbed DeinProgram, you state HtDP-style > contracts in a formal language and they are checked as your BSL/ISL programs > are run. It would cut down your students' 'debugging' time a lot. See > DeinProgram in DrScheme, but you may need to know a bit of German. >From what I can tell, these are a lot like the contracts module, but they're executed on the current module rather than just across module boundaries. Am I missing something or is that roughly correct? I tried this program in Die Macht der Abstraktion - Anf?nger (: f (number number -> number)) (define f (lambda (x y) (+ x y))) and it worked as expected. Keeping the contract, but changing the function definition, I got: (define f (lambda (x) x)) and an error: 1 contract violation. wrong number of parameters, contract at line 1, column 5 Changing to put back the correct number of arguments, but mess up the return type: (define f (lambda (x y) "hi")) This yields no error when you press Run, and you can even call > (f 2 3) "hi" in the interactions window without an error. If, however, you put (f 2 3) in the Definitions, you get an error: 1 contract violation. got "hi" at line 6, column 0 , contract at line 1, column 23 to blame: procedure at line 3, column 2 This contrasts (obviously) with Typed Scheme, which throws a nice error if you try #lang typed-scheme (: f : Number Number -> Number) (define (f x y) "hi") but Typed Scheme also checks the interactions, so if I type this program in the definitions: #lang typed-scheme (: f : Number Number -> Number) (define (f x y) (+ x y)) and then try, in the interactions window, > (f 3 "7") typecheck: Expected Number, but got String in: "7" I get an error. > 4. We intend to support something like this sooner or later. Robby has been > working on this since 2004. I'm happy to help with something like this. I think it would be worth all the time I could throw at it. (It might not, however, be worth all the time you might waste dealing with my stupid questions. > 5. I don't understand how your students can have test cases for each > function and NOT see that their functions are producing the wrong things. > Code excerpts would be helpful. Here's a common example with a single function: ;; A family-tree-node (ftn) is: ;; empty, or ;; (make-ftn ftn ftn symbol number symbol) (define-struct ftn (father mother name dob eyes)) (define Carl (make-ftn empty empty 'Carl 1926 'green)) (define Bettina (make-ftn empty empty 'Bettina 1926 'green)) (define Adam (make-ftn Carl Bettina 'Adam 1950 'yellow)) (define Dave (make-ftn Carl Bettina 'Dave 1955 'black)) (define Eva (make-ftn Carl Bettina 'Eva 1965 'blue)) (define Fred (make-ftn empty empty 'Fred 1966 'pink)) (define Gustav (make-ftn Fred Eva 'Gustav 1988 'brown)) ;; names: ftn -> list-of-string ;; consumes: a ftn ;; produces: a list of all names of people reachable ;; from that ftn (define (names a-ftn) (cond [(empty? a-ftn) ""] [(ftn? a-ftn) (append (names (ftn-father a-ftn)) (names (ftn-mother a-ftn)) (list (ftn-name a-ftn)))])) (check-expect (names empty) "") (check-expect (names Adam) (list "Carl" "Bettina" "Adam")) The total error you get for this is: append: expected argument of type ; given "" Students look at the three arguments to append, see two calls to names and a list. names's contract says it returns a list-of-string, so they have no idea what could be going wrong. No, they don't notice the inconsistency between the contract they wrote and the value of "" as both the answer to one of the cond branches and one of their test cases. Where things really get confusing is if they use another function as an auxiliary that they've written wrong tests for and the errors end up buried inside the auxiliary call. As you said, checks within a module would help *a lot* with this kind of debugging. > P.S. For your reading pleasure, a first draft of the proposed teachpack for > providing type-of and friends: > > #lang scheme > > (require lang/prim) > > (provide type-of) > > ;; Any -> Type > (define (type-of a) > ?(cond > ? ?[(number? a) Number] > ? ?[(string? a) String] > ? ?[(boolean? a) Boolean] > ? ?[(procedure? a) Procedure] > ? ?[(type? a) Type])) > > (define-syntax-rule (def-types type? Name ...) > ?(begin (provide type? Name ...) > ? ? ? ? (define (type? x) > ? ? ? ? ? (member x (list Name ...))) > ? ? ? ? (define Name (gensym 'Name)) > ? ? ? ? ...)) > > (def-types type? Type Number String Boolean Procedure) Thanks! I'll take a crack at this building on your starting point. Please wait until I finish to tell me it's useless! :-) Always appreciative of the fact that really great minds will take my confused rants seriously, Todd From hendrik at topoi.pooq.com Sat Jun 13 23:32:26 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Sat Jun 13 23:39:37 2009 Subject: [BULK] Re: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <1D1394F3-C8B7-4135-9449-72C73DE0B074@adelphi.edu> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <1D1394F3-C8B7-4135-9449-72C73DE0B074@adelphi.edu> Message-ID: <20090614033226.GA1269@topoi.pooq.com> On Sat, Jun 13, 2009 at 11:10:26PM -0400, Stephen Bloch wrote: > > On Jun 13, 2009, at 18:00, Shriram Krishnamurthi > wrote: > > > > >The *type* of isinstance would be something like > > > > isinstance :: value x type -> boolean > > > >[Never mind that type should not be a type.] > > I'm missing something. Why shouldn't type be a type? No good reason at all, unles syou're into formal logic and type theory, in which case you find there are metarecursive loopholes which admit infinite proofs and nonterminating programs. So if you don't mind being able to write a nonterminating program occasionally, there's no particular reason why type shouldn't be a type. -- hendrik From hendrik at topoi.pooq.com Sat Jun 13 23:41:22 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Sat Jun 13 23:48:30 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> Message-ID: <20090614034121.GB1269@topoi.pooq.com> On Sat, Jun 13, 2009 at 05:45:42PM -0400, Todd O'Bryan wrote: > I'm starting to get really frustrated, because there are lots of > languages that have some of what I want in a beginning language, but > nothing that has everything. I'm beginning to worry that I'm going to > have to design my own language--worry because I have neither the time > nor background to do a good job of it. Here's what I'm looking for and > I'm beginning to be afraid that the intersection of this set is empty, > not just because no one's thought to do it, but because I'm > convoluting language layers in an impossible way. > > Here are my desiderata for a language to teach introductory > programming, through at least data structures: > > ------------------------- > > 1. Language Levels > The PLT/HtDP people are the only group I've seen who realize how > important this is, especially with sufficiently powerful languages, > and after seeing how useful it is for my students, I wouldn't trade > the idea for anything. Giving students access to only the stuff they > understand and tailoring error messages for the kinds of programs that > they should be writing is just too useful. This, of course, leaves out > every language but Scheme and Java as implemented in the HtDP and HtDC > language levels. > > 2. Types in the Language > Here's a sample Python interaction: > (For the uninitiated, >>> is the Python REPL prompt, the next line is > the result.) > > >>> int > > >>> type(int) > > >>> type(3) > > >>> isinstance(3, int) > True > >>> isinstance(3, float) > False > >>> class Foo: > ... pass > ... > >>> Foo > > >>> x = Foo() > >>> isinstance(x, Foo) > True > >>> type(isinstance) > > > OK, the last line is not particularly useful, but every Python value > knows what it is, these types are real objects in the language, and > programs can manipulate and ask questions about them. > > The contract is the first step of the design recipe for a very good > reason--students need to think about what kinds of values a function > consumes and what kind(s) of value it should produce. The problem is > that, in HtDP, contracts are just comments, and students figure this > out very quickly. I want types to impact students' programming, > because a huge proportion of the mistakes my students make have to do > with muddy thinking about types, and I think the programming > environment should make them be explicit about what they think is > going on and help them when they're wrong. Too many type-caused errors > don't get caught until several layers of redirection, leaving students > with stack traces that are, if not hard to follow, at least > intimidating. Even if Typed Scheme were all done and perfect, it > wouldn't provide this kind of support, mostly because that's not what > it's designed to do. > > 3. Static Typing > Yea for Python--I can play with types in the language. Boo for > Python--I can only find typing problems once I let the program run and > only if I happen to create a type problem. A program could be > completely brittle in terms of types and I'd never realize it. This is > exactly what statically-typed languages are designed to prevent, and > what Typed Scheme seems to be doing a really good job of. > (Unfortunately, I'm discovering just how many unfounded assumptions > about types I make as I'm writing in Typed Scheme, but I'm sure it's > on a par with how many unfounded assumptions I make in general.) I > want a language that screams bloody murder if the pieces don't fit > together right, even if some lazy student hasn't provided test cases > that trigger a problem. If you have static types, you can check them at compile time. And operations like typeod(foo) will be computed at compile time. It you have what you're asking in "types in the language", the things you call types are actually part of the data and, here's the important thing, they don't carry the same information. If I have a function, say (lambda(x) x), I can think of any number of static types for it. For example, int->int, f(int->int)->(int->int). And with static typing, you have to specify which you mean. But if you have so-called dynamic typing, you don't get this fine-grained information. You just find out it's a function. If you're elaborate, you might find it takes one argument and not two. -- hendrik From hendrik at topoi.pooq.com Sat Jun 13 23:50:19 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Sat Jun 13 23:57:28 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <904774730906132022v495f03f7v7eee967ed9512b8@mail.gmail.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> <904774730906132022v495f03f7v7eee967ed9512b8@mail.gmail.com> Message-ID: <20090614035019.GC1269@topoi.pooq.com> On Sat, Jun 13, 2009 at 11:22:03PM -0400, Todd O'Bryan wrote: > On Sat, Jun 13, 2009 at 7:36 PM, Matthias Felleisen wrote: > > > > On Jun 13, 2009, at 7:04 PM, Todd O'Bryan wrote: > > > >> or am I still not correctly verbalizing/understanding what I'm asking for? > > > > You are but like a typical consumer and many computer scientists, you are > > proposing a solution instead of stating and describing the problem. > > > > That's largely because the problem reduces to, "I think there's > something wrong that could be improved and I have a vague sense of > what's wrong and what might fix it." Thanks for bearing with me. > > > 1. We made the decision to go without static types for good reason. You > > don't want types (at the beginning). > I really do (maybe wrongly). Because if I don't have types at the > beginning, by the time types really count, students don't take them > seriously. Yeah... But if you have type from the start, students don't see the point. Types are just something that gets in the way of getting thir code running.... This breeds a desire for typeless langauges. I've learned that a rigorous static type-checker will catch almost all of my programming errors. I've had programs of a thousand lines run correctly the first time I get them through the compiler. But I would never have learned to appreciate strong static typing if I hadn't spent a lot of time without it. So perhaps you want a language that runs in two modes -- one typeless, to have everything crash regularly or get into hopeless data structure tangles, and one typed, where it tells you everything wrong at the outset. -- hendrik From hendrik at topoi.pooq.com Sun Jun 14 00:03:33 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Sun Jun 14 00:11:30 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> Message-ID: <20090614040333.GD1269@topoi.pooq.com> Languages to look at are Algol 68, Modula 3, and Eiffel. Modula 3 is available free from elego systems via www.modula3.org. Use the cm3 compiler; it's the one that's currently maintained. The m3devel mailing list is where to ask questions. THey're currently preparing a release and discovering that all their how-to-install docs are out of data, so it probably *will* require asking questions on the mailing list to get started right now. Eiffel is available free in a poorly docmented dialect called smarteifel. I do most of my programming at the moment in Modula 3. It's run-time secure, strongly-typed, statically typed (except for a few secure ways of handling dynamic data), garbage-collected, object-oriented, and efficient enough to be used as a systems langauge. An operating system has been written in it. It is wordy. It does help to be able to type. (pun intended) -- hendrik From marek at xivilization.net Sun Jun 14 05:50:59 2009 From: marek at xivilization.net (Marek Kubica) Date: Sun Jun 14 05:51:20 2009 Subject: [BULK] Re: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <990e0c030906132020td0736ech4be5d89dd8cdb9ff@mail.gmail.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <1D1394F3-C8B7-4135-9449-72C73DE0B074@adelphi.edu> <990e0c030906132020td0736ech4be5d89dd8cdb9ff@mail.gmail.com> Message-ID: <20090614115059.35b56350@halmanfloyd.lan.local> On Sat, 13 Jun 2009 23:20:55 -0400 Carl Eastlund wrote: > On Sat, Jun 13, 2009 at 11:10 PM, Stephen Bloch > wrote: > > > > Is there a way to get enforced contracts in PLT Scheme within a > > single module? > > Yes, the new "with-contract" construct allows contract boundaries at > arbitrary places in programs: Yes, I wassearching for this some time ago and was delighted when I stumbled upon that post in the blog. While contracts are a bit more tricky to use, they are vastly more flexible then type checks. One could implement type checks with contracts, but one could also check the integrity of the passed values, like heap? or sorted? or something like this. regards, /M From marek at xivilization.net Sun Jun 14 06:16:19 2009 From: marek at xivilization.net (Marek Kubica) Date: Sun Jun 14 06:16:41 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <20090614035019.GC1269@topoi.pooq.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> <904774730906132022v495f03f7v7eee967ed9512b8@mail.gmail.com> <20090614035019.GC1269@topoi.pooq.com> Message-ID: <20090614121619.5b48f663@halmanfloyd.lan.local> On Sat, 13 Jun 2009 23:50:19 -0400 hendrik@topoi.pooq.com wrote: > On Sat, Jun 13, 2009 at 11:22:03PM -0400, Todd O'Bryan wrote: > > On Sat, Jun 13, 2009 at 7:36 PM, Matthias > > Felleisen wrote: > > > > > > On Jun 13, 2009, at 7:04 PM, Todd O'Bryan wrote: > > > > > >> or am I still not correctly verbalizing/understanding what I'm > > >> asking for? > > > > > > You are but like a typical consumer and many computer scientists, > > > you are proposing a solution instead of stating and describing > > > the problem. > > > > > > > That's largely because the problem reduces to, "I think there's > > something wrong that could be improved and I have a vague sense of > > what's wrong and what might fix it." Thanks for bearing with me. > > > > > 1. We made the decision to go without static types for good > > > reason. You don't want types (at the beginning). > > I really do (maybe wrongly). Because if I don't have types at the > > beginning, by the time types really count, students don't take them > > seriously. > > Yeah... But if you have type from the start, students don't see the > point. Types are just something that gets in the way of getting thir > code running.... This breeds a desire for typeless langauges. The desire for dynamically typed languages is also caused by crappy static type systems which are not expressive enough to build some kind of data structures, throw type errors at runtime (!) and need to be circumvented to build anything more advanced. regards, Marek From martindemello at gmail.com Sun Jun 14 07:19:02 2009 From: martindemello at gmail.com (Martin DeMello) Date: Sun Jun 14 07:19:20 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> Message-ID: On Sun, Jun 14, 2009 at 5:06 AM, Matthias Felleisen wrote: > > All in all you aren't asking for a perfect language. You're asking for very > doable things. (Python's nonsense confused the heck out of you. Give up on > it. Study ML and then jump to Cayenne. Students will never mistakes again, > because they won't get any programs past the type checkers :-) Straying further off topic, has anyone done a teaching-oriented ML dialect, or even a first year course based on SML? I'd love to see such a thing. I've seen Helium, but (personal prejudices showing through) strict evaluation seems a lot more suitable for a beginner's language. martin From jpc-ml at zenburn.net Sun Jun 14 07:22:04 2009 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Sun Jun 14 07:22:26 2009 Subject: [plt-scheme] [OT] Re: [plt-dev] reading symbols beginning with colon as keywords? In-Reply-To: <756daca50906131926x12852629g6d5e9b77acb9eeb0@mail.gmail.com> References: <4A33D645.5030902@neilvandyke.org> <4A343C54.5040908@cs.utah.edu> <756daca50906131926x12852629g6d5e9b77acb9eeb0@mail.gmail.com> Message-ID: <4A34DD5C.2050202@zenburn.net> On 6/14/09 4:26 AM, Grant Rettke wrote: > On Sat, Jun 13, 2009 at 6:55 PM, Chongkai Zhu wrote: >> You can do this on your own code with readtables: > > If you put it in base you would lure Ruby programmers to PLT. And if you support keywords *ending* with : you will lure Smalltalkers and Objective-C-ers. ;) -- regards, Jakub Piotr C?apa From noelwelsh at gmail.com Sun Jun 14 07:51:02 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Sun Jun 14 07:51:21 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> Message-ID: On Sun, Jun 14, 2009 at 12:19 PM, Martin DeMello wrote: > Straying further off topic, has anyone done a teaching-oriented ML > dialect, or even a first year course based on SML? I believe the first year at Cambridge uses ML. The issue is one of usability. It is pretty easy to get ML to spit out an incomprehensible type error at a location far removed from the original error, and ML's type system is fairly simple. Furthermore, I believe the experience of the PLT crew and others is that allowing students to experiment with their programs -- actually run them despite type errors -- leads to better understanding. [And this is a valid complaint against a lot of theory-oriented work done in programming languages. ICFP, for example, is full of papers describing exotic type systems which is all well in theory, but what happens when someone outside the research group actually tries to use them?] N. From hendrik at topoi.pooq.com Sun Jun 14 08:18:53 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Sun Jun 14 08:26:04 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <20090614121619.5b48f663@halmanfloyd.lan.local> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> <904774730906132022v495f03f7v7eee967ed9512b8@mail.gmail.com> <20090614035019.GC1269@topoi.pooq.com> <20090614121619.5b48f663@halmanfloyd.lan.local> Message-ID: <20090614121853.GB2277@topoi.pooq.com> On Sun, Jun 14, 2009 at 12:16:19PM +0200, Marek Kubica wrote: > On Sat, 13 Jun 2009 23:50:19 -0400 > hendrik@topoi.pooq.com wrote: > > > On Sat, Jun 13, 2009 at 11:22:03PM -0400, Todd O'Bryan wrote: > > > On Sat, Jun 13, 2009 at 7:36 PM, Matthias > > > Felleisen wrote: > > > > > > > > On Jun 13, 2009, at 7:04 PM, Todd O'Bryan wrote: > > > > > > > >> or am I still not correctly verbalizing/understanding what I'm > > > >> asking for? > > > > > > > > You are but like a typical consumer and many computer scientists, > > > > you are proposing a solution instead of stating and describing > > > > the problem. > > > > > > > > > > That's largely because the problem reduces to, "I think there's > > > something wrong that could be improved and I have a vague sense of > > > what's wrong and what might fix it." Thanks for bearing with me. > > > > > > > 1. We made the decision to go without static types for good > > > > reason. You don't want types (at the beginning). > > > I really do (maybe wrongly). Because if I don't have types at the > > > beginning, by the time types really count, students don't take them > > > seriously. > > > > Yeah... But if you have type from the start, students don't see the > > point. Types are just something that gets in the way of getting thir > > code running.... This breeds a desire for typeless langauges. > > The desire for dynamically typed languages is also caused by crappy > static type systems which are not expressive enough to build some kind > of data structures, throw type errors at runtime (!) and need to be > circumvented to build anything more advanced. I quite agree. It shouldn't be all-or-nothing. I like the static type REFANY in Modula 3. Values of type REFANY can point to anything, but also contain a type tag to identify what is being pointed to. It's rarely used, but when it is used, it's usually essential. There's just enough syntactic overhead to it that you tend only to use it when needed. The rest of the time static types on the usual ordinary types find bugs statically. -- hendrik From hendrik at topoi.pooq.com Sun Jun 14 08:21:48 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Sun Jun 14 08:29:01 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <20090614040333.GD1269@topoi.pooq.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <20090614040333.GD1269@topoi.pooq.com> Message-ID: <20090614122148.GC2277@topoi.pooq.com> On Sun, Jun 14, 2009 at 12:03:33AM -0400, hendrik@topoi.pooq.com wrote: > Languages to look at are Algol 68, Modula 3, and Eiffel. > > Modula 3 is available free from elego systems via www.modula3.org. Use > the cm3 compiler; it's the one that's currently maintained. The m3devel > mailing list is where to ask questions. THey're currently preparing a > release and discovering that all their how-to-install docs are out of > data, so it probably *will* require asking questions on the mailing list > to get started right now. > > Eiffel is available free in a poorly docmented dialect called smarteifel. > > I do most of my programming at the moment in Modula 3. It's run-time > secure, strongly-typed, statically typed (except for a few secure ways > of handling dynamic data), garbage-collected, object-oriented, and > efficient enough to be used as a systems langauge. An operating system > has been written in it. It is wordy. It does help to be able to type. > (pun intended) > > -- hendrik But none of these languages have an easy metarecursive loop, which is the hallmark of Lisp. If that's what you're looking for in a teaching lannguage, there aren't the ones you need. -- hendrik From morazanm at gmail.com Sun Jun 14 09:26:54 2009 From: morazanm at gmail.com (Marco Morazan) Date: Sun Jun 14 09:27:16 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <904774730906132022v495f03f7v7eee967ed9512b8@mail.gmail.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> <904774730906132022v495f03f7v7eee967ed9512b8@mail.gmail.com> Message-ID: <9b1fff280906140626u4f9725a1y7fb1c8ce257ba0cc@mail.gmail.com> >> 5. I don't understand how your students can have test cases for each >> function and NOT see that their functions are producing the wrong things. >> Code excerpts would be helpful. > Here's a common example with a single function: > > ;; A family-tree-node (ftn) is: > ;; empty, or > ;; (make-ftn ftn ftn symbol number symbol) > (define-struct ftn (father mother name dob eyes)) > > (define Carl (make-ftn empty empty 'Carl 1926 'green)) > (define Bettina (make-ftn empty empty 'Bettina 1926 'green)) > (define Adam (make-ftn Carl Bettina 'Adam 1950 'yellow)) > (define Dave (make-ftn Carl Bettina 'Dave 1955 'black)) > (define Eva (make-ftn Carl Bettina 'Eva 1965 'blue)) > (define Fred (make-ftn empty empty 'Fred 1966 'pink)) > (define Gustav (make-ftn Fred Eva 'Gustav 1988 'brown)) > > > ;; names: ftn -> list-of-string > ;; consumes: a ftn > ;; produces: a list of all names of people reachable > ;; ? ? ? ? ? from that ftn > (define (names a-ftn) > ?(cond > ? ?[(empty? a-ftn) ""] > ? ?[(ftn? a-ftn) (append (names (ftn-father a-ftn)) > ? ? ? ? ? ? ? ? ? ? ? ? ?(names (ftn-mother a-ftn)) > ? ? ? ? ? ? ? ? ? ? ? ? ?(list (ftn-name a-ftn)))])) > > (check-expect (names empty) "") > (check-expect (names Adam) (list "Carl" "Bettina" "Adam")) > > The total error you get for this is: > append: expected argument of type ; given "" > > Students look at the three arguments to append, see two calls to names > and a list. names's contract says it returns a list-of-string, so they > have no idea what could be going wrong. No, they don't notice the > inconsistency between the contract they wrote and the value of "" as > both the answer to one of the cond branches and one of their test > cases. Hmmm.....I am sorry to say that I do not find this yelling for types in a beginner's course. As a dedicated and caring instructor, I suggest that you accept these "growing pains" students must go through. Getting types right can be a tricky proposition for those that are taking their first steps in programming. Let's think about the whole process students go through to produce a working function. There is that rather "giant" step of designing the function correctly (giant eventhough HtDP makes it as easy as it can be) and there is the other "giant" step of getting the syntax right. Do we want to pile on top of these getting the types right? I think students are better served without static types at the beginning. Let them run into dynamic type errors and think through their design which is where the focus should be. They can learn a lot from such errors and growing pains. One of the valuable lessons may be that errors are usually in the design. One of the bad habits they may not pick up is to simply try to get a type "right" that allows the program to run. I have seen my fair share of students that do not dare to change the types in their programs, because "the program runs with them." Forget the fact that they really have the design wrong and, therefore, the wrong types. If the above is not convincing, how about getting beginning students to write typed programs for abstract functions that manipulate compound data structures? How about getting the types right for programs that use encapsulation? All of the sudden, types get in the way of undertsanding fundamental concepts. Be careful for what you wish for! Just one more note, do you really like Python as a language for beginners? Not only is it typed, but it has objects! Objects without understanding abstraction is a recipe for developing poor programming habits IMHO. I fully expect to get some noses out of joint with this last comment, but it is meant to stimulate thought not controversy. -- Cheers, Marco From toddobryan at gmail.com Sun Jun 14 10:37:30 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sun Jun 14 10:37:52 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <9b1fff280906140626u4f9725a1y7fb1c8ce257ba0cc@mail.gmail.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> <904774730906132022v495f03f7v7eee967ed9512b8@mail.gmail.com> <9b1fff280906140626u4f9725a1y7fb1c8ce257ba0cc@mail.gmail.com> Message-ID: <904774730906140737x6f8465d1na4a37c7e5158a574@mail.gmail.com> On Sun, Jun 14, 2009 at 9:26 AM, Marco Morazan wrote: > > Hmmm.....I am sorry to say that I do not find this yelling for types > in a beginner's course. As a dedicated and caring instructor, I > suggest that you accept these "growing pains" students must go > through. Getting types right can be a tricky proposition for those > that are taking their first steps in programming. Let's think about > the whole process students go through to produce a working function. > There is that rather "giant" step of designing the function correctly > (giant eventhough HtDP makes it as easy as it can be) and there is the > other "giant" step of getting the syntax right. Do we want to pile on > top of these getting the types right? I think students are better > served without static types at the beginning. Let them run into > dynamic type errors and think through their design which is where the > focus should be. See, I think that the problems that students have with design are because they don't pay enough attention to the types. The example I cited of returning "" instead of empty is quite common. Part of getting the design right is figuring out how the pieces *have* to fit together because of the types that they have. I think this is why writing the contract is the first step in the design recipe. If you don't know what kinds of things your function is supposed to consume and produce, you have no hope of getting the function right. And if you get the types wrong and program to the contract, you're guaranteed to get a function that won't work. > They can learn a lot from such errors and growing > pains. One of the valuable lessons may be that errors are usually in > the design. One of the bad habits they may not pick up is to simply > try to get a type "right" that allows the program to run. I have seen > my fair share of students that do not dare to change the types in > their programs, because "the program runs with them." Forget the fact > that they really have the design wrong and, therefore, the wrong > types. This is a valid point, but I much more often see students who have test cases that don't match contracts and refuse to change the test cases that work. > If the above is not convincing, how about getting beginning students > to write typed programs for abstract functions that manipulate > compound data structures? How about getting the types right for > programs that use encapsulation? All of the sudden, types get in the > way of undertsanding fundamental concepts. Be careful for what you > wish for! I disagree completely with this. When we get to abstract list functions, I think it's the types that keep students sane. To use build-list, map, filter, and the folds correctly, I think students *have* to consciously think about the types. Now, whether they have to get the fully abstracted types with type variables correct is something I'm not too insistent about, but I don't have them write lots of functions that require those. Mostly I want them to use the abstract list functions to solve particular problems in terser ways. On the other hand, correctly figuring out the types of abstract list functions is almost mechanical. After we go through the examples in Part IV, we develop the following "algorithm" for abstraction: If you notice a similarity between structures, abstract a more general form: a. For everything that is the same, keep it the same. b. For everything that is different, introduce a variable. You can just as easily apply (b) to types in contracts as to values within functions. When we abstract fold from sum and product, we get ;; fold:(number number -> number) number (listof number) -> number (define (fold op val-for-empty alon) (cond [(empty? alon) val-for-empty] [(cons? alon) (op (first alon) (fold op val-for-empty (rest alon)))])) I then push this, asking students if this function only works for numbers. We figure out what the type would be if we didn't limit ourselves to numbers, and we notice that the first and second arguments to the op don't have to be the same type, but that there's a dependency relationship between the types of val-for-empty and the return type. > Just one more note, do you really like Python as a language for > beginners? Not only is it typed, but it has objects! Objects without > understanding abstraction is a recipe for developing poor programming > habits IMHO. I fully expect to get some noses out of joint with this > last comment, but it is meant to stimulate thought not controversy. Yes and no. I actually switch to Python with a few weeks left in the year and re-visit many of the same concepts we did in Scheme. Python doesn't have static type-checking, so it's no more useful than Scheme at getting students to be less muddle-headed about their contracts, but the syntax sets them up for Java, which I have to teach the next year because of AP concerns. Your concern about introducing OO is a valid one, and it's one reason that I love to do Python before Java. I have a series of assignments where I introduce classes as equivalent to Scheme structures--boxes that can hold a number of values with labels. We then write a bunch of functions on these classes--functions, not methods. The next step is to move the functions inside the classes. class Foo: pass def fun_for_foo(foo, arg1, arg2): blah becomes class Foo: def method(self, arg1, arg2): blah Here, Python's explicitness in requiring "self" for the first argument to a method lets me point out the equivalence of fun_for_foo(foo, arg1, arg2) and foo.method(arg1, arg2) The last assignment involves finding similarities in methods across classes and then abstracting these out into a super-class. I find that hitting all the same concepts in another language--conditionals, function definitions, lists, strings, recursion, abstraction--drives home to students that these are general concepts that all languages share. They just express them in different ways. I also use Python to introduce mutation and looping constructs, since the AP committee seems to be greatly enamored of those things and it helps if my students have seen them before I have to hit them hard in the AP course. So, no, I wouldn't do Python (in its current form) as a student's first language. But if it were given the kind of treatment that HtDP has applied to Scheme, so that the language was tailored to what students should be able to do at a particular point, I don't think it would be awful. Yes, the syntax is more complicated than Scheme, but the fact that indentation is meaningful means that getting the syntax right also forces students to write code that's relatively easy to read. And the syntax is terser and more regular than Java, which is a huge plus. Todd From mflatt at cs.utah.edu Sun Jun 14 11:25:51 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Sun Jun 14 11:26:17 2009 Subject: [plt-scheme] poll: keyword syntax Message-ID: <20090614152554.ABAB96500CF@mail-svr1.cs.utah.edu> I'm curious about the popularity of different syntaxes for keywords among the readers of this mailing list. Specifically, I'm curious about the relative popularity of a "#:" prefix (which is what we currently have), a ":" prefix, or a ":" suffix. Let me know what you think by visiting http://rains.cs.utah.edu:8000/ The "vote" is not binding in any sense. I'd just like to get a better idea of what PLT Scheme programmers think, since I consider the question to be purely a matter if opinion --- and not worth debating at all on the list. :) I'll report results back here in a few days. Thanks! Matthew From martindemello at gmail.com Sun Jun 14 12:23:20 2009 From: martindemello at gmail.com (Martin DeMello) Date: Sun Jun 14 12:23:38 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> Message-ID: On Sun, Jun 14, 2009 at 5:21 PM, Noel Welsh wrote: > > The issue is one of usability. It is pretty easy to get ML to spit out > an incomprehensible type error ?at a location far removed from the > original error, and ML's type system is fairly simple. I wonder, is that an insuperable problem, or simply one no one has cared to solve because ML is not a teaching language and the feeling is that users can learn? > Furthermore, I > believe the experience of the PLT crew and others is that allowing > students to experiment with their programs -- actually run them > despite type errors -- leads to better understanding. That is a good point; I just feel that ML comes closest to mirroring what is taught in datastructures and algorithms courses, without much impedance mismatch. It's far more "executable pseudocode" than pascal was, in that way (or maybe pseudocode has just become more ML-influenced over time :)). martin From matthias at ccs.neu.edu Sun Jun 14 13:02:08 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sun Jun 14 13:02:45 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <904774730906140737x6f8465d1na4a37c7e5158a574@mail.gmail.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> <904774730906132022v495f03f7v7eee967ed9512b8@mail.gmail.com> <9b1fff280906140626u4f9725a1y7fb1c8ce257ba0cc@mail.gmail.com> <904774730906140737x6f8465d1na4a37c7e5158a574@mail.gmail.com> Message-ID: <810794A5-FD9B-472F-8CE1-27A6B2C8D001@ccs.neu.edu> Todd and Marco, for your reading pleasure I have translated this student's program into DeinProgram (ISL, basically): see end of message. I will say the results surprised me in two ways: -- At first I ran the program as given, and got an error about APPEND, not a contract error concerning names. In other words, the Run stops at the exact same place as the Run of the original program in ISL. -- Then I commented out the second unit test case to find out how DeinProgram would react now. Surprise again. It told me that the test case had passed AND that the contract had failed. (I will let you figure out why both behaviors surprise me.) Working with the program has also clarified how I would go about this pedagogically, with what exists now, and in the future. I'll post these thoughts separately. -- Matthias ;; A family-tree-node (ftn) is: ;; empty, or ;; (make-ftn ftn ftn symbol number symbol) (define-record-procedures ftn make-ftn ftn? (ftn-father ftn-mother ftn-name ftn-dob ftn-eyes)) (define Carl (make-ftn empty empty "Carl" 1926 "green")) (define Bettina (make-ftn empty empty "Bettina" 1926 "green")) (define Adam (make-ftn Carl Bettina "Adam" 1950 "yellow")) (define Dave (make-ftn Carl Bettina "Dave" 1955 "black")) (define Eva (make-ftn Carl Bettina "Eva" 1965 "blue")) (define Fred (make-ftn empty empty "Fred" 1966 "pink")) (define Gustav (make-ftn Fred Eva "Gustav" 1988 "brown")) (: names (ftn -> (List string))) ;; consumes: a ftn ;; produces: a list of all names of people reachable ;; from that ftn (define names (lambda (a-ftn) (cond [(empty? a-ftn) ""] [(ftn? a-ftn) (append (names (ftn-father a-ftn)) (names (ftn-mother a-ftn)) (list (ftn-name a-ftn)))]))) (check-expect (names empty) "") ;(check-expect (names Adam) (list "Carl" "Bettina" "Adam")) From ramalho at gmail.com Sun Jun 14 13:06:43 2009 From: ramalho at gmail.com (Luciano Ramalho) Date: Sun Jun 14 13:07:04 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <904774730906140737x6f8465d1na4a37c7e5158a574@mail.gmail.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> <904774730906132022v495f03f7v7eee967ed9512b8@mail.gmail.com> <9b1fff280906140626u4f9725a1y7fb1c8ce257ba0cc@mail.gmail.com> <904774730906140737x6f8465d1na4a37c7e5158a574@mail.gmail.com> Message-ID: <4331ad810906141006w376e3f79jb1c7f0718c4ad92b@mail.gmail.com> > Yes, [Python] syntax is more complicated than Scheme, I am just learning Scheme and really enjoying it. I've listened to Shriram's excellent talk "The Swine Before Perl" in which he denies that Python's "Relatively main-stream syntax" is an advantage with the question "at what price?" http://www.cs.brown.edu/~sk/Publications/Talks/SwineBeforePerl/ I understand the value of macros in Scheme, so yes, any language that has a syntax that makes macros unworkable is paying a high price. But there's no free lunch, right? The price of parenthetical syntax is a violation of a basic principle of usability stated by Donald Normal in his book "The Design of Everyday Things": things that are similar should look similar, things that are different should look different (I don't have the book with me now, so this is not a verbatim quote). If I see: (x y z) I have no idea how that will be evaluated, whether y or z will ever be evaluated, and if so, in what order. I have to find out whether x is a function or some other form, because the syntax gives me no clue. So perhaps the syntax of Scheme is not just simple, but actually too simple, when its regularity hides differences in the way different forms are interpreted. I have the highest respect for the professors in this list and their work, so I am not trying to start a flamewar. I'd just like to hear what you think of my claim that there is a price to pay for parenthetical syntax, and that is price is not limited to the overabundance of parenthesis. Probably there have been worthwhile discussions of this in the past. If so, please send me pointers. Cheers, Luciano From ramalho at gmail.com Sun Jun 14 13:18:10 2009 From: ramalho at gmail.com (Luciano Ramalho) Date: Sun Jun 14 13:18:28 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <4331ad810906141006w376e3f79jb1c7f0718c4ad92b@mail.gmail.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> <904774730906132022v495f03f7v7eee967ed9512b8@mail.gmail.com> <9b1fff280906140626u4f9725a1y7fb1c8ce257ba0cc@mail.gmail.com> <904774730906140737x6f8465d1na4a37c7e5158a574@mail.gmail.com> <4331ad810906141006w376e3f79jb1c7f0718c4ad92b@mail.gmail.com> Message-ID: <4331ad810906141018x23dc7649pda8d738d88e6a967@mail.gmail.com> On Sun, Jun 14, 2009 at 2:06 PM, Luciano Ramalho wrote: > The price of parenthetical syntax is a violation of a basic principle > of usability stated by Donald Normal in his book "The Design of > Everyday Things": things that are similar should look similar, things > that are different should look different (I don't have the book with > me now, so this is not a verbatim quote). I mistyped the name of the author: it's Donald Norman, of course. The book is this: http://www.amazon.com/Design-Everyday-Things-Donald-Norman/dp/0385267746 In the book, Norman illustrates the idea that different things should look different with a wonderful photograph from the control panel of a power plant. The panel is full of gauges, dials and has two large control levers, which look exactly alike but do totally different thinks. So the operators of the power plant fitted tap handles with two different beer brands on the levers, to make them easier to tell apart. Cheers, Luciano From sk at cs.brown.edu Sun Jun 14 13:24:13 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Sun Jun 14 13:24:52 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <4331ad810906141006w376e3f79jb1c7f0718c4ad92b@mail.gmail.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> <904774730906132022v495f03f7v7eee967ed9512b8@mail.gmail.com> <9b1fff280906140626u4f9725a1y7fb1c8ce257ba0cc@mail.gmail.com> <904774730906140737x6f8465d1na4a37c7e5158a574@mail.gmail.com> <4331ad810906141006w376e3f79jb1c7f0718c4ad92b@mail.gmail.com> Message-ID: My talk was meant to be at least partially rhetorical, and those bullets were not meant to be taken *too* seriously. I don't think you can apply glib arguments like Don Norman's to a situation complicated like language syntax. First of all, Python too has various similarities (good heavens, it uses ASCII syntax for *everything*); second, Scheme has only a few concepts; third, your argument is sort of bogus, because (x y z) cannot be a macro unless you've defined `x' to be a macro keyword. There are no "higher-order" macros, so if it's a macro, it has to be the name of a macro keyword, nothing else. This is why, fourth, this is virtually never a problem in practice. People program in a well-subscribed (super)set of Scheme, and that's that. In PLT, we make this (super)set completely explicit with the #lang qualifier. It is true that if you don't know what macros are operational, you can be in some trouble. If you're in DrScheme, this problem goes away. > Probably there have been worthwhile discussions of this in the past. Not to be too cynical, but precisely this discussion happens on some parenthetical list or the other about once every two years. In response, I feel there should be a new kind of FAQ called a FooAQ. In a FooAQ, you only list the (frequent) questions. The response is always the same: "Foo". Meaning, "We've had this debate for decades, and nobody has resolved anything because everyone (eventually) understands the trade-offs". (Yes, "Foo" is a macro.) Shriram From hendrik at topoi.pooq.com Sun Jun 14 13:35:28 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Sun Jun 14 13:42:44 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> Message-ID: <20090614173528.GA2793@topoi.pooq.com> On Sun, Jun 14, 2009 at 12:51:02PM +0100, Noel Welsh wrote: > On Sun, Jun 14, 2009 at 12:19 PM, Martin DeMello wrote: > > Straying further off topic, has anyone done a teaching-oriented ML > > dialect, or even a first year course based on SML? > > I believe the first year at Cambridge uses ML. > > The issue is one of usability. It is pretty easy to get ML to spit out > an incomprehensible type error at a location far removed from the > original error, and ML's type system is fairly simple. Yes, that happens. Usually because ML uses type inference, and decides what types things have based on the programming errors.... Then someplace else (possibly someplace correct) it craps out. The solution is to explicitly specify types much more frequently, so that wrong types have no chance to propagate. In other words, throw out the sophisticated type-inference engine, and force the user to specify types explicitly in lots of places. Yes. this is wordy and redundant. But it sure helps locate errors. Programs where this is not done are also really, really difficult to understand. Other than that, ML is probably fine. > Furthermore, I > believe the experience of the PLT crew and others is that allowing > students to experiment with their programs -- actually run them > despite type errors -- leads to better understanding. I agree here. -- hendrik > > [And this is a valid complaint against a lot of theory-oriented work > done in programming languages. ICFP, for example, is full of papers > describing exotic type systems which is all well in theory, but what > happens when someone outside the research group actually tries to use > them?] > > N. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From ramalho at gmail.com Sun Jun 14 13:54:56 2009 From: ramalho at gmail.com (Luciano Ramalho) Date: Sun Jun 14 13:55:17 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> <904774730906132022v495f03f7v7eee967ed9512b8@mail.gmail.com> <9b1fff280906140626u4f9725a1y7fb1c8ce257ba0cc@mail.gmail.com> <904774730906140737x6f8465d1na4a37c7e5158a574@mail.gmail.com> <4331ad810906141006w376e3f79jb1c7f0718c4ad92b@mail.gmail.com> Message-ID: <4331ad810906141054g5d69759fq1f8410f4c2318c99@mail.gmail.com> On Sun, Jun 14, 2009 at 2:24 PM, Shriram Krishnamurthi wrote: > My talk was meant to be at least partially rhetorical, and those > bullets were not meant to be taken *too* seriously. That much is clear. It was a good talk, though. Thanks for making it available with the audio file. > I don't think you can apply glib arguments like Don Norman's to a > situation complicated like language syntax. I don't think it is a glib argument at all, perhaps my very short rendition of the argument is glib. Concrete language syntax is meant for humans after all, so I the perspective from user studies is very relevant. By the way, if some of you have pointers about human factors in programming language design, I am very interested in studying that, perhaps even as a main focus in graduate school. > First of all, Python too > has various similarities (good heavens, it uses ASCII syntax for > *everything*); second, Scheme has only a few concepts; third, your > argument is sort of bogus, because > > ?(x y z) > > cannot be a macro unless you've defined `x' to be a macro keyword. OK, but there are numerous macros or special forms that are pre-defined in Scheme, and many of them look like (x y z) but have different evaluation rules. > There are no "higher-order" macros, so if it's a macro, it has to be > the name of a macro keyword, nothing else. ?This is why, fourth, this > is virtually never a problem in practice. ?People program in a > well-subscribed (super)set of Scheme, and that's that. ?In PLT, we > make this (super)set completely explicit with the #lang qualifier. > > It is true that if you don't know what macros are operational, you can > be in some trouble. ?If you're in DrScheme, this problem goes away. > >> Probably there have been worthwhile discussions of this in the past. > > Not to be too cynical, but precisely this discussion happens on some > parenthetical list or the other about once every two years. ?In > response, I feel there should be a new kind of FAQ called a FooAQ. ?In > a FooAQ, you only list the (frequent) questions. ?The response is > always the same: "Foo". ?Meaning, "We've had this debate for decades, > and nobody has resolved anything because everyone (eventually) > understands the trade-offs". ?(Yes, "Foo" is a macro.) Prof. Shriram, I never meant to convince you or anyone else here that the "usability cost" of parenthetical syntax outweights its benefits. Even a newbie like me understands the trade-off and appreciates the benefits. I just wanted to point out that the "simple" syntax of Scheme does not make it necessarily easier to read than other syntaxes that are not so regular. Cheers, Luciano From sk at cs.brown.edu Sun Jun 14 14:11:50 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Sun Jun 14 14:12:29 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <4331ad810906141054g5d69759fq1f8410f4c2318c99@mail.gmail.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> <904774730906132022v495f03f7v7eee967ed9512b8@mail.gmail.com> <9b1fff280906140626u4f9725a1y7fb1c8ce257ba0cc@mail.gmail.com> <904774730906140737x6f8465d1na4a37c7e5158a574@mail.gmail.com> <4331ad810906141006w376e3f79jb1c7f0718c4ad92b@mail.gmail.com> <4331ad810906141054g5d69759fq1f8410f4c2318c99@mail.gmail.com> Message-ID: >> I don't think you can apply glib arguments like Don Norman's to a >> situation complicated like language syntax. > > I don't think it is a glib argument at all, perhaps my very short > rendition of the argument is glib. > > Concrete language syntax is meant for humans after all, so I the > perspective from user studies is very relevant. Obviously. > By the way, if some of you have pointers about human factors in > programming language design, I am very interested in studying that, > perhaps even as a main focus in graduate school. Most of the work on this is pretty cruddy to the point of not being useful at all (or even wrong, in that it confuses causes and effects, or fails to account for confounding variables). I'm starting a new project at Brown (collaboration with WPI and a person in Boston) that is doing this from first principles in a more rigorous way. There are numerous issues that warrant studying here. > OK, but there are numerous macros or special forms that are > pre-defined in Scheme, and many of them look like (x y z) but have > different evaluation rules. When you read SLaTeX'ed code, the keywords are written in boldface. Function names are not. So the distinction is made clear. DrScheme could do this on Check Syntax (though it presently does not). > I just wanted to point out that the "simple" syntax of Scheme does not > make it necessarily easier to read than other syntaxes that are not so > regular. Yes, I know. And I not only understand your claim, I even somewhat agree with it. On some of our mailing lists you'll see me arguing for internal keywords and other "signposts" for reading. And in PLT, we have experimented with infix syntax multiple times. Unfortunately, designing a good infix syntax seems to be staggeringly hard, and the results can feel much worse than Scheme when it's done poorly (cf. JavaScript). And even when someone thinks they have it right, they make absolute idiots of themselves by publicly blogging their ignorance about tail calls. (-: Shriram From sbloch at adelphi.edu Sun Jun 14 14:32:49 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Sun Jun 14 14:36:14 2009 Subject: [BULK] Re: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <20090614033226.GA1269@topoi.pooq.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <1D1394F3-C8B7-4135-9449-72C73DE0B074@adelphi.edu> <20090614033226.GA1269@topoi.pooq.com> Message-ID: <620BD8F6-2AC0-48EE-A58F-A75E2D676C42@adelphi.edu> I wrote: >> I'm missing something. Why shouldn't type be a type? To which Hendrik replied: > No good reason at all, unles syou're into formal logic and type > theory, > in which case you find there are metarecursive loopholes which admit > infinite proofs and nonterminating programs. > > So if you don't mind being able to write a nonterminating program > occasionally, there's no particular reason why type shouldn't be a > type. For those of us who have studied logic but not (much) language theory, could you elaborate on this? Obviously a program that keeps iterating "type-of" until reaching something that doesn't have a type will go infinite if everything (including "type") has a type, but that's inevitable; is there a more interesting and reasonably short example? Steve Bloch From matthias at ccs.neu.edu Sun Jun 14 14:38:35 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sun Jun 14 14:39:08 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <4331ad810906141054g5d69759fq1f8410f4c2318c99@mail.gmail.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> <904774730906132022v495f03f7v7eee967ed9512b8@mail.gmail.com> <9b1fff280906140626u4f9725a1y7fb1c8ce257ba0cc@mail.gmail.com> <904774730906140737x6f8465d1na4a37c7e5158a574@mail.gmail.com> <4331ad810906141006w376e3f79jb1c7f0718c4ad92b@mail.gmail.com> <4331ad810906141054g5d69759fq1f8410f4c2318c99@mail.gmail.com> Message-ID: On Jun 14, 2009, at 1:54 PM, Luciano Ramalho wrote: > Prof. Shriram, I never meant to convince you or anyone else here that > the "usability cost" of parenthetical syntax outweights its benefits. > Even a newbie like me understands the trade-off and appreciates the > benefits. > > I just wanted to point out that the "simple" syntax of Scheme does not > make it necessarily easier to read than other syntaxes that are not so > regular. (Luciano, you don't have to call us professors or anything. The fact that we have academic titles is meaningless. Too many 'professors' think the title is enough to intimidate people into believing them. It's awful. The fact that we're older is meaningless, too. It just means we're closer to death (on the average).) What is meaningful is that we have demonstrated and keep demonstrating a broad and deep grasp of the material. As for syntax, I think you're onto something. It is also true that even we're stumped when reading others' code. I bet that I could stump Shriram with 1000s of snippets of code from our code basis and I bet that the converse is true, too. While it is true that tools and experience in reading lots of code help people like us a lot, a tool solution is also unsatisfactory. Everyone claims that everything can be solved with tools, and we kow from decades of experience that linguistic solutions are almost always superior in the long run. As for types, please do respect that we have tons of work behind us with typed models of languages and meta-theorems concerning types. When we actively choose not to program in an existing typed language (but yes I have started to program in Typed Scheme) then there is a reason. As for type is a type, please do read the papers on loop holes in languages, probably starting with Albert Meyer's papers and Luca's in the 1980s. When Python makes something look trivial, it's probably wrong. As for run-time tags, please everyone do understand that types should really be our terminology for things that are checked before the program runs and whose purpose it is to help us enforce a discipline of data (abstraction, as things are always called abstraction in CS) onto our programs. Tuning out -- Matthias From morazanm at gmail.com Sun Jun 14 14:49:51 2009 From: morazanm at gmail.com (Marco Morazan) Date: Sun Jun 14 14:50:11 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <904774730906140737x6f8465d1na4a37c7e5158a574@mail.gmail.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> <904774730906132022v495f03f7v7eee967ed9512b8@mail.gmail.com> <9b1fff280906140626u4f9725a1y7fb1c8ce257ba0cc@mail.gmail.com> <904774730906140737x6f8465d1na4a37c7e5158a574@mail.gmail.com> Message-ID: <9b1fff280906141149x38c756f0o4ca23685b8a09e2c@mail.gmail.com> > > See, I think that the problems that students have with design are > because they don't pay enough attention to the types. Yes, if you know what a type is, right? Imagine a world where you have no idea what a type is and an instructor starts talking to you about types. Formalizing the declaration of types, it seems to me, gets in the way of beginners experimenting with their design. If nothing runs until the type checker says it is OK and you are not even sure about what a type is nor how to design code, you find yourself stuck unable to test anything. My claim is that types are a hindrance at the beginning. Later in life, students will appreciate and understand the support a type checker provides. To be honest, I have had a similar discussion with European colleagues that are all for types from the beginning (needless to say they are type gurus). They are unwilling to budge from the position that types should be taught from day 1. I believe that the approach in HtDP/C provides a gentle path into programming with types. > The example I > cited of returning "" instead of empty is quite common. Part of > getting the design right is figuring out how the pieces *have* to fit > together because of the types that they have. I think this is why > writing the contract is the first step in the design recipe. If you > don't know what kinds of things your function is supposed to consume > and produce, you have no hope of getting the function right. And if > you get the types wrong and program to the contract, you're guaranteed > to get a function that won't work. > Yes, but does getting a type error provide you with the insight to know how to fix the problem? If you are experienced.....probably. On the other hand, using your example, a beginning student that returns "" instead of empty in their code is unlikely to suddenly get it because the type checker signals an error. The error does not suddenly make more sense. It is different with an experienced programmer that will recognize his/her silly mistake. > > This is a valid point, but I much more often see students who have > test cases that don't match contracts and refuse to change the test > cases that work. > Yes, yes, yes. :-) Students do write functions and test cases that don't match the contract. I personally believe there is a great deal of value in having students reason through their code to find where the problem is. A type checker would deprive them of the opportunity of engaging in this process of discovery. After all, the type checker will point exactly where the problem is (right? ;-). >> If the above is not convincing, how about getting beginning students >> to write typed programs for abstract functions that manipulate >> compound data structures? How about getting the types right for >> programs that use encapsulation? All of the sudden, types get in the >> way of undertsanding fundamental concepts. Be careful for what you >> wish for! > > I disagree completely with this. When we get to abstract list > functions, I think it's the types that keep students sane. Please, send me your students! :-) If they can reason through the contracts (not to say types) of abstract functions in general, I will be more than delighted to have them in my class. > To use > build-list, map, filter, and the folds correctly, I think students > *have* to consciously think about the types. Now, whether they have to > get the fully abstracted types with type variables correct is > something I'm not too insistent about OK, but that is where things start getting hard for beginners. In fact, how do they get a grasp of this "thinking consciously about the types?" My conjecture is that they do not go off and write down a type proof. Instead, they experiment by running their code and see how the results match up with their understanding and with what they wrote. It's this process of refinement that prepares them for programming in a language with types. Even experts are surprised by the process of refinement from time to time as witnessed on this thread. :-) Just keeping things light! I guess my point is rather simple. Types yes, but not at the beginning. Let students wrestle with their designs (and type errors) and we try to keep them from getting too frustrated. -- Cheers, Marco From grettke at acm.org Sun Jun 14 15:39:24 2009 From: grettke at acm.org (Grant Rettke) Date: Sun Jun 14 15:39:46 2009 Subject: [plt-scheme] [OT] Re: [plt-dev] reading symbols beginning with colon as keywords? In-Reply-To: <4A34DD5C.2050202@zenburn.net> References: <4A33D645.5030902@neilvandyke.org> <4A343C54.5040908@cs.utah.edu> <756daca50906131926x12852629g6d5e9b77acb9eeb0@mail.gmail.com> <4A34DD5C.2050202@zenburn.net> Message-ID: <756daca50906141239v1c242ac1r86bc94094e0d7388@mail.gmail.com> On Sun, Jun 14, 2009 at 6:22 AM, Jakub Piotr C?apa wrote: > And if you support keywords *ending* with : you will lure Smalltalkers and > Objective-C-ers. ;) It would also lure SRFI Scheme users ;) http://srfi.schemers.org/srfi-88/srfi-88.html From hendrik at topoi.pooq.com Sun Jun 14 15:33:17 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Sun Jun 14 15:40:29 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: References: <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> <904774730906132022v495f03f7v7eee967ed9512b8@mail.gmail.com> <9b1fff280906140626u4f9725a1y7fb1c8ce257ba0cc@mail.gmail.com> <904774730906140737x6f8465d1na4a37c7e5158a574@mail.gmail.com> <4331ad810906141006w376e3f79jb1c7f0718c4ad92b@mail.gmail.com> <4331ad810906141054g5d69759fq1f8410f4c2318c99@mail.gmail.com> Message-ID: <20090614193317.GA3237@topoi.pooq.com> On Sun, Jun 14, 2009 at 02:38:35PM -0400, Matthias Felleisen wrote: > > On Jun 14, 2009, at 1:54 PM, Luciano Ramalho wrote: > > >Prof. Shriram, I never meant to convince you or anyone else here that > >the "usability cost" of parenthetical syntax outweights its benefits. > >Even a newbie like me understands the trade-off and appreciates the > >benefits. > > > >I just wanted to point out that the "simple" syntax of Scheme does not > >make it necessarily easier to read than other syntaxes that are not so > >regular. > > > (Luciano, you don't have to call us professors or anything. The fact > that we have academic titles is meaningless. Too many 'professors' > think the title is enough to intimidate people into believing them. Not to mention titles like Herr Professor Doktor :) > It's awful. The fact that we're older is meaningless, too. It just > means we're closer to death (on the average).) > > What is meaningful is that we have demonstrated and keep > demonstrating a broad and deep grasp of the material. > > As for syntax, I think you're onto something. It is also true that > even we're stumped when reading others' code. And if others freely invent further syntax, the code can get much harder to read. Unless the syntax is very well-designed, and follows familiar conventions. > I bet that I could > stump Shriram with 1000s of snippets of code from our code basis and > I bet that the converse is true, too. While it is true that tools and > experience in reading lots of code help people like us a lot, a tool > solution is also unsatisfactory. Everyone claims that everything can > be solved with tools, and we kow from decades of experience that > linguistic solutions are almost always superior in the long run. Natural languages had nouns and verbs and adjectives and adverbs and prepositions (only some have postpositions) and main clauses and subordinate cluses and prepositional phrases and so on. They are way more complex than programming languages (perhaps this is evolution vs. design). Yet we find them convenient in everyday use. There's probably something to be learned from this variety of syntax. Not that I'd advocete programming in natural language. They are very unsuited to the task. But having variety in syntax seems to alleviate problems with understanding nested constructions. Yes, I appreciate being able to parenthesize anything in a programming language and use the entire language within the parentheses (I severely fault C ans Pascal and Modula 3 and all Java ans all those languages for this), but that kind of nesting is useful mostly while doing formal, possibly mechanical operations on code. It often doesn't mean the code is easier to read. Unless of course, the code is what's input into the formal transformatino engine, in which case the engine can provide useful notation. > As for types, please do respect that we have tons of work behind us > with typed models of languages and meta-theorems concerning types. > When we actively choose not to program in an existing typed language > (but yes I have started to program in Typed Scheme) then there is a > reason. Typed Scheme hjas broad compatibility with regulsr Scheme. So you can mix typed with untyped code if you need to. > > As for type is a type, please do read the papers on loop holes in > languages, probably starting with Albert Meyer's papers and Luca's in > the 1980s. When Python makes something look trivial, it's probably > wrong. > > As for run-time tags, please everyone do understand that types should > really be our terminology for things that are checked before the > program runs and whose purpose it is to help us enforce a discipline > of data (abstraction, as things are always called abstraction in CS) > onto our programs. That's the convention I've always used -- that types are static, and run-time tags are part of the data (and could be described by a type). Yes, we can have abstract types, too. They're what you get when you let a lambda-variable be of type 'type'. Type-checking can still be static, (else I wouldn't call it a type), and you don't have to have any run-time representation for the type itself (just for its calues, of course). Of course, you could design the language differently, and possibly end up confused or confusing. -- hendrik From rovitotv at gmail.com Sun Jun 14 15:38:42 2009 From: rovitotv at gmail.com (Todd Rovito) Date: Sun Jun 14 15:45:42 2009 Subject: [plt-scheme] Question on build process for Linux and Mac OSX Message-ID: Greetings, I would like to create a simple build process that creates mzscheme and shared libs for both CGC and 3m garbage collectors. For Linux I perform the following steps with the source tree: ./configure --prefix=/opt/plt-scheme --enable-shared make both make install-both This seems to work and I get .so files for everything I need. On the Mac OSX side I am struggling, admittedly I am less familar with OSX. ./configure --enable-xonx --prefix=/Users/rovitotv/prog/plt-scheme/ --enable-shared --disable-mred make both <--- this step never finishes I get an error. The output from configure and make are below, thanks for the help. ==================================================================================== /configure --enable-xonx --prefix=/Users/rovitotv/prog/plt-scheme/ --enable-shared --disable-mred === X-on-X enabled === Shared libraries enabled === MrEd disabled checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking how to run the C preprocessor... gcc -E checking for g++... g++ checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking how to run the C++ preprocessor... g++ -E checking for ranlib... ranlib checking for cos in -lm... yes checking for dlopen in -ldl... yes checking for inline keyword... yes checking for noinline attribute... yes checking for GNU preprocessor... yes checking for nl_langinfo (CODESET)... yes checking for getaddrinfo... no checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for ANSI C header files... rm: conftest.dSYM: is a directory rm: conftest.dSYM: is a directory yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking iconv.h usability... yes checking iconv.h presence... yes checking for iconv.h... yes checking iconv is usable... yes -liconv checking for mbsrtowcs... yes checking for char... yes checking size of char... 1 checking for short... yes checking size of short... 2 checking for int... yes checking size of int... 4 checking for long... yes checking size of long... 4 checking for long long... yes checking size of long long... 8 checking for stack direction... down checking whether byte ordering is bigendian... no Configuring libtool sh: /Users/rovitotv/prog/PLT: No such file or directory configure: creating ./config.status config.status: creating Makefile config.status: creating mzscheme/Makefile config.status: creating mzscheme/src/Makefile config.status: creating mzscheme/dynsrc/Makefile config.status: creating mzscheme/gc/Makefile config.status: creating mzscheme/sgc/Makefile config.status: creating mzscheme/gc2/Makefile config.status: creating foreign/Makefile config.status: creating mzscheme/mzconfig.h config.status: mzscheme/mzconfig.h is unchanged === configuring in foreign/gcc/libffi (/Users/rovitotv/prog/PLT Scheme v4.2 Source/src/foreign/gcc/libffi) configure: running /bin/sh ./configure '--prefix=/Users/rovitotv/prog/plt-scheme/' '--enable-xonx' '--enable-shared' '--disable-mred' '--enable-shared' '--disable-multilib' --cache-file=/dev/null --srcdir=. checking build system type... i386-apple-darwin9.7.0 checking host system type... i386-apple-darwin9.7.0 checking target system type... i386-apple-darwin9.7.0 checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes /bin/sh: /Users/rovitotv/prog/PLT: No such file or directory configure: WARNING: `missing' script is too old or missing checking for gawk... no checking for mawk... no checking for nawk... no checking for awk... awk checking whether make sets $(MAKE)... yes checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking for style of include used by make... GNU checking dependency style of gcc... gcc3 checking whether gcc and cc understand -c and -o together... yes checking for a sed that does not truncate output... /usr/bin/sed checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for fgrep... /usr/bin/grep -F checking for ld used by gcc... /usr/libexec/gcc/i686-apple-darwin9/4.0.1/ld checking if the linker (/usr/libexec/gcc/i686-apple-darwin9/4.0.1/ld) is GNU ld... no checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -p checking the name lister (/usr/bin/nm -p) interface... BSD nm checking whether ln -s works... yes checking the maximum length of command line arguments... 196608 checking whether the shell understands some XSI constructs... yes checking whether the shell understands "+="... yes checking for /usr/libexec/gcc/i686-apple-darwin9/4.0.1/ld option to reload object files... -r checking how to recognize dependent libraries... pass_all checking for ar... ar checking for strip... strip checking for ranlib... ranlib checking command to parse /usr/bin/nm -p output from gcc object... rm: conftest.dSYM: is a directory ok checking how to run the C preprocessor... gcc -E checking for ANSI C header files... rm: conftest.dSYM: is a directory rm: conftest.dSYM: is a directory yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking for dlfcn.h... yes checking for objdir... .libs rm: conftest.dSYM: is a directory rm: conftest.dSYM: is a directory checking if gcc supports -fno-rtti -fno-exceptions... rm: conftest.dSYM: is a directory no checking for gcc option to produce PIC... -fno-common -DPIC checking if gcc PIC flag -fno-common -DPIC works... rm: conftest.dSYM: is a directory yes checking if gcc static flag -static works... rm: conftest.dSYM: is a directory no checking if gcc supports -c -o file.o... rm: conftest.dSYM: is a directory yes checking if gcc supports -c -o file.o... (cached) yes checking whether the gcc linker (/usr/libexec/gcc/i686-apple-darwin9/4.0.1/ld) supports shared libraries... yes checking dynamic linker characteristics... darwin9.7.0 dyld checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes checking whether to enable maintainer-specific portions of Makefiles... no checking sys/mman.h usability... yes checking sys/mman.h presence... yes checking for sys/mman.h... yes checking for mmap... yes checking for sys/mman.h... (cached) yes checking for mmap... (cached) yes checking whether read-only mmap of a plain file works... yes checking whether mmap from /dev/zero works... no checking for MAP_ANON(YMOUS)... yes checking whether mmap with MAP_ANON(YMOUS) works... yes checking for ANSI C header files... (cached) yes checking for memcpy... yes checking for working alloca.h... yes checking for alloca... yes checking for double... yes checking size of double... 8 checking for long double... yes checking size of long double... 16 checking whether byte ordering is bigendian... no checking assembler .cfi pseudo-op support... no checking whether .eh_frame section should be read-only... rm: conftest.dSYM: is a directory no checking for __attribute__((visibility("hidden")))... rm: conftest.dSYM: is a directory no configure: creating ./config.status config.status: creating include/Makefile config.status: WARNING: include/Makefile.in seems to ignore the --datarootdir setting config.status: creating include/ffi.h config.status: creating Makefile config.status: WARNING: Makefile.in seems to ignore the --datarootdir setting config.status: creating fficonfig.h config.status: fficonfig.h is unchanged config.status: linking ./src/x86/ffitarget.h to include/ffitarget.h config.status: executing default-1 commands config.status: executing depfiles commands config.status: executing libtool commands config.status: executing include commands config.status: executing src commands >>> Installation targets: executables : ${exec_prefix}/bin/... Scheme code : ${exec_prefix}/lib/plt/collects/... core docs : ${datarootdir}/plt/doc/... C libraries : ${exec_prefix}/lib/... C headers : ${prefix}/include/plt/... extra C objs : ${exec_prefix}/lib/plt/... man pages : ${datarootdir}/man/... where prefix = /Users/rovitotv/prog/plt-scheme/ and datarootdir = ${prefix}/share and exec_prefix = ${prefix} rryazl062017509:src rovitotv$ make both make cgc cd mzscheme; make cgc make common make g-c cd gc; make ../libmzgc.la /Users/rovitotv/prog/PLT Scheme v4.2 Source/src/lt/libtool --mode=compile --tag=CC gcc -I./include -DNO_SIGNALS -g -O2 -Wall -DOS_X -D_DARWIN_UNLIMITED_SELECT -DXONX -DNO_EXECUTE_PERMISSION -DSILENT -DNO_GETENV -DLARGE_CONFIG -DATOMIC_UNCOLLECTABLE -DINITIAL_MARK_STACK_SIZE=8192 -c ./alloc.c make[5]: /Users/rovitotv/prog/PLT: Command not found make[5]: *** [alloc.lo] Error 127 make[4]: *** [g-c] Error 2 make[3]: *** [common] Error 2 make[2]: *** [cgc] Error 2 make[1]: *** [cgc] Error 2 make: *** [both] Error 2 rryazl062017509:src rovitotv$ From a.rottmann at gmx.at Sun Jun 14 16:03:30 2009 From: a.rottmann at gmx.at (Andreas Rottmann) Date: Sun Jun 14 16:03:58 2009 Subject: [plt-scheme] [OT] Re: [plt-dev] reading symbols beginning with colon as keywords? In-Reply-To: <4A34DD5C.2050202@zenburn.net> ("Jakub Piotr =?utf-8?Q?C?= =?utf-8?Q?=C5=82apa=22's?= message of "Sun, 14 Jun 2009 13:22:04 +0200") References: <4A33D645.5030902@neilvandyke.org> <4A343C54.5040908@cs.utah.edu> <756daca50906131926x12852629g6d5e9b77acb9eeb0@mail.gmail.com> <4A34DD5C.2050202@zenburn.net> Message-ID: <87ski237n1.fsf@delenn.lan> Jakub Piotr C?apa writes: > On 6/14/09 4:26 AM, Grant Rettke wrote: >> On Sat, Jun 13, 2009 at 6:55 PM, Chongkai Zhu wrote: >>> You can do this on your own code with readtables: >> >> If you put it in base you would lure Ruby programmers to PLT. > > And if you support keywords *ending* with : you will lure Smalltalkers > and Objective-C-ers. ;) > And please make $NAME expand to (getenv "NAME") and $(NAME . ARGS) to (apply run-shell-command (map thing->string '(NAME . ARGS))) to attract shell scripters -- imagine all those sysadmins! ;-) Cheers, Rotty From wookiz at hotmail.com Sun Jun 14 16:03:20 2009 From: wookiz at hotmail.com (wooks) Date: Sun Jun 14 16:15:36 2009 Subject: [plt-scheme] Re: The perfect teaching language--Is this too much to ask for? In-Reply-To: References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> Message-ID: <5e1496d4-2bce-4b0b-b2f9-f84ad7e09b57@x1g2000prh.googlegroups.com> On Jun 14, 12:23?pm, Martin DeMello wrote: > On Sun, Jun 14, 2009 at 5:21 PM, Noel Welsh wrote: > > > The issue is one of usability. It is pretty easy to get ML to spit out > > an incomprehensible type error ?at a location far removed from the > > original error, and ML's type system is fairly simple. > > I wonder, is that an insuperable problem, or simply one no one has > cared to solve because ML is not a teaching language and the feeling > is that users can learn? > My FP course was taught in Miranda supposedly because Miranda is a teaching language. The incomprehensible type error problem can be mitigated by defining abstract data types. From pocmatos at gmail.com Sun Jun 14 16:09:52 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Sun Jun 14 16:16:44 2009 Subject: [plt-scheme] Whole module contracted signature Message-ID: <1245010192.15610.4.camel@drserver> Hi, Given that there is a way to define whole-module signatures, is there a similar way for contracted signatures? Cheers, Paulo Matos From matthias at ccs.neu.edu Sun Jun 14 16:20:51 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sun Jun 14 16:21:32 2009 Subject: [plt-scheme] Whole module contracted signature In-Reply-To: <1245010192.15610.4.camel@drserver> References: <1245010192.15610.4.camel@drserver> Message-ID: <41B2FAE2-BEAD-401B-9309-9753EB1E7137@ccs.neu.edu> If you mean unit signatures, the answer is yes. See docs. -- Matthias On Jun 14, 2009, at 4:09 PM, Paulo J. Matos wrote: > Hi, > > Given that there is a way to define whole-module signatures, is > there a > similar way for contracted signatures? > > Cheers, > > Paulo Matos > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From eli at barzilay.org Sun Jun 14 16:27:59 2009 From: eli at barzilay.org (Eli Barzilay) Date: Sun Jun 14 16:28:23 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <4331ad810906141006w376e3f79jb1c7f0718c4ad92b@mail.gmail.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> <904774730906132022v495f03f7v7eee967ed9512b8@mail.gmail.com> <9b1fff280906140626u4f9725a1y7fb1c8ce257ba0cc@mail.gmail.com> <904774730906140737x6f8465d1na4a37c7e5158a574@mail.gmail.com> <4331ad810906141006w376e3f79jb1c7f0718c4ad92b@mail.gmail.com> Message-ID: <18997.23887.322783.673220@winooski.ccs.neu.edu> On Jun 14, Luciano Ramalho wrote: > [...] > > If I see: > > (x y z) > > I have no idea how that will be evaluated, whether y or z will ever > be evaluated, and if so, in what order. I have to find out whether x > is a function or some other form, because the syntax gives me no > clue. This is obviously a trade-off. In PLT, the bottom line is that you should always be able to tell what `x' is -- it's either something that the language you chose defined, something that comes from a library that you explicitly required, or something that you defined yourself. In most infix-ish languages, you have the exact same issue to deal with -- for example `for' is clearly not evaluating its "arguments" like other functions. You don't even have a clear syntactic hint about what is (for example) a new binding and what is a reference to an existing binding -- an identifier in prentheses can be a reference (for example, `my_fun(x)') or it can declare a new binding (for example `function my_fun(x)'); an identifier outside of parentheses can also be either a reference (`x + 1') or a binding (`var x'). The advantage of infix-ish (or more accurately macro-less-ish) languages is that there is a very small and inflexible set of such constructs, and it's all part of the core language. (That's a very common point that people raise against having macros, BTW.) But the tradeoff here is very significant -- the constructs are not flexible so changing them is much more traumatic (for example, to get a `for-each' kind of iteration Java had to revise the core language); and in addition such constructs are limited to the kind of things that belong in the core -- something like the `automaton' macro from Shriram's talk is clearly not a core language feature in this sense, so there is no chance of seeing something like that built-into some language (unless, of course, it's a language that revolves around automatons). Yet another factor is a much larger set of things that are built-in -- for example, in PLT optional and keyword arguments, the class system, contracts, types, and a bunch of other such things are not built-in. This makes the cost of developing them and maintining them much lower -- and even more significantly this applies to the cost of designing them too. When you're dealing with a language like Java or Python, the class system must be designed extremely carefully, since you have almost no room for mistakes. In contrast, the PLT class system is something that is very much alive. >From a commercial perspective, this can be a huge advantage: consider this as a competition between two products --- with the fixed world you need to make sure that you have all possible features. The Java class system is nearly fixed, and can react to changes extremely slowly. Younger languages can beat Java in ways that Java cannot react to -- but they risk similar costs with changes that the future will hold. But if you're using something like Scheme where the syntax is much more flexible, adapting things become two orders of magnitudes easier. Finally, earlier you mentioned: things that are similar should look similar, things that are different should look different which sounded like you're trying to make a point for infix syntax being more natural to use. As Shriram said, things are much more complicated when you're dealing with a programming language syntax. I thought that a very good example here is spaces as natural delimiters -- they're natural in both human texts and as arguments. For example, using a space in dir c:\Temp is natural, but also using a space in naming some directory "Program Files". Trying to abuse spaces for both of these purposes is one of the bigger catastrophes that Microsoft has inflicted on the world of programming. I'm sure that they had good intentions -- they were trying to make things simple -- following just that kind of argument. The result is that issues like double-quotes leak through all abstraction layers and even worse -- it's indirectly inherited by many tools. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From eli at barzilay.org Sun Jun 14 16:39:04 2009 From: eli at barzilay.org (Eli Barzilay) Date: Sun Jun 14 16:39:26 2009 Subject: [plt-scheme] Question on build process for Linux and Mac OSX In-Reply-To: References: Message-ID: <18997.24552.160901.720703@winooski.ccs.neu.edu> On Jun 14, Todd Rovito wrote: > Greetings, > I would like to create a simple build process that creates mzscheme > and shared libs for both CGC and 3m garbage collectors. For Linux I > perform the following steps with the source tree: > ./configure --prefix=/opt/plt-scheme --enable-shared > make both > make install-both > > This seems to work and I get .so files for everything I need. On the > Mac OSX side I am struggling, admittedly I am less familar with OSX. > ./configure --enable-xonx > --prefix=/Users/rovitotv/prog/plt-scheme/ --enable-shared > --disable-mred > make both <--- this step never finishes I get an error. > > The output from configure and make are below, thanks for the help. It looks like you're trying to build in one directory, using sources from a different directory called /Users/rovitotv/prog/PLT Scheme v4.2 Source/ and the problem is the spaces in the name. There are probably more than a few places in the makefiles that don't deal gracefully with such spaces, but fixing them is pointless since autoconf itself breaks with spaces too. If you build inside the PLT tree (eg, make a directory called .../PLT/src/build, then in it run ../configure) then things work because paths will be relative so they'll have no spaces. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From william.wood3 at comcast.net Sun Jun 14 17:47:01 2009 From: william.wood3 at comcast.net (Bill Wood) Date: Sun Jun 14 17:47:08 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <9b1fff280906141149x38c756f0o4ca23685b8a09e2c@mail.gmail.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> <904774730906132022v495f03f7v7eee967ed9512b8@mail.gmail.com> <9b1fff280906140626u4f9725a1y7fb1c8ce257ba0cc@mail.gmail.com> <904774730906140737x6f8465d1na4a37c7e5158a574@mail.gmail.com> <9b1fff280906141149x38c756f0o4ca23685b8a09e2c@mail.gmail.com> Message-ID: <1245016021.28766.10.camel@ubuntu> On Sun, 2009-06-14 at 14:49 -0400, Marco Morazan wrote: . . . > Yes, if you know what a type is, right? Imagine a world where you have > no idea what a type is and an instructor starts talking to you about > types. Formalizing the declaration of types, it seems to me, gets in > the way of beginners experimenting with their design. If nothing runs > until the type checker says it is OK and you are not even sure about > what a type is nor how to design code, you find yourself stuck unable > to test anything. My claim is that types are a hindrance at the > beginning. Later in life, students will appreciate and understand the > support a type checker provides. Many years ago when I was in grad school Abstract Data Types were just catching on in the literature and I was teaching service courses in Fortran for science and engineering majors. They were mostly nwew to programming. I tried teaching the idea that the things your program manipulates are of various kinds and that design proceeded more easily and effectively when those kinds were documented and reasoned about as part of the design process. I found that the classes taught that way more quickly learned to design programs that worked than did classes where no such ideas were presented. I think part of the point here is that humans classify, and are used to the idea that kinds -- kinds of rice in the pot, kinds of screwdriver in the toolbox, etc., matter to the effectiveness and correctness of processes that involve working with stuff. The application of that intuition to programming is not a large leap. -- Bill Wood From william.wood3 at comcast.net Sun Jun 14 17:53:43 2009 From: william.wood3 at comcast.net (Bill Wood) Date: Sun Jun 14 17:53:53 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <20090614193317.GA3237@topoi.pooq.com> References: <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> <904774730906132022v495f03f7v7eee967ed9512b8@mail.gmail.com> <9b1fff280906140626u4f9725a1y7fb1c8ce257ba0cc@mail.gmail.com> <904774730906140737x6f8465d1na4a37c7e5158a574@mail.gmail.com> <4331ad810906141006w376e3f79jb1c7f0718c4ad92b@mail.gmail.com> <4331ad810906141054g5d69759fq1f8410f4c2318c99@mail.gmail.com> <20090614193317.GA3237@topoi.pooq.com> Message-ID: <1245016423.28766.15.camel@ubuntu> On Sun, 2009-06-14 at 15:33 -0400, hendrik@topoi.pooq.com wrote: . . . > Natural languages had nouns and verbs and adjectives and adverbs and > prepositions (only some have postpositions) and main clauses and > subordinate cluses and prepositional phrases and so on. They are way > more complex than programming languages (perhaps this is evolution vs. > design). Yet we find them convenient in > everyday use. > > There's probably something to be learned from this variety of syntax. I seem to recall that Larry Wall was of the opinion that natural language mechanisms like endings would be useful in a programming language, and he came up with the "@" and "$" decorators for variables on that model. I for one think the experiment was a spectacular failure -- all he did was invent another write-only language. Just my opinion, -- Bill Wood From jos.koot at telefonica.net Sun Jun 14 19:06:19 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Sun Jun 14 19:07:16 2009 Subject: [plt-scheme] poll: keyword syntax References: <20090614152554.ABAB96500CF@mail-svr1.cs.utah.edu> Message-ID: <06CE4A792CB746BB80A6CFB236F35C21@uw2b2dff239c4d> Three reasons why I prefer to maintain the current state: 1: I am conservative (not in all respects but with respect to languages, natural or computer, I am) 2: The # is generally used for special things. A keyword is a special thing. #:k seems better visible than :k or k: 3: People (me included) may be using identifiers starting and/or ending with a colon. I think that #: belongs in the range of #', #&, #, , #,@, etc. It is always possible to adapt your readertable such as to insert # before a colon automatically (as an option please, not as a fixed rule) You might even consider an option to suppress showing # when preceeding a colon. Keywords should be easily visible (with some emphasis) in the program text. #:key is much better distinctive than :key or key:. I agree that we need some characters to have special effect (parentheses, brackets, quotes, double quotes, backslashes, vertical bars, braces, white space and #) I prefer the set of special effect characters to be as small as possible. mho, Jos ----- Original Message ----- From: "Matthew Flatt" To: Sent: Sunday, June 14, 2009 5:25 PM Subject: [plt-scheme] poll: keyword syntax > I'm curious about the popularity of different syntaxes for keywords > among the readers of this mailing list. Specifically, I'm curious about > the relative popularity of a "#:" prefix (which is what we currently > have), a ":" prefix, or a ":" suffix. > > Let me know what you think by visiting > > http://rains.cs.utah.edu:8000/ > > The "vote" is not binding in any sense. I'd just like to get a better > idea of what PLT Scheme programmers think, since I consider the > question to be purely a matter if opinion --- and not worth debating at > all on the list. :) > > I'll report results back here in a few days. > > Thanks! > > > Matthew > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From plragde at uwaterloo.ca Sun Jun 14 19:26:30 2009 From: plragde at uwaterloo.ca (Prabhakar Ragde) Date: Sun Jun 14 19:26:58 2009 Subject: [plt-scheme] Re: The perfect teaching language--Is this too much to ask for? Message-ID: <4A358726.9050409@uwaterloo.ca> wooks writes: > My FP course was taught in Miranda supposedly because Miranda is a > teaching language. The incomprehensible type error problem can be > mitigated by defining abstract data types. I think the problem shows up even before that. In Haskell, which is pretty much identical to Miranda for this program: import System.IO len [] = 0 len [x:xs] = 1 + len xs main = print (len "test") Here's the error message I get from GHC, pointing at the second `len' line: > Occurs check: cannot construct the infinite type: t = [t] > Expected type: [t] -> t1 > Inferred type: [[t]] -> t2 > In the second argument of `(+)', namely `len xs' > In the expression: 1 + len xs Now, if you define your own List type (which is Cons or Empty), maybe you won't make this mistake in the first place. But I bet one can construct examples with naive mistakes that result in similar messages. (Does Helium do better on this program? Maybe someone with it installed can check?) Earthbound static type systems (C-style) make abstraction difficult, and I don't think they really assist beginners in finding their mistakes (though I may be biased by GCC's habit of making assumptions). More sophisticated type systems (permitting polymorphism at the very least) need to be understood, which is definitely not easy for a beginner. I think there is scope for some optional assistance with types -- the define-type and type-case macros used in PLAI and EOPL, for instance, or a macro for function definition that puts in primitive type checks on arguments and results. But I think that a first course should not go much beyond these. I have taught first year with static types and dynamic types, and dynamic types are much easier. --PR From czhu at cs.utah.edu Sun Jun 14 19:29:53 2009 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Sun Jun 14 19:30:28 2009 Subject: [plt-scheme] poll: keyword syntax In-Reply-To: <06CE4A792CB746BB80A6CFB236F35C21@uw2b2dff239c4d> References: <20090614152554.ABAB96500CF@mail-svr1.cs.utah.edu> <06CE4A792CB746BB80A6CFB236F35C21@uw2b2dff239c4d> Message-ID: <4A3587F1.7020804@cs.utah.edu> Jos Koot wrote: > Three reasons why I prefer to maintain the current state: > 1: I am conservative (not in all respects but with respect to > languages, natural or computer, I am) > 2: The # is generally used for special things. A keyword is a special > thing. #:k seems better visible than :k or k: > 3: People (me included) may be using identifiers starting and/or > ending with a colon. > > I think that #: belongs in the range of #', #&, #, , #,@, etc. > It is always possible to adapt your readertable such as to insert # > before a colon automatically (as an option please, not as a fixed rule) > You might even consider an option to suppress showing # when > preceeding a colon. > > Keywords should be easily visible (with some emphasis) in the program > text. #:key is much better distinctive than :key or key:. > I agree that we need some characters to have special effect > (parentheses, brackets, quotes, double quotes, backslashes, vertical > bars, braces, white space and #) I prefer the set of special effect > characters to be as small as possible. mho, > Jos > add1 From sk at cs.brown.edu Sun Jun 14 19:32:04 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Sun Jun 14 19:32:43 2009 Subject: [plt-scheme] poll: keyword syntax In-Reply-To: <4A3587F1.7020804@cs.utah.edu> References: <20090614152554.ABAB96500CF@mail-svr1.cs.utah.edu> <06CE4A792CB746BB80A6CFB236F35C21@uw2b2dff239c4d> <4A3587F1.7020804@cs.utah.edu> Message-ID: To quote Matthew: "The "vote" is not binding in any sense. I'd just like to get a better idea of what PLT Scheme programmers think, since I consider the question to be purely a matter if opinion --- and not worth debating at all on the list. :)" But maybe that was a futile hope... From sk at cs.brown.edu Sun Jun 14 19:29:03 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Sun Jun 14 19:37:31 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <18997.23887.322783.673220@winooski.ccs.neu.edu> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> <904774730906132022v495f03f7v7eee967ed9512b8@mail.gmail.com> <9b1fff280906140626u4f9725a1y7fb1c8ce257ba0cc@mail.gmail.com> <904774730906140737x6f8465d1na4a37c7e5158a574@mail.gmail.com> <4331ad810906141006w376e3f79jb1c7f0718c4ad92b@mail.gmail.com> <18997.23887.322783.673220@winooski.ccs.neu.edu> Message-ID: > Younger languages can beat Java in ways that Java cannot > react to -- but they risk similar costs with changes that the future > will hold. I cannot improve on Eli's excellent essay, but I can provide concrete evidence for one of his abstract points: Scala. (Which, in turn, has baked in its own inflexibilities.) I was recently talking to some colleagues who were trying to convince me that PL people had "missed" a "huge" problem; they were referring to the language/library distinction (when a library becomes larger than some mental complexity, it is effectively a language in its own right). A good example is the Rails part of Ruby on Rails. I pointed out that (a) this is a well-known problem, but also (b) the Lisp community has never really had this problem, and (c) with work over the past ten years (Bawden's, Waddell's, mine, and finally reaching its pinnacle with Flatt's), we have even managed to formalize a sufficient (and good) solution to this problem The poor Java folks have no such end in sight. Shriram From pocmatos at gmail.com Sun Jun 14 20:07:57 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Sun Jun 14 20:08:23 2009 Subject: [plt-scheme] Whole module contracted signature In-Reply-To: <41B2FAE2-BEAD-401B-9309-9753EB1E7137@ccs.neu.edu> References: <1245010192.15610.4.camel@drserver> <41B2FAE2-BEAD-401B-9309-9753EB1E7137@ccs.neu.edu> Message-ID: <1245024477.15610.5.camel@drserver> On Sun, 2009-06-14 at 16:20 -0400, Matthias Felleisen wrote: > If you mean unit signatures, the answer is yes. See docs. -- Matthias > > I can find whole-module signatures and units. I can find how to attach a contract to units and signatures but not how to define whole-module signatures and units. > On Jun 14, 2009, at 4:09 PM, Paulo J. Matos wrote: > > > Hi, > > > > Given that there is a way to define whole-module signatures, is > > there a > > similar way for contracted signatures? > > > > Cheers, > > > > Paulo Matos > > > > _________________________________________________ > > For list-related administrative tasks: > > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From matthias at ccs.neu.edu Sun Jun 14 20:11:24 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sun Jun 14 20:11:55 2009 Subject: [plt-scheme] Whole module contracted signature In-Reply-To: <1245024477.15610.5.camel@drserver> References: <1245010192.15610.4.camel@drserver> <41B2FAE2-BEAD-401B-9309-9753EB1E7137@ccs.neu.edu> <1245024477.15610.5.camel@drserver> Message-ID: Can you make an example of what you would like? On Jun 14, 2009, at 8:07 PM, Paulo J. Matos wrote: > On Sun, 2009-06-14 at 16:20 -0400, Matthias Felleisen wrote: >> If you mean unit signatures, the answer is yes. See docs. -- Matthias >> >> > > I can find whole-module signatures and units. I can find how to > attach a > contract to units and signatures but not how to define whole-module > signatures and units. > >> On Jun 14, 2009, at 4:09 PM, Paulo J. Matos wrote: >> >>> Hi, >>> >>> Given that there is a way to define whole-module signatures, is >>> there a >>> similar way for contracted signatures? >>> >>> Cheers, >>> >>> Paulo Matos >>> >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > From pocmatos at gmail.com Sun Jun 14 20:14:18 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Sun Jun 14 20:14:42 2009 Subject: [plt-scheme] Invoking units Message-ID: <1245024858.15610.12.camel@drserver> Hi, My units are a bit rusty and deprecated (last time I used them was pretty much in 300 I guess). I have a unit that imports 3 thunks: #lang scheme (define-signature search^ ((contracted (num-states (-> integer?)) (hash-states? (-> bool?)) (draw-graph? (-> bool?))))) (provide search^) and then I want to invoke the unit attaching a couple of values and get the result of its last expression. I tried something like: (invoke-unit search@ (import (lambda () 100) (lambda () #t) (lambda () #t)))) but I am definitely missing something... I couldn't find any example of invoke-unit (with imports) in the docs. Can anybody provide an example on how to attach values to the signature imports? Cheers, Paulo Matos http://www.pmatos.net From samth at ccs.neu.edu Sun Jun 14 20:19:38 2009 From: samth at ccs.neu.edu (Sam TH) Date: Sun Jun 14 20:19:55 2009 Subject: [plt-scheme] Whole module contracted signature In-Reply-To: <1245024477.15610.5.camel@drserver> References: <1245010192.15610.4.camel@drserver> <41B2FAE2-BEAD-401B-9309-9753EB1E7137@ccs.neu.edu> <1245024477.15610.5.camel@drserver> Message-ID: <63bb19ae0906141719g5ba54142v815f3577ecc433b@mail.gmail.com> On Sun, Jun 14, 2009 at 8:07 PM, Paulo J. Matos wrote: > On Sun, 2009-06-14 at 16:20 -0400, Matthias Felleisen wrote: >> If you mean unit signatures, the answer is yes. See docs. -- Matthias >> >> > > I can find whole-module signatures and units. I can find how to attach a > contract to units and signatures but not how to define whole-module > signatures and units. #lang scheme/signature (require scheme/contract) (contracted [foo (number/c . -> . number/c)]) There appears to be a bug in the scheme/signature language, which causes it to reject the use of signature forms when they are the only element of the file. That's why I inserted the `require'. -- sam th samth@ccs.neu.edu From pocmatos at gmail.com Sun Jun 14 20:33:43 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Sun Jun 14 20:34:06 2009 Subject: [plt-scheme] Whole module contracted signature In-Reply-To: References: <1245010192.15610.4.camel@drserver> <41B2FAE2-BEAD-401B-9309-9753EB1E7137@ccs.neu.edu> <1245024477.15610.5.camel@drserver> Message-ID: <1245026023.15610.19.camel@drserver> On Sun, 2009-06-14 at 20:11 -0400, Matthias Felleisen wrote: > Can you make an example of what you would like? > It's really not a huge issue... but in the guide: http://docs.plt-scheme.org/guide/Whole-module_Signatures_and_Units.html it is shown: #lang scheme/signature build-toys ; (integer? -> (listof toy?)) repaint ; (toy? symbol? -> toy?) toy? ; (any/c -> boolean?) toy-color ; (toy? -> symbol?) This uses up a module to define a signature by allowing me not to type define-signature. When it comes to contracted signatures: http://docs.plt-scheme.org/guide/Contracts_for_Units.html It shows: #lang scheme (define-signature contracted-toy-factory^ ((contracted [build-toys (-> integer? (listof toy?))] [repaint (-> toy? symbol? toy?)] [toy? (-> any/c boolean?)] [toy-color (-> toy? symbol?)]))) (provide contracted-toy-factory^) This defines a contracted signature over a single module. I asked if it was possible to define a contracted signature but with the same 'help' provided by whole-module signatures. Maybe something like (note: i made up the following syntax): #lang scheme/signature/contracted build-toys (-> integer? (listof toy?)) repaint (-> toy? symbol? toy?) toy? (-> any/c boolean?) toy-color (-> toy? symbol?) Cheers, Paulo Matos > > On Jun 14, 2009, at 8:07 PM, Paulo J. Matos wrote: > > > On Sun, 2009-06-14 at 16:20 -0400, Matthias Felleisen wrote: > >> If you mean unit signatures, the answer is yes. See docs. -- Matthias > >> > >> > > > > I can find whole-module signatures and units. I can find how to > > attach a > > contract to units and signatures but not how to define whole-module > > signatures and units. > > > >> On Jun 14, 2009, at 4:09 PM, Paulo J. Matos wrote: > >> > >>> Hi, > >>> > >>> Given that there is a way to define whole-module signatures, is > >>> there a > >>> similar way for contracted signatures? > >>> > >>> Cheers, > >>> > >>> Paulo Matos > >>> > >>> _________________________________________________ > >>> For list-related administrative tasks: > >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > >> > > > From pocmatos at gmail.com Sun Jun 14 20:34:58 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Sun Jun 14 20:35:22 2009 Subject: [plt-scheme] Whole module contracted signature In-Reply-To: <63bb19ae0906141719g5ba54142v815f3577ecc433b@mail.gmail.com> References: <1245010192.15610.4.camel@drserver> <41B2FAE2-BEAD-401B-9309-9753EB1E7137@ccs.neu.edu> <1245024477.15610.5.camel@drserver> <63bb19ae0906141719g5ba54142v815f3577ecc433b@mail.gmail.com> Message-ID: <1245026098.15610.20.camel@drserver> On Sun, 2009-06-14 at 20:19 -0400, Sam TH wrote: > On Sun, Jun 14, 2009 at 8:07 PM, Paulo J. Matos wrote: > > On Sun, 2009-06-14 at 16:20 -0400, Matthias Felleisen wrote: > >> If you mean unit signatures, the answer is yes. See docs. -- Matthias > >> > >> > > > > I can find whole-module signatures and units. I can find how to attach a > > contract to units and signatures but not how to define whole-module > > signatures and units. > > #lang scheme/signature > > (require scheme/contract) > (contracted [foo (number/c . -> . number/c)]) > > There appears to be a bug in the scheme/signature language, which > causes it to reject the use of signature forms when they are the only > element of the file. That's why I inserted the `require'. Thanks, that's definitely similar to what I would expect. Cheers, Paulo Matos From matthias at ccs.neu.edu Sun Jun 14 20:58:42 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sun Jun 14 20:59:23 2009 Subject: [plt-scheme] Invoking units In-Reply-To: <1245024858.15610.12.camel@drserver> References: <1245024858.15610.12.camel@drserver> Message-ID: <998C0391-863D-483B-9B7C-545B83FB663F@ccs.neu.edu> invoke-unit works only for units that don't need imports. Link first. (Yes, there is a way to use the lexical environment for the same purpose.) -- Matthias On Jun 14, 2009, at 8:14 PM, Paulo J. Matos wrote: > Hi, > > My units are a bit rusty and deprecated (last time I used them was > pretty much in 300 I guess). I have a unit that imports 3 thunks: > #lang scheme > > (define-signature search^ > ((contracted > (num-states (-> integer?)) > (hash-states? (-> bool?)) > (draw-graph? (-> bool?))))) > > (provide search^) > > and then I want to invoke the unit attaching a couple of values and > get > the result of its last expression. I tried something like: > (invoke-unit search@ > (import > (lambda () 100) > (lambda () #t) > (lambda () #t)))) > > but I am definitely missing something... I couldn't find any > example of > invoke-unit (with imports) in the docs. Can anybody provide an example > on how to attach values to the signature imports? > > Cheers, > > Paulo Matos > http://www.pmatos.net > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From luciano at ramalho.org Sun Jun 14 21:15:36 2009 From: luciano at ramalho.org (Luciano Ramalho) Date: Sun Jun 14 21:16:02 2009 Subject: [plt-scheme] Tip: installing PLAI Scheme in DrScheme 4.2 Message-ID: <4331ad810906141815y5abf1479g4faf9038f5a77bd3@mail.gmail.com> I could not install PLAI Scheme using (require (planet plai/plai:1:3)) in a freshly compiled DrScheme 4.2 under the default Memory Limit of 128 Megabytes, but succeeded after setting it to "Unlimited" (I did not try other values to see whether they worked). I followed the instructions at [1], and got an "Evaluation Terminated" dialog with the message "The program ran out of memory". After that, further attempts at installing PLAI Scheme apparently worked but then trying to run programs using PLAI tests failed with a message regarding something already defined (sorry I did not capture that message), so it seems the memory error left the PLAI installation in some invalid state. [1] http://www.cs.brown.edu/~sk/Publications/Books/ProgLangs/2007-04-26/ Removing DrScheme altogether, reinstalling it with ./configure, make and make install and lifting the memory limit before doing (require (planet plai/plai:1:3)) worked fine. This machine is running Ubuntu 8.04.2 on an AMD 64 CPU. Suggestion: add this tip about the memory setting to the instructions at [1]. Cheers, Luciano From grettke at acm.org Sun Jun 14 21:16:12 2009 From: grettke at acm.org (Grant Rettke) Date: Sun Jun 14 21:16:31 2009 Subject: [plt-scheme] poll: keyword syntax In-Reply-To: <06CE4A792CB746BB80A6CFB236F35C21@uw2b2dff239c4d> References: <20090614152554.ABAB96500CF@mail-svr1.cs.utah.edu> <06CE4A792CB746BB80A6CFB236F35C21@uw2b2dff239c4d> Message-ID: <756daca50906141816h39d43c1fh4781b4b4c0e07abd@mail.gmail.com> On Sun, Jun 14, 2009 at 6:06 PM, Jos Koot wrote: > 3: People (me included) ?may be using identifiers starting and/or ending > with a colon. Like SRFI-42. > I think that #: belongs in the range of #', #&, #, , #,@, etc. I would rather that it conform to the keyword SRFI and have a chance and portability. From grettke at acm.org Sun Jun 14 21:17:15 2009 From: grettke at acm.org (Grant Rettke) Date: Sun Jun 14 21:17:33 2009 Subject: [plt-scheme] poll: keyword syntax In-Reply-To: References: <20090614152554.ABAB96500CF@mail-svr1.cs.utah.edu> <06CE4A792CB746BB80A6CFB236F35C21@uw2b2dff239c4d> <4A3587F1.7020804@cs.utah.edu> Message-ID: <756daca50906141817w71c0bd9p82b639970719b724@mail.gmail.com> On Sun, Jun 14, 2009 at 6:32 PM, Shriram Krishnamurthi wrote: > To quote Matthew: > > "The "vote" is not binding in any sense. I'd just like to get a better > idea of what PLT Scheme programmers think, since I consider the > question to be purely a matter if opinion --- and not worth debating at > all on the list. :)" > > But maybe that was a futile hope... Don't be so negative Shriram; there is no debating yet! :) From sk at cs.brown.edu Sun Jun 14 21:20:51 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Sun Jun 14 21:21:28 2009 Subject: [plt-scheme] Tip: installing PLAI Scheme in DrScheme 4.2 In-Reply-To: <4331ad810906141815y5abf1479g4faf9038f5a77bd3@mail.gmail.com> References: <4331ad810906141815y5abf1479g4faf9038f5a77bd3@mail.gmail.com> Message-ID: Thanks, Luciano. I presume you are referring to the PLaneT-based instructions? I posted a comment about a similar phenomenon re. installing PLAI from PLaneT last week, but it was dismissed (by one)/ignored (by everyone else) on the grounds that my 1/2 gig laptop is pretty old. How much memory does your machine have? (Presumably you're not using 64 bits to address memory when 16 would have sufficed. <-;) As for leaving DrScheme in an unstable state, presumably that is the fault of the PLaneT installer.... Shriram From luciano at ramalho.org Sun Jun 14 21:44:22 2009 From: luciano at ramalho.org (Luciano Ramalho) Date: Sun Jun 14 21:44:42 2009 Subject: [plt-scheme] Tip: installing PLAI Scheme in DrScheme 4.2 In-Reply-To: References: <4331ad810906141815y5abf1479g4faf9038f5a77bd3@mail.gmail.com> Message-ID: <4331ad810906141844s3533162u7ac0d2a2d0b95747@mail.gmail.com> On Sun, Jun 14, 2009 at 10:20 PM, Shriram Krishnamurthi wrote: > I presume you are referring to the PLaneT-based instructions? Yes. But I also tried using "Install .plt File" from the web, and failed in a similar way. > I posted a comment about a similar phenomenon re. installing PLAI from > PLaneT last week, but it was dismissed (by one)/ignored (by everyone > else) on the grounds that my 1/2 gig laptop is pretty old. ?How much > memory does your machine have? ?(Presumably you're not using 64 bits > to address memory when 16 would have sufficed. <-;) The machine has 2GB of RAM (32 bits would have sufficed...). Cheers, Luciano From sk at cs.brown.edu Sun Jun 14 22:09:19 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Sun Jun 14 22:10:01 2009 Subject: [plt-scheme] Tip: installing PLAI Scheme in DrScheme 4.2 In-Reply-To: <4331ad810906141844s3533162u7ac0d2a2d0b95747@mail.gmail.com> References: <4331ad810906141815y5abf1479g4faf9038f5a77bd3@mail.gmail.com> <4331ad810906141844s3533162u7ac0d2a2d0b95747@mail.gmail.com> Message-ID: Danny Yoo points out he's had this problem too (and NOT using PLAI!): http://list.cs.brown.edu/pipermail/plt-scheme/2009-May/032956.html [Warning: contains swearing. Danny can't bring himself to do it, so he's written a program to do it for him.] Shriram From luciano at ramalho.org Sun Jun 14 22:13:10 2009 From: luciano at ramalho.org (Luciano Ramalho) Date: Sun Jun 14 22:13:33 2009 Subject: [plt-scheme] Tip: installing PLAI Scheme in DrScheme 4.2 In-Reply-To: References: <4331ad810906141815y5abf1479g4faf9038f5a77bd3@mail.gmail.com> <4331ad810906141844s3533162u7ac0d2a2d0b95747@mail.gmail.com> Message-ID: <4331ad810906141913g658e7cfbpf86bf1a52dc18354@mail.gmail.com> On Sun, Jun 14, 2009 at 11:09 PM, Shriram Krishnamurthi wrote: > Danny Yoo points out he's had this problem too (and NOT using PLAI!): > > http://list.cs.brown.edu/pipermail/plt-scheme/2009-May/032956.html Yeah, I was also amazed at how long it took tho render the scribbles. Cheers, Luciano From neil at neilvandyke.org Sun Jun 14 22:16:17 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Sun Jun 14 22:16:57 2009 Subject: [plt-scheme] Tip: installing PLAI Scheme in DrScheme 4.2 In-Reply-To: References: <4331ad810906141815y5abf1479g4faf9038f5a77bd3@mail.gmail.com> Message-ID: <4A35AEF1.1090501@neilvandyke.org> I have had the same memory limit problem when installing a different PLaneT package. Perhaps the DrScheme default memory limit should be higher, if the PLaneT installer cannot run reliably within the default limit. Incidentally, while hassling with this and other PLaneT-related oopses recently, I made a very simple script for emptying out "~/.plt-scheme" on Unix systems: http://www.neilvandyke.org/plt-dir-enema/ -- http://www.neilvandyke.org/ From DekuDekuplex at Yahoo.com Sun Jun 14 22:49:00 2009 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Sun Jun 14 22:49:43 2009 Subject: [plt-scheme] Re: How difficult would creating a collaborative multi-user online virtual world application be in PLT Scheme? References: <5A441D1B-7941-40AF-8DE5-62C33FB59C03@brinckerhoff.org> <9fl335pp1jr99hk2pmb66m2i0bfut63hd7@4ax.com> <9fl335pp1jr99hk2pmb66m2i0bfut63hd7-e09XROE/p8c@public.gmane.org> Message-ID: <0pcb35hi3ql2c5bj22a82q8jcuuo2r781n@4ax.com> On Fri, 12 Jun 2009 08:36:11 -0400, Shriram Krishnamurthi wrote: >Benjamin, > >We (well, I) don't have an archive of all your posts in our (my) head >--and frankly, your posting history on this is beside the point. >John's point stands about Smalltalk. And his bigger but subtler point >(his "post-linnaean" remark) seems to have slid by you entirely as you >composed your spirited defense, which ends in the same tone that John >was trying to correct. I just re-read your paper, "Teaching Programming Languages in a Post-Linnaean Age" (at http://www.cs.brown.edu/~sk/Publications/Papers/Published/sk-teach-pl-post-linnaean/). Perhaps my explanation had been unclear, so I will restate it differently. Assuming that programming languages are aggregations of features, rather than implementations defined by taxonomies, that still leaves the issue of whether an individual programmer is used to programming in a particular style using a specific aggregation of features (or kind of aggregation of features). Since my first formal exposure had been to an aggregation of features called "Scheme," and one of my teachers using it had been one of the creators of Haskell (another aggregation of features), who had a strong tendency to use any said aggregation of features to express a particular style of programming that was as close to a purely functional style as possible, it follows that, over time, I became used to the particular style of programming emphasized at my college. This had more to do with the particular emphasis at that school than with any language in particular. Although it may still be possible to write Smalltalk programs in a similar style (again, since any programming language is simply an aggregation of features), in reality, most Smalltalk programs are written in a style which emphasizes a purely objective approach, which differs stylistically significantly from that of the purely functional approach taught at my college. Therefore, it would take more time and effort to get used to said purely objective approach than to get used to a more similar variety of a functional approach, perhaps using a language which is more often, in practice, used in a functional style. Hence, my search for an aggregation of features which is used, in practice, in a style which more closely resembles the style of the aggregation of features as taught in my college experience. -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ From sk at cs.brown.edu Sun Jun 14 22:54:06 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Sun Jun 14 22:54:30 2009 Subject: [plt-scheme] Tip: installing PLAI Scheme in DrScheme 4.2 In-Reply-To: <4A35AEF1.1090501@neilvandyke.org> References: <4331ad810906141815y5abf1479g4faf9038f5a77bd3@mail.gmail.com> <4A35AEF1.1090501@neilvandyke.org> Message-ID: Or perhaps the system should behave better? I think you have it backward. 128 Mb seems like perfectly enough memory to *install a package* (and build its docs). (I am actually surprised that this has *memory* problems, as opposed to being entirely i/o bound.) On Jun 14, 2009 10:17 PM, "Neil Van Dyke" wrote: I have had the same memory limit problem when installing a different PLaneT package. Perhaps the DrScheme default memory limit should be higher, if the PLaneT installer cannot run reliably within the default limit. Incidentally, while hassling with this and other PLaneT-related oopses recently, I made a very simple script for emptying out "~/.plt-scheme" on Unix systems: http://www.neilvandyke.org/plt-dir-enema/ -- http://www.neilvandyke.org/ _________________________________________________ For list-related administrative tasks: http://l... -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090614/32474173/attachment.htm From sk at cs.brown.edu Sun Jun 14 22:55:13 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Sun Jun 14 22:55:35 2009 Subject: [plt-scheme] Tip: installing PLAI Scheme in DrScheme 4.2 In-Reply-To: <4A35AEF1.1090501@neilvandyke.org> References: <4331ad810906141815y5abf1479g4faf9038f5a77bd3@mail.gmail.com> <4A35AEF1.1090501@neilvandyke.org> Message-ID: Note that Luciano had the problem with a .plt file too, so it's not even about PLaneT per se. On Jun 14, 2009 10:17 PM, "Neil Van Dyke" wrote: I have had the same memory limit problem when installing a different PLaneT package. Perhaps the DrScheme default memory limit should be higher, if the PLaneT installer cannot run reliably within the default limit. Incidentally, while hassling with this and other PLaneT-related oopses recently, I made a very simple script for emptying out "~/.plt-scheme" on Unix systems: http://www.neilvandyke.org/plt-dir-enema/ -- http://www.neilvandyke.org/ _________________________________________________ For list-related administrative tasks: http://l... -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090614/22868690/attachment.html From neil at neilvandyke.org Sun Jun 14 23:18:42 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Sun Jun 14 23:19:23 2009 Subject: [plt-scheme] Tip: installing PLAI Scheme in DrScheme 4.2 In-Reply-To: References: <4331ad810906141815y5abf1479g4faf9038f5a77bd3@mail.gmail.com> <4A35AEF1.1090501@neilvandyke.org> Message-ID: <4A35BD92.6010806@neilvandyke.org> Shriram Krishnamurthi wrote at 06/14/2009 10:54 PM: > > Or perhaps the system should behave better? I think you have it > backward. 128 Mb seems like perfectly enough memory to *install a > package* (and build its docs). (I am actually surprised that this has > *memory* problems, as opposed to being entirely i/o bound.) > It might just be that documentation-building could stand some more optimization: http://list.cs.brown.edu/pipermail/plt-dev/2009-May/000933.html Or perhaps some PLaneT code is doing something like sucking a file into memory. (Last year, I reimplemented some of the HTTP functionality to, among other things, get rid of at least one place where big-file-sucking happens, but I don't think that particular functionality is involved in PLaneT installs.) -- http://www.neilvandyke.org/ From neil at neilvandyke.org Sun Jun 14 23:59:52 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Mon Jun 15 00:02:17 2009 Subject: [plt-scheme] poll: keyword syntax In-Reply-To: References: <20090614152554.ABAB96500CF@mail-svr1.cs.utah.edu> <06CE4A792CB746BB80A6CFB236F35C21@uw2b2dff239c4d> <4A3587F1.7020804@cs.utah.edu> Message-ID: <4A35C738.4010000@neilvandyke.org> Emacs users: the latest version of Quack lets people color PLT keyword syntax to visually de-emphasize it: http://www.neilvandyke.org/weblog/2009/05/#2009-05-27 Someone requested the ability to color the "#" differently from the rest of the syntax, but I won't add that unless multiple people email me votes in favor (email me privately, not through the list). -- http://www.neilvandyke.org/ From robby at eecs.northwestern.edu Mon Jun 15 00:28:27 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Mon Jun 15 00:28:49 2009 Subject: [plt-scheme] Movable tabs In-Reply-To: <756daca50906121249i83d3205mf163606623cde7f4@mail.gmail.com> References: <391934950906121153v26214111q4632c73df2db71a9@mail.gmail.com> <756daca50906121249i83d3205mf163606623cde7f4@mail.gmail.com> Message-ID: <932b2f1f0906142128y7bfa910elb687cbf487b99b74@mail.gmail.com> I think that this would require changes to the low-level toolbox. We are in the midst of making it easier to make such changes (Matthew's started by porting the editor classes to Scheme, as you know, for v4.2) but it may be a while before we get to the point that we can make this change. Robby On Fri, Jun 12, 2009 at 2:49 PM, Grant Rettke wrote: > On Fri, Jun 12, 2009 at 1:53 PM, Rommel Martinez wrote: >> Is the idea of movable tabs in DrScheme reasonable? In this context, >> "movable" would mean something like the DND operations of an >> application like Firefox to reorganize the tabs. > > That is a nice feature. > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From morazanm at gmail.com Mon Jun 15 01:22:36 2009 From: morazanm at gmail.com (Marco Morazan) Date: Mon Jun 15 01:22:55 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <1245016021.28766.10.camel@ubuntu> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> <904774730906132022v495f03f7v7eee967ed9512b8@mail.gmail.com> <9b1fff280906140626u4f9725a1y7fb1c8ce257ba0cc@mail.gmail.com> <904774730906140737x6f8465d1na4a37c7e5158a574@mail.gmail.com> <9b1fff280906141149x38c756f0o4ca23685b8a09e2c@mail.gmail.com> <1245016021.28766.10.camel@ubuntu> Message-ID: <9b1fff280906142222v4b066f77qb06fd67f260cdf8b@mail.gmail.com> > > I think part of the point here is that humans classify, and are used to > the idea that kinds -- kinds of rice in the pot, kinds of screwdriver in > the toolbox, etc., matter to the effectiveness and correctness of > processes that involve working with stuff. ?The application of that > intuition to programming is not a large leap. > Correct, no it is not. Let me be clear. I am not advocating that we do away with types. I am not advocating that types are not useful in some circumstances. There is a difference, however, between what is a type (this has a formal meaning in CS) and the kind of and how data is manipulated. Types are useful, for example, to enforce abstraction barriers (e.g. stops the programmer from manipulating a bignum as an array of integers). There is no type system in the world that is going to tell me that my program is correct. In fact, many beginners fall into the trap of thinking that because their program got passed a type checker it must work correctly. Why do they believe that? IMHO, because when they started out programming getting passed the type checker was the "biggest" obstacle. In HtDP, contracts serve the purpose of classifying the kind of input and output is expected. So, yes beginning students can put "things" in boxes according to their kind. The nice thing, however, is that if they put things in the wrong box the error can be discovered by experimentation at this beginning age. No need to get passed a type checker! :-) -- Cheers, Marco From noelwelsh at gmail.com Mon Jun 15 04:39:05 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Mon Jun 15 04:39:37 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> <904774730906132022v495f03f7v7eee967ed9512b8@mail.gmail.com> <9b1fff280906140626u4f9725a1y7fb1c8ce257ba0cc@mail.gmail.com> <904774730906140737x6f8465d1na4a37c7e5158a574@mail.gmail.com> <4331ad810906141006w376e3f79jb1c7f0718c4ad92b@mail.gmail.com> <18997.23887.322783.673220@winooski.ccs.neu.edu> Message-ID: On Mon, Jun 15, 2009 at 12:29 AM, Shriram Krishnamurthi wrote: > I cannot improve on Eli's excellent essay, but I can provide concrete > evidence for one of his abstract points: Scala. ?(Which, in turn, has > baked in its own inflexibilities.) I spent a bit of time on the Scala list. It was interesting/amusing/instructive that requests for new syntax were fairly frequent. And Scala already has a very complex syntax. N. From noelwelsh at gmail.com Mon Jun 15 04:47:01 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Mon Jun 15 04:47:32 2009 Subject: [plt-scheme] Invoking units In-Reply-To: <1245024858.15610.12.camel@drserver> References: <1245024858.15610.12.camel@drserver> Message-ID: I always use the 'infer' variants these days. The unit gaussian-cluster@ below imports a binding named a (alpha rendered as ascii). I just define a in the lexical environment and invoke as follows: (define a (vector covariance prior-mean prior-covariance)) (define-values/invoke-unit/infer gaussian-cluster@) HTH, N. On Mon, Jun 15, 2009 at 1:14 AM, Paulo J. Matos wrote: > Hi, > > My units are a bit rusty and deprecated (last time I used them was > pretty much in 300 I guess). I have a unit that imports 3 thunks: ... From DekuDekuplex at Yahoo.com Mon Jun 15 04:49:47 2009 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Mon Jun 15 04:50:27 2009 Subject: [plt-scheme] Re: How difficult would creating a collaborative multi-user online virtual world application be in PLT Scheme? References: <5A441D1B-7941-40AF-8DE5-62C33FB59C03@brinckerhoff.org> Message-ID: On Thu, 11 Jun 2009 15:40:47 -0700, John Clements wrote: > >On Jun 11, 2009, at 1:30 AM, Benjamin L.Russell wrote: > Smalltalk is the "real" OO (cf. Matthias' talk), Incidentally, which talk are you referring to? I just checked his Web site (at http://www.ccs.neu.edu/home/matthias/presentations.html), and he has at least twenty-two presentations listed. -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ From DekuDekuplex at Yahoo.com Mon Jun 15 04:59:32 2009 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Mon Jun 15 05:00:09 2009 Subject: [plt-scheme] Re: How difficult would creating a collaborative multi-user online virtual world application be in PLT Scheme? References: <5A441D1B-7941-40AF-8DE5-62C33FB59C03@brinckerhoff.org> Message-ID: On Thu, 11 Jun 2009 15:40:47 -0700, John Clements wrote: > >On Jun 11, 2009, at 1:30 AM, Benjamin L.Russell wrote: > >Smalltalk is the "real" OO (cf. Matthias' talk), [Sorry, but somehow the above line was not quoted properly in my previous message, so I am resending this message as a correction.] Incidentally, which talk are you referring to? I just checked his Web site (at http://www.ccs.neu.edu/home/matthias/presentations.html), and he has at least twenty-two presentations listed. -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ From quaoarp at gmail.com Sun Jun 14 16:26:10 2009 From: quaoarp at gmail.com (quaoarp) Date: Mon Jun 15 05:09:47 2009 Subject: [plt-scheme] Slideshow subitem #:bullet (redefinition) Message-ID: Hello, In Slideshow I am trying to redefine the bullet showed by a "subitem" by setting it with the #:bullet option but I can't get it changed as the slide keeps on displaying the default o-bullet. Probably I am missing something. This is my test code: #lang slideshow (slide #:title "Test Item/subitem bullets.." (item #:bullet (tt "x") "This redefines the bullet as 'x'.") (subitem #:bullet (tt "*") "This 'should' (I think) re-define the o-bullet as '*' but it doesn't ..") ) Thank you in advance for any suggestion. Ale>< From pocmatos at gmail.com Mon Jun 15 06:21:12 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Mon Jun 15 06:21:33 2009 Subject: [plt-scheme] Invoking units In-Reply-To: References: <1245024858.15610.12.camel@drserver> Message-ID: <1245061273.15973.2.camel@drserver> On Mon, 2009-06-15 at 09:47 +0100, Noel Welsh wrote: > I always use the 'infer' variants these days. The unit > gaussian-cluster@ below imports a binding named a (alpha rendered as > ascii). I just define a in the lexical environment and invoke as > follows: > > (define a (vector covariance prior-mean prior-covariance)) > (define-values/invoke-unit/infer gaussian-cluster@) > Thanks Noel, but I don't think I can use the /infer variant. I am generating in run-time the unit code and passing the file name containing the unit to a function that dynamically requires it and invokes the unit. A small example is this: #lang scheme (define-signature test^ (test)) (define (main my-module) (let* ([test@ (dynamic-require my-module 'test@)] [test (lambda (foo) (* 2 foo))] [unit-result (invoke-unit/infer test@)]) unit-result)) This will generate: invoke-unit/infer: unknown unit definition in: test@ So, I guess my only solution is to link the unit manually... Cheers, Paulo Matos > HTH, > N. > > > On Mon, Jun 15, 2009 at 1:14 AM, Paulo J. Matos wrote: > > Hi, > > > > My units are a bit rusty and deprecated (last time I used them was > > pretty much in 300 I guess). I have a unit that imports 3 thunks: > ... From robby at eecs.northwestern.edu Mon Jun 15 07:25:51 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Mon Jun 15 07:26:13 2009 Subject: [plt-scheme] Re: How difficult would creating a collaborative multi-user online virtual world application be in PLT Scheme? In-Reply-To: References: <5A441D1B-7941-40AF-8DE5-62C33FB59C03@brinckerhoff.org> Message-ID: <932b2f1f0906150425g55025cdcpceac8f2507eb375f@mail.gmail.com> "Functional Objects" On Mon, Jun 15, 2009 at 3:59 AM, Benjamin L.Russell wrote: > On Thu, 11 Jun 2009 15:40:47 -0700, John Clements > wrote: > >> >>On Jun 11, 2009, at 1:30 AM, Benjamin L.Russell wrote: >> >>Smalltalk is the "real" OO (cf. Matthias' talk), > > [Sorry, but somehow the above line was not quoted properly in my > previous message, so I am resending this message as a correction.] > > Incidentally, which talk are you referring to? ?I just checked his Web > site (at http://www.ccs.neu.edu/home/matthias/presentations.html), and > he has at least twenty-two presentations listed. > > -- Benjamin L. Russell > -- > Benjamin L. Russell ?/ ? DekuDekuplex at Yahoo dot com > http://dekudekuplex.wordpress.com/ > Translator/Interpreter / Mobile: ?+011 81 80-3603-6725 > "Furuike ya, kawazu tobikomu mizu no oto." > -- Matsuo Basho^ > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From mflatt at cs.utah.edu Mon Jun 15 07:54:34 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Mon Jun 15 07:55:00 2009 Subject: [plt-scheme] Slideshow subitem #:bullet (redefinition) In-Reply-To: References: Message-ID: <20090615115438.393186500DD@mail-svr1.cs.utah.edu> At Sun, 14 Jun 2009 13:26:10 -0700 (PDT), quaoarp wrote: > In Slideshow I am trying to redefine the bullet showed by a "subitem" > by setting it with the #:bullet option but I can't get it changed as > the slide keeps on displaying the default o-bullet. That's a bug, now fixed in SVN. From DekuDekuplex at Yahoo.com Mon Jun 15 08:10:30 2009 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Mon Jun 15 08:11:09 2009 Subject: [plt-scheme] Re: How difficult would creating a collaborative multi-user online virtual world application be in PLT Scheme? References: <5A441D1B-7941-40AF-8DE5-62C33FB59C03@brinckerhoff.org> <932b2f1f0906150425g55025cdcpceac8f2507eb375f@mail.gmail.com> Message-ID: Thank you. Those slides are quite interesting.... In particular, there seem to be quite a few similarities in issues between functional and object-oriented programming. In particular, the following quote by Alan Kay on the elimination of assignment being one motivation for OOP is of particular note: >Though OOP came from many >motivations, two were central. >... [T]he small scale one was to >find a more flexible version >of assignment, and then to >try to eliminate it altogether. > >Alan Kay, >History of Smalltalk (1993) The quotes on favoring immutability by Joshua Bloch, and on using value objects whenever possible by Kent Beck, also seem to be similar to topics that come up in functional programming. -- Benjamin L. Russell On Mon, 15 Jun 2009 06:25:51 -0500, Robby Findler wrote: >"Functional Objects" > >On Mon, Jun 15, 2009 at 3:59 AM, Benjamin >L.Russell wrote: >> On Thu, 11 Jun 2009 15:40:47 -0700, John Clements >> wrote: >> >>> >>>On Jun 11, 2009, at 1:30 AM, Benjamin L.Russell wrote: >>> >>>Smalltalk is the "real" OO (cf. Matthias' talk), >> >> [Sorry, but somehow the above line was not quoted properly in my >> previous message, so I am resending this message as a correction.] >> >> Incidentally, which talk are you referring to? ?I just checked his Web >> site (at http://www.ccs.neu.edu/home/matthias/presentations.html), and >> he has at least twenty-two presentations listed. >> >> -- Benjamin L. Russell >> -- >> Benjamin L. Russell ?/ ? DekuDekuplex at Yahoo dot com >> http://dekudekuplex.wordpress.com/ >> Translator/Interpreter / Mobile: ?+011 81 80-3603-6725 >> "Furuike ya, kawazu tobikomu mizu no oto." >> -- Matsuo Basho^ >> >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ From aghuloum at gmail.com Mon Jun 15 08:30:26 2009 From: aghuloum at gmail.com (Abdulaziz Ghuloum) Date: Mon Jun 15 08:31:58 2009 Subject: [plt-scheme] poll: keyword syntax In-Reply-To: References: <20090614152554.ABAB96500CF@mail-svr1.cs.utah.edu> <06CE4A792CB746BB80A6CFB236F35C21@uw2b2dff239c4d> <4A3587F1.7020804@cs.utah.edu> Message-ID: <45964ED8-F1DB-4336-B615-B4C11BC85799@gmail.com> On Jun 15, 2009, at 2:32 AM, Shriram Krishnamurthi wrote: > To quote Matthew: > > "The "vote" is not binding in any sense. I'd just like to get a better > idea of what PLT Scheme programmers think, since I consider the > question to be purely a matter if opinion --- and not worth > debating at > all on the list. :)" > > But maybe that was a futile hope... Maybe it's because the question is not really a matter of pure opinion. The colon character is a valid identifier character in all RnRS's: making it a special keyword prefix or suffix poses interoperability problems when you mix plt-scheme code with other scheme code. The "#:keyword" syntax is an extension to the RnRS syntax, while the other syntaxes conflict with it. Maybe this is not really a big deal for PLT, I don't know. But it is a purely technical reason for why one syntax is preferable over the others. [I'll reserve my opinion to myself] Aziz,,, From matthias at ccs.neu.edu Mon Jun 15 08:53:12 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Jun 15 08:53:48 2009 Subject: [plt-scheme] Invoking units In-Reply-To: <1245061273.15973.2.camel@drserver> References: <1245024858.15610.12.camel@drserver> <1245061273.15973.2.camel@drserver> Message-ID: <23B669FD-AEDD-4ADE-ABF6-A307B1AE1520@ccs.neu.edu> You had the invoke wrong: foo is the main file. -- Matthias -------------- next part -------------- A non-text attachment was scrubbed... Name: foo.ss Type: application/octet-stream Size: 184 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090615/28a08565/foo.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: my-module.ss Type: application/octet-stream Size: 138 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090615/28a08565/my-module.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: my-sig.ss Type: application/octet-stream Size: 63 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090615/28a08565/my-sig.obj From sbloch at adelphi.edu Mon Jun 15 09:52:29 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Mon Jun 15 09:53:33 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> Message-ID: On Jun 13, 2009, at 7:04 PM, Todd O'Bryan wrote: > Have you never had a student try to return a number instead of a posn? > Or (much more common and much more painful) in the chapters on binary > trees and family trees, students get confused about the kinds of > structures they're building and bury a mistake so deep in a structure > that by the time they get the error message it's not clear where they > painted themselves into a corner. These are the problems that they > spend ten or fifteen minutes staring at, and when I get there, I know > it's a type problem, but there are three or four functions, all with > working test cases that could have triggered the problem, and I have > to spend 5 minutes unwinding everything with them. One of the things I've run into frequently in student programs is event handlers (for world.ss) that return a different type of "world" than they took in. This doesn't generally produce an error message until the NEXT event, at which point the student gets an error message from a different handler that may be perfectly correct. Here's a suggestion: add to world (now universe) an optional "legal" handler (defaulting to (lambda (x) #t) ) that is applied to the model returned by every handler, before doing anything else with that model. If it returns false, the animation ends with an error message saying "Invalid world returned by ___ handler" (fill in the blank with "mouse", "tick", or "key"). For example, ; The model for this animation is a non-negative number. (legal-when (lambda (r) (and (number? r) (>= r 0))) ; End the animation when the model exceeds 300. (stop-when (lambda (num) (> num 300))) ; Tick handler: add1 (on-tick add1) ; Redraw handler: (on-redraw (lambda (r) (circle r "solid" "blue"))) This would not only make it easier for students to find their bugs, but give them some actual code to write at the "choose a type for the model" step of the animation recipe. Students have a tendency to skip steps that don't produce code. Of course, enforced contracts would take care of the issue too, but I think we'll have to wait longer for them; this addition to "universe" could be in the next release. Stephen Bloch sbloch@adelphi.edu From matthias at ccs.neu.edu Mon Jun 15 10:07:31 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Jun 15 10:08:21 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> Message-ID: <69588938-2BF1-46EB-9402-C5108F434A4F@ccs.neu.edu> Thanks. This has been on my todo list. I considered adding (world? ...) to big-bang descriptions and (universe? ...) to universe descriptions. -- Matthias On Jun 15, 2009, at 9:52 AM, Stephen Bloch wrote: > > On Jun 13, 2009, at 7:04 PM, Todd O'Bryan wrote: > >> Have you never had a student try to return a number instead of a >> posn? >> Or (much more common and much more painful) in the chapters on binary >> trees and family trees, students get confused about the kinds of >> structures they're building and bury a mistake so deep in a structure >> that by the time they get the error message it's not clear where they >> painted themselves into a corner. These are the problems that they >> spend ten or fifteen minutes staring at, and when I get there, I know >> it's a type problem, but there are three or four functions, all with >> working test cases that could have triggered the problem, and I have >> to spend 5 minutes unwinding everything with them. > > One of the things I've run into frequently in student programs is > event handlers (for world.ss) that return a different type of > "world" than they took in. This doesn't generally produce an error > message until the NEXT event, at which point the student gets an > error message from a different handler that may be perfectly correct. > > Here's a suggestion: add to world (now universe) an optional > "legal" handler (defaulting to (lambda (x) #t) ) that is applied to > the model returned by every handler, before doing anything else > with that model. If it returns false, the animation ends with an > error message saying "Invalid world returned by ___ handler" (fill > in the blank with "mouse", "tick", or "key"). > > For example, > > ; The model for this animation is a non-negative number. > (legal-when (lambda (r) (and (number? r) (>= r 0))) > > ; End the animation when the model exceeds 300. > (stop-when (lambda (num) (> num 300))) > > ; Tick handler: add1 > (on-tick add1) > > ; Redraw handler: > (on-redraw (lambda (r) (circle r "solid" "blue"))) > > This would not only make it easier for students to find their bugs, > but give them some actual code to write at the "choose a type for > the model" step of the animation recipe. Students have a tendency > to skip steps that don't produce code. > > Of course, enforced contracts would take care of the issue too, but > I think we'll have to wait longer for them; this addition to > "universe" could be in the next release. > > Stephen Bloch > sbloch@adelphi.edu > > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From sbloch at adelphi.edu Mon Jun 15 10:17:36 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Mon Jun 15 10:19:01 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <990e0c030906132020td0736ech4be5d89dd8cdb9ff@mail.gmail.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <1D1394F3-C8B7-4135-9449-72C73DE0B074@adelphi.edu> <990e0c030906132020td0736ech4be5d89dd8cdb9ff@mail.gmail.com> Message-ID: <17CBA107-8DEC-4359-8F55-B2721910FAC8@adelphi.edu> I'm trying out some of the contract features to see what I could reasonably use in a first programming course. (require scheme/contract) (define/contract (fact n) (-> number? number?) (cond [(= n 7) true] [(<= n 0) 1] [else (* n (fact (- n 1)))])) (check-expect (fact 0) 1) (check-expect (fact 1) 1) (check-expect (fact 4) 24) (check-expect (fact 7) "bad news") (check-expect (fact 8) "bad news") It correctly catches the contract violation on (fact 7) when it's called from check-expect, but if I comment out that test case and try (fact 8), it does NOT catch the contract violation when fact calls itself. I guess that's what "the definition is a contract boundary" means, and I see the argument for it on efficiency grounds, but it's sort of annoying for beginning-programming use. BTW, the above definition works in ISL, but doesn't pass a syntax check in BSL. I've bug-reported it. Stephen Bloch sbloch@adelphi.edu From sbloch at adelphi.edu Mon Jun 15 10:19:56 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Mon Jun 15 10:20:58 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <469B6FCF-A60C-41FD-A47D-52C465138BC3@ccs.neu.edu> Message-ID: On Jun 13, 2009, at 7:36 PM, Matthias Felleisen wrote: > 5. I don't understand how your students can have test cases for > each function and NOT see that their functions are producing the > wrong things. Code excerpts would be helpful. Two ways: 5a) The contract is wrong. 5b) The test cases (and the program) don't follow the contract. My students routinely make both of those mistakes. Stephen Bloch sbloch@adelphi.edu From matthias at ccs.neu.edu Mon Jun 15 10:24:02 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Jun 15 10:24:51 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <17CBA107-8DEC-4359-8F55-B2721910FAC8@adelphi.edu> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <1D1394F3-C8B7-4135-9449-72C73DE0B074@adelphi.edu> <990e0c030906132020td0736ech4be5d89dd8cdb9ff@mail.gmail.com> <17CBA107-8DEC-4359-8F55-B2721910FAC8@adelphi.edu> Message-ID: <903F134F-4B38-45BB-8772-591300A6E5FE@ccs.neu.edu> Not a bug. On Jun 15, 2009, at 10:17 AM, Stephen Bloch wrote: > I'm trying out some of the contract features to see what I could > reasonably use in a first programming course. > > (require scheme/contract) > > (define/contract (fact n) > (-> number? number?) > (cond [(= n 7) true] > [(<= n 0) 1] > [else (* n (fact (- n 1)))])) > > (check-expect (fact 0) 1) > (check-expect (fact 1) 1) > (check-expect (fact 4) 24) > (check-expect (fact 7) "bad news") > (check-expect (fact 8) "bad news") > > It correctly catches the contract violation on (fact 7) when it's > called from check-expect, but if I comment out that test case and > try (fact 8), it does NOT catch the contract violation when fact > calls itself. I guess that's what "the definition is a contract > boundary" means, and I see the argument for it on efficiency > grounds, but it's sort of annoying for beginning-programming use. > > > BTW, the above definition works in ISL, but doesn't pass a syntax > check in BSL. I've bug-reported it. > > Stephen Bloch > sbloch@adelphi.edu > > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From rovitotv at gmail.com Mon Jun 15 10:50:07 2009 From: rovitotv at gmail.com (Todd Rovito) Date: Mon Jun 15 10:50:33 2009 Subject: [plt-scheme] Question on build process for Linux and Mac OSX In-Reply-To: <18997.24552.160901.720703@winooski.ccs.neu.edu> References: <18997.24552.160901.720703@winooski.ccs.neu.edu> Message-ID: Eli, Thanks that did the trick I removed the spaces from the source tree and it built perfect. Now I have both CGC and 3m garbage collectors with a similar build process for Linux and OS X. I appreciate the fast reply, you are a genius. On Sun, Jun 14, 2009 at 10:39 AM, Eli Barzilay wrote: > On Jun 14, Todd Rovito wrote: >> Greetings, >> ? ?I would like to create a simple build process that creates mzscheme >> and shared libs for both CGC and 3m garbage collectors. ?For Linux I >> perform the following steps with the source tree: >> ? ? ? ? ./configure --prefix=/opt/plt-scheme --enable-shared >> ? ? ? ? make both >> ? ? ? ? make install-both >> >> This seems to work and I get .so files for everything I need. ?On the >> Mac OSX side I am struggling, admittedly I am less familar with OSX. >> ? ? ? ?./configure --enable-xonx >> --prefix=/Users/rovitotv/prog/plt-scheme/ --enable-shared >> --disable-mred >> ? ? ? ?make both <--- this step never finishes I get an error. >> >> The output from configure and make are below, thanks for the help. > > It looks like you're trying to build in one directory, using sources > from a different directory called > > ?/Users/rovitotv/prog/PLT Scheme v4.2 Source/ > > and the problem is the spaces in the name. ?There are probably more > than a few places in the makefiles that don't deal gracefully with > such spaces, but fixing them is pointless since autoconf itself breaks > with spaces too. ?If you build inside the PLT tree (eg, make a > directory called .../PLT/src/build, then in it run ../configure) then > things work because paths will be relative so they'll have no spaces. > > -- > ? ? ? ? ?((lambda (x) (x x)) (lambda (x) (x x))) ? ? ? ? ?Eli Barzilay: > ? ? ? ? ? ? ? ? ?http://www.barzilay.org/ ? ? ? ? ? ? ? ? Maze is Life! > From pocmatos at gmail.com Mon Jun 15 10:50:35 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Mon Jun 15 10:51:17 2009 Subject: [plt-scheme] Invoking units In-Reply-To: <23B669FD-AEDD-4ADE-ABF6-A307B1AE1520@ccs.neu.edu> References: <1245024858.15610.12.camel@drserver> <1245061273.15973.2.camel@drserver> <23B669FD-AEDD-4ADE-ABF6-A307B1AE1520@ccs.neu.edu> Message-ID: <11b141710906150750v9a8025bp789c377846b0ddc5@mail.gmail.com> On Mon, Jun 15, 2009 at 1:53 PM, Matthias Felleisen wrote: > > You had the invoke wrong: foo is the main file. -- Matthias > > > > > So, in fact, I don't need to either use /infer or link the bindings manually. for the record, this is how I tried to solve it: (let ([test@ (dynamic-require gen-file 'test@)] [provider@ (unit (import) (export test^) (define (test x) (* 2 x)))] [full-unit@ (compound-unit (import) (export) (link (((TEST : test^)) provider@) (() test@ TEST)))]) (invoke-unit full-unit@)) I defined a compound unit without any imports/exports and invoked it. You solution seems to be more elegant. I didn't know invoke-unit on its own would deduce the static bindings for the signature. Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From pocmatos at gmail.com Mon Jun 15 10:51:03 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Mon Jun 15 10:51:43 2009 Subject: [plt-scheme] Invoking units In-Reply-To: <11b141710906150750v9a8025bp789c377846b0ddc5@mail.gmail.com> References: <1245024858.15610.12.camel@drserver> <1245061273.15973.2.camel@drserver> <23B669FD-AEDD-4ADE-ABF6-A307B1AE1520@ccs.neu.edu> <11b141710906150750v9a8025bp789c377846b0ddc5@mail.gmail.com> Message-ID: <11b141710906150751t2cad22a3w7119d7665f3a62d4@mail.gmail.com> On Mon, Jun 15, 2009 at 3:50 PM, Paulo J. Matos wrote: > On Mon, Jun 15, 2009 at 1:53 PM, Matthias Felleisen wrote: >> >> You had the invoke wrong: foo is the main file. -- Matthias >> >> >> >> >> > And of course, thank you very much for your help! :) > So, in fact, I don't need to either use /infer or link the bindings manually. > for the record, this is how I tried to solve it: > (let ([test@ (dynamic-require gen-file 'test@)] > ? ? ?[provider@ (unit (import) (export test^) > ? ? ? ? ? ? ? ? ? ? ? ? ?(define (test x) (* 2 x)))] > ? ? ? [full-unit@ (compound-unit > ? ? ? ? ? ? ? ? ? ? ?(import) > ? ? ? ? ? ? ? ? ? ? ?(export) > ? ? ? ? ? ? ? ? ? ? ?(link (((TEST : test^)) provider@) > ? ? ? ? ? ? ? ? ? ? ? ? ? ?(() test@ TEST)))]) > (invoke-unit full-unit@)) > > I defined a compound unit without any imports/exports and invoked it. > > You solution seems to be more elegant. I didn't know invoke-unit on > its own would deduce the static bindings for the signature. > > Cheers, > -- > Paulo Jorge Matos - pocmatos at gmail.com > http://www.pmatos.net > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From matthias at ccs.neu.edu Mon Jun 15 10:53:30 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Jun 15 10:54:13 2009 Subject: [plt-scheme] Invoking units In-Reply-To: <11b141710906150750v9a8025bp789c377846b0ddc5@mail.gmail.com> References: <1245024858.15610.12.camel@drserver> <1245061273.15973.2.camel@drserver> <23B669FD-AEDD-4ADE-ABF6-A307B1AE1520@ccs.neu.edu> <11b141710906150750v9a8025bp789c377846b0ddc5@mail.gmail.com> Message-ID: On Jun 15, 2009, at 10:50 AM, Paulo J. Matos wrote: > You solution seems to be more elegant. I didn't know invoke-unit on > its own would deduce the static bindings for the signature. It doesn't. When I wrote (invoke-unit test@ (import test^)) I specified what it should grab from the lexical context. From hendrik at topoi.pooq.com Mon Jun 15 11:02:59 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Mon Jun 15 11:10:16 2009 Subject: [BULK] Re: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <620BD8F6-2AC0-48EE-A58F-A75E2D676C42@adelphi.edu> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <1D1394F3-C8B7-4135-9449-72C73DE0B074@adelphi.edu> <20090614033226.GA1269@topoi.pooq.com> <620BD8F6-2AC0-48EE-A58F-A75E2D676C42@adelphi.edu> Message-ID: <20090615150259.GA5110@topoi.pooq.com> On Sun, Jun 14, 2009 at 02:32:49PM -0400, Stephen Bloch wrote: > I wrote: > >>I'm missing something. Why shouldn't type be a type? > > To which Hendrik replied: > >No good reason at all, unles syou're into formal logic and type > >theory, > >in which case you find there are metarecursive loopholes which admit > >infinite proofs and nonterminating programs. > > > >So if you don't mind being able to write a nonterminating program > >occasionally, there's no particular reason why type shouldn't be a > >type. > > For those of us who have studied logic but not (much) language theory, > could you elaborate on this? There's a formal correspondence between statements in a formal system and types. I believe it's called the Curry-Howard correspondence. Roughly speaking, a proposition corresponds to a type a proof of a propsition corresponds to a value of the type. A proof that P implies Q corresponds to a function from P to Q (thus we can think of the function as converting proofs of P into proofs of Q) A proof of P & Q is a pair of a proof of P and a proof of Q. Correspondingly, we get a Catesian product of types. There are dependent types, which I write v : T -> S, where S contains free occurrences of v. This is a type for functions whose returned values have a type which depends on the argument. In logic, this corresponds to the universal quantifier, And so on. This whole thing breaks down if you have nonterminating programs, because a function F defined as let F = lambda x. F(x) gives an infinite recursion, and can be typed to return any type whatsoever, even those that correspond to false propositions. And if you let type be a type, it turns out to be possible to create set-theoretical paradoxes out of this stuff, whose "proofs" are nonterminating functions. > Obviously a program that keeps iterating > "type-of" until reaching something that doesn't have a type will go > infinite if everything (including "type") has a type, but that's > inevitable; is there a more interesting and reasonably short example? > > Steve Bloch From pocmatos at gmail.com Mon Jun 15 11:46:56 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Mon Jun 15 11:47:40 2009 Subject: [plt-scheme] Requiring absolute path Message-ID: <11b141710906150846h57ee05e5q89b6dd43faf0b7d4@mail.gmail.com> Hi all, I have a scm file which is a library to another file and once this library is installed it resides in the system and I know its absolute path. The client only knows its absolute path. Obviously the relative path to it depends of where the client is, so I tried: (require (path->string (find-relative-path (current-directory) "/home/pmatos/Software/eboc/src/modes/esmc-mode/eventb-lib.scm"))) path->string: not a require sub-form in: (path->string (find-relative-path (current-directory) "/home/pmatos/Software/eboc/src/modes/esmc-mode/eventb-lib.scm")) but it doesn't work. Nor this [and I understand that both cases don't work!]: (define src (path->string (find-relative-path (current-directory) "/home/pmatos/Software/eboc/src/modes/esmc-mode/eventb-lib.scm"))) (require src) src: standard-module-name-resolver: collection not found: "src" in any of: (# #) in: src So, I though, maybe with dynamic require I can require it by using a relative path known at run time or an absolute path known at compile-time. But I have no idea on how to use dynamic-require to get all the exports of the module... because I don't really understand what's the difference of providing a # or #f as second argument to dynamic-require. Any suggestions? Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From chust at web.de Mon Jun 15 12:42:30 2009 From: chust at web.de (Thomas Chust) Date: Mon Jun 15 12:42:49 2009 Subject: [plt-scheme] Requiring absolute path In-Reply-To: <11b141710906150846h57ee05e5q89b6dd43faf0b7d4@mail.gmail.com> References: <11b141710906150846h57ee05e5q89b6dd43faf0b7d4@mail.gmail.com> Message-ID: <1c1a33bc0906150942y3ddcd348i5da7f1579c77cb3d@mail.gmail.com> 2009/6/15 Paulo J. Matos : > [...] > I have a scm file which is a library to another file and once this > library is installed it resides in the system and I know its absolute > path. > [...] Hello, my suggestion would be to either add the path where the module resides to the PLT Scheme collection paths or to use a form like this: (require (file "/home/pmatos/Software/eboc/src/modes/esmc-mode/eventb-lib.scm")) cu, Thomas -- When C++ is your hammer, every problem looks like your thumb. From sbloch at adelphi.edu Mon Jun 15 13:10:42 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Mon Jun 15 13:11:49 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <20090615150259.GA5110@topoi.pooq.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <1D1394F3-C8B7-4135-9449-72C73DE0B074@adelphi.edu> <20090614033226.GA1269@topoi.pooq.com> <620BD8F6-2AC0-48EE-A58F-A75E2D676C42@adelphi.edu> <20090615150259.GA5110@topoi.pooq.com> Message-ID: <5AA3A5B0-45BB-435E-B1AE-99601DB38C80@adelphi.edu> On Jun 15, 2009, at 11:02 AM, hendrik@topoi.pooq.com wrote: > There's a formal correspondence between statements in a formal system > and types. I believe it's called the Curry-Howard correspondence. Yes, I saw that in grad school. > Roughly speaking, > > a proposition corresponds to a type > a proof of a propsition corresponds to a value of the type. > A proof that P implies Q corresponds to a function from P to Q (thus > we can think of the function as converting proofs of P into proofs > of Q) > A proof of P & Q is a pair of a proof of P and a proof of Q. > Correspondingly, we get a Catesian product of types. > > There are dependent types, which I write > v : T -> S, where S contains free occurrences of v. > This is a type for functions whose returned values have a type which > depends on the argument. In logic, this corresponds to the universal > quantifier, > > And so on. > > This whole thing breaks down if you have nonterminating programs, > because a function F defined as > let F = lambda x. F(x) > gives an infinite recursion, and can be typed to return any type > whatsoever, even those that correspond to false propositions. > > And if you let type be a type, it turns out to be possible to create > set-theoretical paradoxes out of this stuff, whose "proofs" are > nonterminating functions. IIRC, under at least some definitions, typed lambda-calculus is not only decidable but polynomial-time decidable. This is a lovely guarantee of termination, and even termination in a reasonable length of time, but it also means you can't write programs for problems that don't have polynomial-time solutions -- in fact, you can't write programs for problems without a KNOWN polynomial-time algorithm, like CLIQUE, SAT, Travelling Salesman, etc. not to mention intentionally non-terminating programs such as operating systems and servers, or programs that look for counterexamples to the Riemann hypothesis. It always seemed to me that by insisting on decidability of term equivalence, we were throwing out a lot of practical programming power. (Part of my dissertation was defining a functional language in which the only programs you could write were parallelizable to O (log(n)) time -- not that you would actually want to program in that language, but just to show that it could be done.) I'm reading Meyer & Reinhold's _'Type' is not a type_ paper right now. The crucial paragraph seems to be "The failure of property (2) (strong normalisation) is not by itself surprising, since in a general programming language one expects terms which define divergent computations not to have normal forms. Similarly, the failure of property (3) (undecidability of term equivalence) is to be expected. But the failure of property (4) means that it is not decidable whether a term has a given type, and more generally whether two types are equal. This undermines the possibility of effective "static" type-checking before runtime. Finally, the failure of property (5), conservative extension, is also serious as we indicate in Section 4 below." In other words, the issue isn't so much non-terminating or non- provably-terminating programs -- those are inevitable, as I said in my previous post -- but non-terminating compile-time type checks. If a programmer writes a program that goes infinite, the programmer deserves what (s)he gets, but if a programmer writes a program on which the COMPILER goes infinite, whom do you blame? The aforementioned Section 4 points out that (a) having a type of all types allows you to construct a fixed-point operator Y; (b) having a fixed-point operator Y allows you to find a fixed-point for the "add1" function, i.e. a number which is 1 more than itself, and hence both even and odd, which is a little disturbing; (c) the existence of such a number, together with an (apparently) reasonably-defined conditional operator and (apparently) reasonable equality axioms, allows you to prove that ANY two terms of the same type are equal, which is even more disturbing. As Meyer and Reinhold point out, the usual interpretation for a fixed- point of "add1" is a nonstandard integer value that corresponds to non-terminating computations. The difficulty can therefore be seen as a conflict between an axiomatization that has non-standard models and a conditional operator that makes sense on "standard" or "convergent" values, but goes kerflooey when you bring in such nonstandard values. I guess it's analogous to the problem with "the set of all sets" that led to Russell's paradox, the dismantling of naive set theory, the _Principia Mathematica_, and thence to Goedel's incompleteness theorems. I'll have to think about this: "type" as a type still seems so elegant, so expressively efficient :-) My naive first impulse is to suggest a consistent but incomplete static type-checker that never misclassifies something's type, correctly classifies the types of MOST expressions in practice, and when it can't, knows when to give up so it at least terminates. Has somebody already proven that that's unattainable too? Stephen Bloch sbloch@adelphi.edu From adityashukla1983 at gmail.com Mon Jun 15 13:24:50 2009 From: adityashukla1983 at gmail.com (aditya shukla) Date: Mon Jun 15 13:25:09 2009 Subject: [plt-scheme] Reading and understanding large programs Message-ID: <73045cca0906151024h7c80ccal165dd0706f0030eb@mail.gmail.com> Hello Everyone, Can someone please share some ideas on how to go about reading and understanding large programs? Aditya -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090615/b883e49e/attachment.html From sk at cs.brown.edu Mon Jun 15 13:27:35 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Mon Jun 15 13:28:12 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <5AA3A5B0-45BB-435E-B1AE-99601DB38C80@adelphi.edu> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <1D1394F3-C8B7-4135-9449-72C73DE0B074@adelphi.edu> <20090614033226.GA1269@topoi.pooq.com> <620BD8F6-2AC0-48EE-A58F-A75E2D676C42@adelphi.edu> <20090615150259.GA5110@topoi.pooq.com> <5AA3A5B0-45BB-435E-B1AE-99601DB38C80@adelphi.edu> Message-ID: Yes, that's the paper. Your reading of the setup is (not surprisingly!) right. And yes, it is a translation of Russell's paradox into the type system. Shriram From ramalho at gmail.com Mon Jun 15 13:42:29 2009 From: ramalho at gmail.com (Luciano Ramalho) Date: Mon Jun 15 13:42:46 2009 Subject: [plt-scheme] Reading and understanding large programs In-Reply-To: <73045cca0906151024h7c80ccal165dd0706f0030eb@mail.gmail.com> References: <73045cca0906151024h7c80ccal165dd0706f0030eb@mail.gmail.com> Message-ID: <4331ad810906151042kba0251cne0558fef8730bc57@mail.gmail.com> On Mon, Jun 15, 2009 at 2:24 PM, aditya shukla wrote: > Can someone please share some ideas on how to go about reading and > understanding large programs? Are you comfortable reading and understanding small programs? If so, then determine how you to split the large program in small parts. A well designed large program is always modular, you just need to figure out how it is structured. Then test and exercise the parts separately. A modern well designed large program should also have a suite of tests that can help you understand how individual components work. If the program does not have tests, writing tests is the best way to start understanding it. Cheers, Luciano From acowley at seas.upenn.edu Mon Jun 15 13:49:30 2009 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Mon Jun 15 13:49:53 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <5AA3A5B0-45BB-435E-B1AE-99601DB38C80@adelphi.edu> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <1D1394F3-C8B7-4135-9449-72C73DE0B074@adelphi.edu> <20090614033226.GA1269@topoi.pooq.com> <620BD8F6-2AC0-48EE-A58F-A75E2D676C42@adelphi.edu> <20090615150259.GA5110@topoi.pooq.com> <5AA3A5B0-45BB-435E-B1AE-99601DB38C80@adelphi.edu> Message-ID: <81addec70906151049j39b69ae6tdbd9311a0aaf509f@mail.gmail.com> On Mon, Jun 15, 2009 at 1:10 PM, Stephen Bloch wrote: > I'll have to think about this: "type" as a type still seems so elegant, so > expressively efficient :-) ?My naive first impulse is to suggest a > consistent but incomplete static type-checker that never misclassifies > something's type, correctly classifies the types of MOST expressions in > practice, and when it can't, knows when to give up so it at least > terminates. ?Has somebody already proven that that's unattainable too? FWIW, I rather like Agda's intuitionistic approach to this via it's Set type hierarchy. Set is not an element of Set, but that doesn't stop you from working with higher order constructs. I'm not sure what a great reference would be, but if you just search for "Set1" (which does contain Set!) in the link below you can see some examples. http://www.cs.chalmers.se/~ulfn/darcs/AFP08/LectureNotes/AgdaIntro.pdf Anthony From matthias at ccs.neu.edu Mon Jun 15 14:00:30 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Jun 15 14:01:21 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <69588938-2BF1-46EB-9402-C5108F434A4F@ccs.neu.edu> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <69588938-2BF1-46EB-9402-C5108F434A4F@ccs.neu.edu> Message-ID: <17E879BE-9BD8-4B4A-B082-F83B60559E0C@ccs.neu.edu> Committed to code base. Documentation will show up after dental cleaning app't :-) -- Matthias On Jun 15, 2009, at 10:07 AM, Matthias Felleisen wrote: > > Thanks. This has been on my todo list. I considered adding > > (world? ...) > > to big-bang descriptions and > > (universe? ...) > > to universe descriptions. -- Matthias > > > > On Jun 15, 2009, at 9:52 AM, Stephen Bloch wrote: > >> >> On Jun 13, 2009, at 7:04 PM, Todd O'Bryan wrote: >> >>> Have you never had a student try to return a number instead of a >>> posn? >>> Or (much more common and much more painful) in the chapters on >>> binary >>> trees and family trees, students get confused about the kinds of >>> structures they're building and bury a mistake so deep in a >>> structure >>> that by the time they get the error message it's not clear where >>> they >>> painted themselves into a corner. These are the problems that they >>> spend ten or fifteen minutes staring at, and when I get there, I >>> know >>> it's a type problem, but there are three or four functions, all with >>> working test cases that could have triggered the problem, and I have >>> to spend 5 minutes unwinding everything with them. >> >> One of the things I've run into frequently in student programs is >> event handlers (for world.ss) that return a different type of >> "world" than they took in. This doesn't generally produce an >> error message until the NEXT event, at which point the student >> gets an error message from a different handler that may be >> perfectly correct. >> >> Here's a suggestion: add to world (now universe) an optional >> "legal" handler (defaulting to (lambda (x) #t) ) that is applied >> to the model returned by every handler, before doing anything else >> with that model. If it returns false, the animation ends with an >> error message saying "Invalid world returned by ___ handler" (fill >> in the blank with "mouse", "tick", or "key"). >> >> For example, >> >> ; The model for this animation is a non-negative number. >> (legal-when (lambda (r) (and (number? r) (>= r 0))) >> >> ; End the animation when the model exceeds 300. >> (stop-when (lambda (num) (> num 300))) >> >> ; Tick handler: add1 >> (on-tick add1) >> >> ; Redraw handler: >> (on-redraw (lambda (r) (circle r "solid" "blue"))) >> >> This would not only make it easier for students to find their >> bugs, but give them some actual code to write at the "choose a >> type for the model" step of the animation recipe. Students have a >> tendency to skip steps that don't produce code. >> >> Of course, enforced contracts would take care of the issue too, >> but I think we'll have to wait longer for them; this addition to >> "universe" could be in the next release. >> >> Stephen Bloch >> sbloch@adelphi.edu >> >> >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From ebellani at gmail.com Mon Jun 15 14:11:47 2009 From: ebellani at gmail.com (ebellani@gmail.com) Date: Mon Jun 15 14:12:31 2009 Subject: [plt-scheme] Dr scheme interactions window position Message-ID: Hey guys. Small doubt, how would one place the interactions window side by side with the definitions window? Hugs -- Eduardo Bellani www.cnxs.com.br Someone once called me "just a dreamer" That offended me, the "just" part. Being a dreamer is hard work. It really gets hard when you start believing in your dreams. --Doug Engelbart -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: OpenPGP digital signature Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090615/00ef5fee/signature.pgp From william.wood3 at comcast.net Mon Jun 15 14:29:30 2009 From: william.wood3 at comcast.net (Bill Wood) Date: Mon Jun 15 14:37:55 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <5AA3A5B0-45BB-435E-B1AE-99601DB38C80@adelphi.edu> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <1D1394F3-C8B7-4135-9449-72C73DE0B074@adelphi.edu> <20090614033226.GA1269@topoi.pooq.com> <620BD8F6-2AC0-48EE-A58F-A75E2D676C42@adelphi.edu> <20090615150259.GA5110@topoi.pooq.com> <5AA3A5B0-45BB-435E-B1AE-99601DB38C80@adelphi.edu> Message-ID: <1245090570.27888.12.camel@ubuntu> On Mon, 2009-06-15 at 13:10 -0400, Stephen Bloch wrote: . . . > I'll have to think about this: "type" as a type still seems so > elegant, so expressively efficient :-) My naive first impulse is to > suggest a consistent but incomplete static type-checker that never > misclassifies something's type, correctly classifies the types of > MOST expressions in practice, and when it can't, knows when to give > up so it at least terminates. Has somebody already proven that > that's unattainable too? Just a shot in the dark here: This seems to be similar to the question of the existence of decision procedures for classical predicate calculi. IIRC Goedel showed that first-order PC had no decision procedure but Herbrand showed there was a semi-decision procedure -- one that always halted on theorems but that might spin attempting to find a counter-example to a non-theorem (the non-theorem may have no finite counter-examples but have an infinite one). As I understand it second-order PC, however, does not have even a semi-decision procedure, for if it did it could be used to build a decision procedure for FOPC. If something analogous holds for intuitionistic PC (the logic involved in the Curry-Howard Correspondence) then might it defeat your incomplete type-checker? -- Bill Wood From anh at cs.rit.edu Mon Jun 15 14:40:39 2009 From: anh at cs.rit.edu (Arthur Nunes-Harwit) Date: Mon Jun 15 14:40:59 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <5AA3A5B0-45BB-435E-B1AE-99601DB38C80@adelphi.edu> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <1D1394F3-C8B7-4135-9449-72C73DE0B074@adelphi.edu> <20090614033226.GA1269@topoi.pooq.com> <620BD8F6-2AC0-48EE-A58F-A75E2D676C42@adelphi.edu> <20090615150259.GA5110@topoi.pooq.com> <5AA3A5B0-45BB-435E-B1AE-99601DB38C80@adelphi.edu> Message-ID: > I guess it's analogous to the problem with "the set of all sets" that > led to Russell's paradox, the dismantling of naive set theory, the > _Principia Mathematica_, and thence to Goedel's incompleteness theorems. I'd like to see some more dots connected. While Russell & Whitehead's theory to avoid the paradox involved a hierarchy, the set theories that were widely embraced (eg Zermelo-Fraenkel and von_Neumann-Bernays-Goedel) had little or no hierarchy. > I'll have to think about this: "type" as a type still seems so elegant, > so expressively efficient. ... Has somebody already proven that that's > unattainable too? While Meyer and Reinhold's paper is suggestive, it doesn't appear to me to be the last word. We want to avoid a system that can prove "bad" theorems. Might there be other ways to avoid bad theorems other than hierarchy? -Arthur From pocmatos at gmail.com Mon Jun 15 15:21:27 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Mon Jun 15 15:21:49 2009 Subject: [plt-scheme] Dr scheme interactions window position In-Reply-To: References: Message-ID: <1245093687.31176.0.camel@drserver> On Mon, 2009-06-15 at 15:11 -0300, ebellani@gmail.com wrote: > Hey guys. > Small doubt, how would one place the interactions window side by side with the > definitions window? Preferences > General > [2nd from last option] > > Hugs > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From pocmatos at gmail.com Mon Jun 15 15:26:02 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Mon Jun 15 15:26:22 2009 Subject: [plt-scheme] Requiring absolute path In-Reply-To: <1c1a33bc0906150942y3ddcd348i5da7f1579c77cb3d@mail.gmail.com> References: <11b141710906150846h57ee05e5q89b6dd43faf0b7d4@mail.gmail.com> <1c1a33bc0906150942y3ddcd348i5da7f1579c77cb3d@mail.gmail.com> Message-ID: <1245093962.31176.1.camel@drserver> On Mon, 2009-06-15 at 18:42 +0200, Thomas Chust wrote: > 2009/6/15 Paulo J. Matos : > > [...] > > I have a scm file which is a library to another file and once this > > library is installed it resides in the system and I know its absolute > > path. > > [...] > > Hello, > > my suggestion would be to either add the path where the module resides > to the PLT Scheme collection paths or to use a form like this: > (require (file > "/home/pmatos/Software/eboc/src/modes/esmc-mode/eventb-lib.scm")) > Interesting... had forgotten about the existence of (file ...) within require. Thanks! > cu, > Thomas > > From noelwelsh at gmail.com Mon Jun 15 16:04:34 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Mon Jun 15 16:04:54 2009 Subject: [plt-scheme] Requiring absolute path In-Reply-To: <11b141710906150846h57ee05e5q89b6dd43faf0b7d4@mail.gmail.com> References: <11b141710906150846h57ee05e5q89b6dd43faf0b7d4@mail.gmail.com> Message-ID: On Mon, Jun 15, 2009 at 4:46 PM, Paulo J. Matos wrote: > Hi all, > > I have a scm file which is a library to another file and once this > library is installed it resides in the system and I know its absolute > path. Why not just install a planet development link? You can do this programmatically -- see sake. N. From raould at gmail.com Mon Jun 15 16:17:03 2009 From: raould at gmail.com (Raoul Duke) Date: Mon Jun 15 16:40:00 2009 Subject: [plt-scheme] Reading and understanding large programs In-Reply-To: <73045cca0906151024h7c80ccal165dd0706f0030eb@mail.gmail.com> References: <73045cca0906151024h7c80ccal165dd0706f0030eb@mail.gmail.com> Message-ID: <91a2ba3e0906151317p47263e7m4e71e3fb9a40352a@mail.gmail.com> > Can someone please share some ideas on how to go about reading and > understanding large programs? perhaps considered gauche by some, i like running things in a debugger and watching the flow for a certain use story. From pocmatos at gmail.com Mon Jun 15 16:59:48 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Mon Jun 15 17:00:30 2009 Subject: [plt-scheme] Requiring absolute path In-Reply-To: References: <11b141710906150846h57ee05e5q89b6dd43faf0b7d4@mail.gmail.com> Message-ID: <11b141710906151359s68b25d2bl6ef3258c6a3ed6de@mail.gmail.com> On Mon, Jun 15, 2009 at 9:04 PM, Noel Welsh wrote: > On Mon, Jun 15, 2009 at 4:46 PM, Paulo J. Matos wrote: >> Hi all, >> >> I have a scm file which is a library to another file and once this >> library is installed it resides in the system and I know its absolute >> path. > > Why not just install a planet development link? You can do this > programmatically -- see sake. > maybe i am missing something but what do you mean by a planet development link? cheers, Paulo Matos > N. > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From neil at neilvandyke.org Mon Jun 15 17:12:09 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Mon Jun 15 17:12:50 2009 Subject: [plt-scheme] Requiring absolute path In-Reply-To: <11b141710906151359s68b25d2bl6ef3258c6a3ed6de@mail.gmail.com> References: <11b141710906150846h57ee05e5q89b6dd43faf0b7d4@mail.gmail.com> <11b141710906151359s68b25d2bl6ef3258c6a3ed6de@mail.gmail.com> Message-ID: <4A36B929.9030007@neilvandyke.org> Paulo J. Matos wrote at 06/15/2009 04:59 PM: > maybe i am missing something but what do you mean by a planet development link? > Courtesy of Google: http://docs.plt-scheme.org/planet/Developing_Packages_for_PLaneT.html#(part._devlinks) From pocmatos at gmail.com Mon Jun 15 17:21:32 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Mon Jun 15 17:22:14 2009 Subject: [plt-scheme] Requiring absolute path In-Reply-To: <4A36B929.9030007@neilvandyke.org> References: <11b141710906150846h57ee05e5q89b6dd43faf0b7d4@mail.gmail.com> <11b141710906151359s68b25d2bl6ef3258c6a3ed6de@mail.gmail.com> <4A36B929.9030007@neilvandyke.org> Message-ID: <11b141710906151421r4aa07421qbdf2308cc9aff546@mail.gmail.com> On Mon, Jun 15, 2009 at 10:12 PM, Neil Van Dyke wrote: > Paulo J. Matos wrote at 06/15/2009 04:59 PM: >> >> maybe i am missing something but what do you mean by a planet development >> link? >> > > Courtesy of Google: > http://docs.plt-scheme.org/planet/Developing_Packages_for_PLaneT.html#(part._devlinks) > Thanks for the reference! -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From neil at neilvandyke.org Mon Jun 15 17:21:55 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Mon Jun 15 17:22:40 2009 Subject: [plt-scheme] Requiring absolute path In-Reply-To: <4A36B929.9030007@neilvandyke.org> References: <11b141710906150846h57ee05e5q89b6dd43faf0b7d4@mail.gmail.com> <11b141710906151359s68b25d2bl6ef3258c6a3ed6de@mail.gmail.com> <4A36B929.9030007@neilvandyke.org> Message-ID: <4A36BB73.7000006@neilvandyke.org> Neil Van Dyke wrote at 06/15/2009 05:12 PM: > Paulo J. Matos wrote at 06/15/2009 04:59 PM: >> maybe i am missing something but what do you mean by a planet >> development link? >> > > Courtesy of Google: > http://docs.plt-scheme.org/planet/Developing_Packages_for_PLaneT.html#(part._devlinks) > For example, my "~/scheme/Makefile" at the moment includes the production: planet-links: @echo "" planet unlink neil randtok.plt 1 0 @echo "" planet link neil testeez.plt 1 3 ~/scheme/testeez planet link neil csv.plt 1 6 ~/scheme/csv planet link neil postnet.plt 1 1 ~/scheme/postnet planet link neil urlskip.plt 1 1 ~/scheme/urlskip planet link neil bigtime.plt 1 0 ~/scheme/bigtime planet link neil html-parse.plt 1 0 ~/scheme/html-parse planet link neil html-template.plt 1 0 ~/scheme/html-template planet link neil html-write.plt 1 0 ~/scheme/html-write planet link neil scgi.plt 1 0 ~/scheme/scgi planet link neil shtml.plt 1 0 ~/scheme/shtml planet link neil xexp.plt 1 0 ~/scheme/xexp @echo "" planet show @echo "" Whenever I start modifying a package's source, in anticipation of a new PLaneT version, I add a "planet link" for that, giving the anticipated new PLaneT version number. As I release versions of PLaneT packages, I change the corresponding "planet link" to a "planet unlink". Sometime later, I remove the "planet unlink"s, once they've probably run on all the systems that need them (which, at the moment, is just my laptop). This is a stopgap solution, until I get time to automate it based on information that is already embedded in my source files. -- http://www.neilvandyke.org/ From benjisimon at gmail.com Mon Jun 15 17:28:51 2009 From: benjisimon at gmail.com (Ben Simon) Date: Mon Jun 15 17:29:12 2009 Subject: [plt-scheme] printing page breaks in text% editor? Message-ID: Howdy, Is there a way to insert an explicit page break in a text% editor to insure that a call to the print method will result in a correctly paged document? Thanks, Ben -- Have an idea for software? I can make it happen - http://www.ideas2executables.com My Blog: http://benjisimon.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090615/411205e5/attachment.htm From ebzzry at gmail.com Mon Jun 15 17:33:55 2009 From: ebzzry at gmail.com (Rommel M. Martinez) Date: Mon Jun 15 17:34:18 2009 Subject: [plt-scheme] Movable tabs In-Reply-To: <932b2f1f0906142128y7bfa910elb687cbf487b99b74@mail.gmail.com> References: <391934950906121153v26214111q4632c73df2db71a9@mail.gmail.com> <756daca50906121249i83d3205mf163606623cde7f4@mail.gmail.com> <932b2f1f0906142128y7bfa910elb687cbf487b99b74@mail.gmail.com> Message-ID: <391934950906151433n3b1f69a6i9b3470210ab9867@mail.gmail.com> Great! At least it's good to know we're heading to a more extensible direction. On Mon, Jun 15, 2009 at 12:28 PM, Robby Findler wrote: > I think that this would require changes to the low-level toolbox. We > are in the midst of making it easier to make such changes (Matthew's > started by porting the editor classes to Scheme, as you know, for > v4.2) but it may be a while before we get to the point that we can > make this change. > > Robby > > On Fri, Jun 12, 2009 at 2:49 PM, Grant Rettke wrote: >> On Fri, Jun 12, 2009 at 1:53 PM, Rommel Martinez wrote: >>> Is the idea of movable tabs in DrScheme reasonable? In this context, >>> "movable" would mean something like the DND operations of an >>> application like Firefox to reorganize the tabs. >> >> That is a nice feature. >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > -- Rommel M. Martinez http://www.bespin.org/~ebzzry From eli at barzilay.org Mon Jun 15 18:10:01 2009 From: eli at barzilay.org (Eli Barzilay) Date: Mon Jun 15 18:10:22 2009 Subject: [plt-scheme] Question on build process for Linux and Mac OSX In-Reply-To: References: <18997.24552.160901.720703@winooski.ccs.neu.edu> Message-ID: <18998.50873.405418.563876@winooski.ccs.neu.edu> FWIW, building inside the PLT tree should generally be simpler in terms of what you need your scripts to do. This is how the nightly builds are done (and if you want the details, I've put the build script at http://tmp.barzilay.org/build). On Jun 15, Todd Rovito wrote: > Eli, > Thanks that did the trick I removed the spaces from the source tree > and it built perfect. Now I have both CGC and 3m garbage collectors > with a similar build process for Linux and OS X. I appreciate the fast > reply, you are a genius. > > On Sun, Jun 14, 2009 at 10:39 AM, Eli Barzilay wrote: > > On Jun 14, Todd Rovito wrote: > >> Greetings, > >> ? ?I would like to create a simple build process that creates mzscheme > >> and shared libs for both CGC and 3m garbage collectors. ?For Linux I > >> perform the following steps with the source tree: > >> ? ? ? ? ./configure --prefix=/opt/plt-scheme --enable-shared > >> ? ? ? ? make both > >> ? ? ? ? make install-both > >> > >> This seems to work and I get .so files for everything I need. ?On the > >> Mac OSX side I am struggling, admittedly I am less familar with OSX. > >> ? ? ? ?./configure --enable-xonx > >> --prefix=/Users/rovitotv/prog/plt-scheme/ --enable-shared > >> --disable-mred > >> ? ? ? ?make both <--- this step never finishes I get an error. > >> > >> The output from configure and make are below, thanks for the help. > > > > It looks like you're trying to build in one directory, using sources > > from a different directory called > > > > ?/Users/rovitotv/prog/PLT Scheme v4.2 Source/ > > > > and the problem is the spaces in the name. ?There are probably more > > than a few places in the makefiles that don't deal gracefully with > > such spaces, but fixing them is pointless since autoconf itself breaks > > with spaces too. ?If you build inside the PLT tree (eg, make a > > directory called .../PLT/src/build, then in it run ../configure) then > > things work because paths will be relative so they'll have no spaces. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From cryptograham at gmail.com Mon Jun 15 18:33:30 2009 From: cryptograham at gmail.com (Paul Graham) Date: Mon Jun 15 18:48:50 2009 Subject: [plt-scheme] define own escape sequences? Message-ID: <6c2f61300906151533m79c268d7ybc1b5bc747bb5b33@mail.gmail.com> Can anyone tell me how to define my own escape sequences within strings in mzscheme? I looked in the manual and I can't find it anywhere. (All I want to do is make (unescaped) \@ be left intact in strings instead of triggering an error.) Thanks! --pg From eli at barzilay.org Mon Jun 15 18:57:20 2009 From: eli at barzilay.org (Eli Barzilay) Date: Mon Jun 15 18:57:43 2009 Subject: [plt-scheme] define own escape sequences? In-Reply-To: <6c2f61300906151533m79c268d7ybc1b5bc747bb5b33@mail.gmail.com> References: <6c2f61300906151533m79c268d7ybc1b5bc747bb5b33@mail.gmail.com> Message-ID: <18998.53712.642374.462501@winooski.ccs.neu.edu> On Jun 15, Paul Graham wrote: > Can anyone tell me how to define my own escape sequences within > strings in mzscheme? I looked in the manual and I can't find it > anywhere. (All I want to do is make (unescaped) \@ be left intact > in strings instead of triggering an error.) Thanks! There is no hook for extending the string syntax, so you'll need a new reader macro for strings. If you want all of mzscheme's escapes, then the tedious part in this will be all the numeric escapes (octal and hex). So depending on the problem you're trying to solve, it might be easier to define a new kind of escape, or maybe use something like the scribble syntax (http://docs.plt-scheme.org/scribble/reader.html). -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From sbloch at adelphi.edu Mon Jun 15 19:44:21 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Mon Jun 15 19:45:26 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <17E879BE-9BD8-4B4A-B082-F83B60559E0C@ccs.neu.edu> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <904774730906131604m5a0e93b5v6cfc1339a3053595@mail.gmail.com> <69588938-2BF1-46EB-9402-C5108F434A4F@ccs.neu.edu> <17E879BE-9BD8-4B4A-B082-F83B60559E0C@ccs.neu.edu> Message-ID: <76C1AE84-CE31-433A-A74E-7410F3736D2C@adelphi.edu> On Jun 15, 2009, at 2:00 PM, Matthias Felleisen wrote: > Committed to code base. Documentation will show up after dental > cleaning app't :-) -- Matthias Now that's what I call service :-) Stephen Bloch sbloch@adelphi.edu From sbloch at adelphi.edu Mon Jun 15 20:03:32 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Mon Jun 15 20:04:46 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <1245090570.27888.12.camel@ubuntu> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <1D1394F3-C8B7-4135-9449-72C73DE0B074@adelphi.edu> <20090614033226.GA1269@topoi.pooq.com> <620BD8F6-2AC0-48EE-A58F-A75E2D676C42@adelphi.edu> <20090615150259.GA5110@topoi.pooq.com> <5AA3A5B0-45BB-435E-B1AE-99601DB38C80@adelphi.edu> <1245090570.27888.12.camel@ubuntu> Message-ID: <75330810-E149-48A0-96E0-F30CF4042860@adelphi.edu> On Jun 15, 2009, at 2:29 PM, Bill Wood wrote: > On Mon, 2009-06-15 at 13:10 -0400, Stephen Bloch wrote: > . . . >> I'll have to think about this: "type" as a type still seems so >> elegant, so expressively efficient :-) My naive first impulse is to >> suggest a consistent but incomplete static type-checker that never >> misclassifies something's type, correctly classifies the types of >> MOST expressions in practice, and when it can't, knows when to give >> up so it at least terminates. Has somebody already proven that >> that's unattainable too? > > Just a shot in the dark here: This seems to be similar to the > question > of the existence of decision procedures for classical predicate > calculi. > IIRC Goedel showed that first-order PC had no decision procedure but > Herbrand showed there was a semi-decision procedure -- one that always > halted on theorems but that might spin attempting to find a > counter-example to a non-theorem (the non-theorem may have no finite > counter-examples but have an infinite one). As I understand it > second-order PC, however, does not have even a semi-decision > procedure, > for if it did it could be used to build a decision procedure for FOPC. > > If something analogous holds for intuitionistic PC (the logic involved > in the Curry-Howard Correspondence) then might it defeat your > incomplete > type-checker? Let's think of this for a moment as not a general proof system but just a "type-of" function. I'm putting priority on termination and correctness at the expense of specificity: the function will always return in finite time, and will always return a supertype of the correct type, but not necessarily the narrowest type that could possibly be inferred. This is certainly possible, if nothing else by setting an alarm clock and returning type "any" if the alarm goes off before the algorithm manages to prove some more specific type. The question is whether you could get it to give useful answers "most" of the time "in practice" within a reasonable time bound. Back in the proof world, I'm not asking for a complete decision procedure (recursive), nor even a semi-decision procedure (r.e.), but rather a terminating algorithm that, on any given theorem, produces a proof of either this theorem or something weaker (in the sense of being implied by the given theorem). Theoretically, this is trivial: the algorithm always produces a proof of "1=1". In practice, you would want it to prove either the theorem itself or something "not much weaker" "most" of the time. And logic has nothing to tell us about such fuzzy criteria :-) Stephen Bloch sbloch@adelphi.edu From sbloch at adelphi.edu Mon Jun 15 20:11:48 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Mon Jun 15 20:12:58 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <1D1394F3-C8B7-4135-9449-72C73DE0B074@adelphi.edu> <20090614033226.GA1269@topoi.pooq.com> <620BD8F6-2AC0-48EE-A58F-A75E2D676C42@adelphi.edu> <20090615150259.GA5110@topoi.pooq.com> <5AA3A5B0-45BB-435E-B1AE-99601DB38C80@adelphi.edu> Message-ID: <9B25E2EB-A845-41A2-8185-B08C753E38DC@adelphi.edu> On Jun 15, 2009, at 2:40 PM, Arthur Nunes-Harwit wrote: > While Russell & Whitehead's theory to avoid the paradox involved a > hierarchy, the set theories that were widely embraced (eg Zermelo- > Fraenkel and von_Neumann-Bernays-Goedel) had little or no hierarchy. Russell & Whitehead's hierarchical approach failed; Goedel showed a way around any such system if you've got enough arithmetic to encode proofs about numbers as numbers. I don't remember exactly how vNBG or ZF get around this. Stephen Bloch sbloch@adelphi.edu From eli at barzilay.org Mon Jun 15 21:58:09 2009 From: eli at barzilay.org (Eli Barzilay) Date: Mon Jun 15 21:58:30 2009 Subject: [plt-scheme] define own escape sequences? In-Reply-To: <18998.53712.642374.462501@winooski.ccs.neu.edu> References: <6c2f61300906151533m79c268d7ybc1b5bc747bb5b33@mail.gmail.com> <18998.53712.642374.462501@winooski.ccs.neu.edu> Message-ID: <18998.64561.698728.796639@winooski.ccs.neu.edu> On Jun 15, Eli Barzilay wrote: > > There is no hook for extending the string syntax, so you'll need a new > reader macro for strings. If you want all of mzscheme's escapes, then > the tedious part in this will be all the numeric escapes (octal and > hex). So depending on the problem you're trying to solve, it might be > easier to define a new kind of escape, or maybe use something like the > scribble syntax (http://docs.plt-scheme.org/scribble/reader.html). Actually, another way to hack this would be to just hook on the mzscheme reader, after regexp-replacing the contents of the string. Here's an example that constructs such a readtable -- with a string it uses the mzscheme parser after replacing all `\@' with `\\@'. If you're using v4, it would be very easy to go from this code to a reader for a `#lang ' language that has this syntax for strings. ------------------------------------------------------------------------------- #lang scheme (require syntax/readerr) (define (make-my-readtable rt) (define (parse-string bytes) (parameterize ([current-readtable rt]) ; use the original reader (let ([bytes (regexp-replace* #rx#"\\\\." bytes (lambda (m) (if (equal? m #"\\@") #"\\\\@" m)))]) (read (open-input-bytes (bytes-append #"\"" bytes #"\"")))))) (make-readtable rt #\" 'terminating-macro (lambda (char inp src line col pos) (define bytes (cadr (or (regexp-try-match #rx#"^((?:[^\\]+?|\\\\.)*?)\"" inp) (raise-read-eof-error "expected a closing '\"'" src line col pos #f)))) (datum->syntax #f (parse-string bytes) (list src line col pos (+ 2 (bytes-length bytes))))))) (define (my-read . args) (parameterize ([current-readtable (make-my-readtable (current-readtable))]) (apply read args))) ------------------------------------------------------------------------------- -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From cryptograham at gmail.com Tue Jun 16 01:33:34 2009 From: cryptograham at gmail.com (Paul Graham) Date: Tue Jun 16 01:40:53 2009 Subject: [plt-scheme] define own escape sequences? In-Reply-To: <18998.64561.698728.796639@winooski.ccs.neu.edu> References: <6c2f61300906151533m79c268d7ybc1b5bc747bb5b33@mail.gmail.com> <18998.53712.642374.462501@winooski.ccs.neu.edu> <18998.64561.698728.796639@winooski.ccs.neu.edu> Message-ID: <6c2f61300906152233s77d6569cxc53f0b915c62c6@mail.gmail.com> Unfortunately this module doesn't seem to exist in v372. Welcome to MzScheme v372 [3m], Copyright (c) 2004-2007 PLT Scheme Inc. require: unknown module: syntax/readerr Is there a way to do it in v372? Thanks! --pg On Mon, Jun 15, 2009 at 6:58 PM, Eli Barzilay wrote: > On Jun 15, Eli Barzilay wrote: >> >> There is no hook for extending the string syntax, so you'll need a new >> reader macro for strings. ?If you want all of mzscheme's escapes, then >> the tedious part in this will be all the numeric escapes (octal and >> hex). ?So depending on the problem you're trying to solve, it might be >> easier to define a new kind of escape, or maybe use something like the >> scribble syntax (http://docs.plt-scheme.org/scribble/reader.html). > > Actually, another way to hack this would be to just hook on the > mzscheme reader, after regexp-replacing the contents of the string. > Here's an example that constructs such a readtable -- with a string it > uses the mzscheme parser after replacing all `\@' with `\\@'. ?If > you're using v4, it would be very easy to go from this code to a > reader for a `#lang ' language that has this syntax for strings. > > ------------------------------------------------------------------------------- > > #lang scheme > > (require syntax/readerr) > > (define (make-my-readtable rt) > ?(define (parse-string bytes) > ? ?(parameterize ([current-readtable rt]) ; use the original reader > ? ? ?(let ([bytes (regexp-replace* > ? ? ? ? ? ? ? ? ? ?#rx#"\\\\." bytes > ? ? ? ? ? ? ? ? ? ?(lambda (m) (if (equal? m #"\\@") #"\\\\@" m)))]) > ? ? ? ?(read (open-input-bytes (bytes-append #"\"" bytes #"\"")))))) > ?(make-readtable > ? rt #\" 'terminating-macro > ? (lambda (char inp src line col pos) > ? ? (define bytes > ? ? ? (cadr (or (regexp-try-match #rx#"^((?:[^\\]+?|\\\\.)*?)\"" inp) > ? ? ? ? ? ? ? ? (raise-read-eof-error "expected a closing '\"'" > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? src line col pos #f)))) > ? ? (datum->syntax #f (parse-string bytes) > ? ? ? ? ? ? ? ? ? ?(list src line col pos (+ 2 (bytes-length bytes))))))) > > (define (my-read . args) > ?(parameterize ([current-readtable (make-my-readtable (current-readtable))]) > ? ?(apply read args))) > > ------------------------------------------------------------------------------- > > > -- > ? ? ? ? ?((lambda (x) (x x)) (lambda (x) (x x))) ? ? ? ? ?Eli Barzilay: > ? ? ? ? ? ? ? ? ?http://www.barzilay.org/ ? ? ? ? ? ? ? ? Maze is Life! > From lordgeoffrey at optushome.com.au Tue Jun 16 04:01:08 2009 From: lordgeoffrey at optushome.com.au (LordGeoffrey) Date: Tue Jun 16 04:02:18 2009 Subject: [plt-scheme] poll: keyword syntax In-Reply-To: <756daca50906141816h39d43c1fh4781b4b4c0e07abd@mail.gmail.com> References: <20090614152554.ABAB96500CF@mail-svr1.cs.utah.edu> <06CE4A792CB746BB80A6CFB236F35C21@uw2b2dff239c4d> <756daca50906141816h39d43c1fh4781b4b4c0e07abd@mail.gmail.com> Message-ID: <4A375144.4080506@optushome.com.au> What about srfi-88 - was it deemed irrelevant? (asks the novice) Grant Rettke wrote: > On Sun, Jun 14, 2009 at 6:06 PM, Jos Koot wrote: > >> 3: People (me included) may be using identifiers starting and/or ending >> with a colon. >> > > Like SRFI-42. > > >> I think that #: belongs in the range of #', #&, #, , #,@, etc. >> > > I would rather that it conform to the keyword SRFI and have a chance > and portability. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > > From noelwelsh at gmail.com Tue Jun 16 07:37:44 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Tue Jun 16 07:38:04 2009 Subject: [plt-scheme] Reading and understanding large programs In-Reply-To: <73045cca0906151024h7c80ccal165dd0706f0030eb@mail.gmail.com> References: <73045cca0906151024h7c80ccal165dd0706f0030eb@mail.gmail.com> Message-ID: I start with the main entry point, trying to understand the overall structure of the program (top down). Then I switch to bottom up, trying to understand how the individual pieces are made. N. On Mon, Jun 15, 2009 at 6:24 PM, aditya shukla wrote: > Hello Everyone, > > Can someone please share some ideas on how to go about reading and > understanding large programs? > > > Aditya From pocmatos at gmail.com Tue Jun 16 08:00:57 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Jun 16 08:01:50 2009 Subject: [plt-scheme] Requiring absolute path In-Reply-To: <4A36BB73.7000006@neilvandyke.org> References: <11b141710906150846h57ee05e5q89b6dd43faf0b7d4@mail.gmail.com> <11b141710906151359s68b25d2bl6ef3258c6a3ed6de@mail.gmail.com> <4A36B929.9030007@neilvandyke.org> <4A36BB73.7000006@neilvandyke.org> Message-ID: <11b141710906160500i493efcc0r62923e89d25bba58@mail.gmail.com> Wow! Thanks, I was not aware of that planet feature... should check out the manual, thanks! On Mon, Jun 15, 2009 at 10:21 PM, Neil Van Dyke wrote: > Neil Van Dyke wrote at 06/15/2009 05:12 PM: >> >> Paulo J. Matos wrote at 06/15/2009 04:59 PM: >>> >>> maybe i am missing something but what do you mean by a planet development >>> link? >>> >> >> Courtesy of Google: >> http://docs.plt-scheme.org/planet/Developing_Packages_for_PLaneT.html#(part._devlinks) > > For example, my "~/scheme/Makefile" at the moment includes the production: > > planet-links: > ? @echo "" > ? planet unlink neil randtok.plt ? ? ? ? ?1 0 > ? @echo "" > ? planet link neil testeez.plt ? ? ? ? ?1 3 ~/scheme/testeez > ? planet link neil csv.plt ? ? ? ? ? ? ?1 6 ~/scheme/csv > ? planet link neil postnet.plt ? ? ? ? ?1 1 ~/scheme/postnet > ? planet link neil urlskip.plt ? ? ? ? ?1 1 ~/scheme/urlskip > ? planet link neil bigtime.plt ? ? ? ? ?1 0 ~/scheme/bigtime > ? planet link neil html-parse.plt ? ? ? 1 0 ~/scheme/html-parse > ? planet link neil html-template.plt ? ?1 0 ~/scheme/html-template > ? planet link neil html-write.plt ? ? ? 1 0 ~/scheme/html-write > ? planet link neil scgi.plt ? ? ? ? ? ? 1 0 ~/scheme/scgi > ? planet link neil shtml.plt ? ? ? ? ? ?1 0 ~/scheme/shtml > ? planet link neil xexp.plt ? ? ? ? ? ?1 0 ~/scheme/xexp > ? @echo "" > ? planet show > ? @echo "" > > Whenever I start modifying a package's source, in anticipation of a new > PLaneT version, I add a "planet link" for that, giving the anticipated new > PLaneT version number. ?As I release versions of PLaneT packages, I change > the corresponding "planet link" to a "planet unlink". ?Sometime later, I > remove the "planet unlink"s, once they've probably run on all the systems > that need them (which, at the moment, is just my laptop). > > This is a stopgap solution, until I get time to automate it based on > information that is already embedded in my source files. > > -- > http://www.neilvandyke.org/ > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From czhu at cs.utah.edu Tue Jun 16 08:16:25 2009 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Tue Jun 16 08:16:55 2009 Subject: [plt-scheme] poll: keyword syntax In-Reply-To: <4A375144.4080506@optushome.com.au> References: <20090614152554.ABAB96500CF@mail-svr1.cs.utah.edu> <06CE4A792CB746BB80A6CFB236F35C21@uw2b2dff239c4d> <756daca50906141816h39d43c1fh4781b4b4c0e07abd@mail.gmail.com> <4A375144.4080506@optushome.com.au> Message-ID: <4A378D19.1030104@cs.utah.edu> It's implementers' choice. As the name `Request For Implementation' suggests, the SRFI author request it to be implemented. But if implementers don't like a particular feature proposed, then it's their freedom not to support it. Chongkai LordGeoffrey wrote: > What about srfi-88 - was it deemed irrelevant? (asks the novice) > From hendrik at topoi.pooq.com Tue Jun 16 09:10:29 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Tue Jun 16 09:17:51 2009 Subject: [plt-scheme] Reading and understanding large programs In-Reply-To: <4331ad810906151042kba0251cne0558fef8730bc57@mail.gmail.com> References: <73045cca0906151024h7c80ccal165dd0706f0030eb@mail.gmail.com> <4331ad810906151042kba0251cne0558fef8730bc57@mail.gmail.com> Message-ID: <20090616131029.GB8922@topoi.pooq.com> On Mon, Jun 15, 2009 at 02:42:29PM -0300, Luciano Ramalho wrote: > On Mon, Jun 15, 2009 at 2:24 PM, aditya > shukla wrote: > > Can someone please share some ideas on how to go about reading and > > understanding large programs? > > Are you comfortable reading and understanding small programs? > > If so, then determine how you to split the large program in small > parts. A well designed large program is always modular, you just need > to figure out how it is structured. Then test and exercise the parts > separately. A modern well designed large program should also have a > suite of tests that can help you understand how individual components > work. If the program does not have tests, writing tests is the best > way to start understanding it. I always start by looking for the documentation. If there isn't any, I start to wonder whether the whole enterprise is worth it. A program has to be really important before it's worthwhile understanding it without documentation. And it there is some, I look into whether it matches the code. If it doesn't, that's always a clue as to what issues the users and implementers were facing. -- hendrik From pltscheme at pnkfx.org Tue Jun 16 11:32:27 2009 From: pltscheme at pnkfx.org (Felix Klock's PLT scheme proxy) Date: Tue Jun 16 11:38:19 2009 Subject: [plt-scheme] define own escape sequences? In-Reply-To: <6c2f61300906152233s77d6569cxc53f0b915c62c6@mail.gmail.com> References: <6c2f61300906151533m79c268d7ybc1b5bc747bb5b33@mail.gmail.com> <18998.53712.642374.462501@winooski.ccs.neu.edu> <18998.64561.698728.796639@winooski.ccs.neu.edu> <6c2f61300906152233s77d6569cxc53f0b915c62c6@mail.gmail.com> Message-ID: Paul (cc'ing Eli and plt-scheme list)- On Jun 16, 2009, at 1:33 AM, Paul Graham wrote: > Unfortunately this module doesn't seem to exist in v372. > > Welcome to MzScheme v372 [3m], Copyright (c) 2004-2007 PLT Scheme > Inc. > require: unknown module: syntax/readerr > > Is there a way to do it in v372? You need to use the old require format for the older PLT version. (require (lib "readerr.ss" "syntax")) However, my attempt to test Eli's code out led to a new problem: regexp-try-match does not seem to be part of v372. Still, the hint above may get you far enough to port Eli's code. (I did not attempt to do so.) -Felix Klock From eli at barzilay.org Tue Jun 16 11:40:37 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Jun 16 11:41:18 2009 Subject: [plt-scheme] define own escape sequences? In-Reply-To: References: <6c2f61300906151533m79c268d7ybc1b5bc747bb5b33@mail.gmail.com> <18998.53712.642374.462501@winooski.ccs.neu.edu> <18998.64561.698728.796639@winooski.ccs.neu.edu> <6c2f61300906152233s77d6569cxc53f0b915c62c6@mail.gmail.com> Message-ID: <18999.48373.97351.443256@winooski.ccs.neu.edu> On Jun 16, Felix Klock's PLT scheme proxy wrote: > You need to use the old require format for the older PLT version. > > (require (lib "readerr.ss" "syntax")) There is much that would be different in 372. > However, my attempt to test Eli's code out led to a new problem: > regexp-try-match does not seem to be part of v372. That was (and still is for compatibility) provided from mzlib/string (or (lib "string.ss" "mzlib") in the old version), and it was called `regexp-match/fail-without-reading'. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From sbloch at adelphi.edu Tue Jun 16 14:22:08 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Tue Jun 16 14:23:12 2009 Subject: [plt-scheme] mathematical logic (was the perfect teaching language) In-Reply-To: <9B25E2EB-A845-41A2-8185-B08C753E38DC@adelphi.edu> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <1D1394F3-C8B7-4135-9449-72C73DE0B074@adelphi.edu> <20090614033226.GA1269@topoi.pooq.com> <620BD8F6-2AC0-48EE-A58F-A75E2D676C42@adelphi.edu> <20090615150259.GA5110@topoi.pooq.com> <5AA3A5B0-45BB-435E-B1AE-99601DB38C80@adelphi.edu> <9B25E2EB-A845-41A2-8185-B08C753E38DC@adelphi.edu> Message-ID: On Jun 15, 2009, at 8:11 PM, I wrote: > > On Jun 15, 2009, at 2:40 PM, Arthur Nunes-Harwit wrote: >> While Russell & Whitehead's theory to avoid the paradox involved a >> hierarchy, the set theories that were widely embraced (eg Zermelo- >> Fraenkel and von_Neumann-Bernays-Goedel) had little or no hierarchy. > > Russell & Whitehead's hierarchical approach failed; Goedel showed a > way around any such system if you've got enough arithmetic to > encode proofs about numbers as numbers. I don't remember exactly > how vNBG or ZF get around this. Arthur was kind enough to straighten me out on this. I was foolishly conflating two different issues: Russell's paradox and Goedel incompleteness. They sort-of intersect in the Principia Mathematica, which introduced a hierarchy of sets in order to avoid Russell's paradox, and which also hoped to build a complete and consistent proof system. Russell's paradox demonstrates that if you have a "set of all sets", and you also have a reasonable comprehension axiom, these lead to an actual semantic contradiction. There is no model that simultaneously satisfies both of these, because it would make a particular statement both true and false in that model. Russell & Whitehead introduced a hierarchy of sets that successfully avoided this problem. Goedel's first incompleteness theorem has a different feeling: if you have enough power to encode and decode sequences that you can interpret as proofs in a formal system, you can have perfectly good models (among which, we'd like to think, is ordinary arithmetic), but there's a statement which is both true (in all models) and UNPROVABLE in this system. Russell & Whitehead were well aware of the "liar's paradox", in which a statement says "this statement is false." Any language in which such a statement is even expressible has problems. The related but different statement "this statement cannot be proven in such-and-such formal system" is less toxic: it doesn't make things unsatisfiable, but only demonstrates that formal system to be incomplete. I don't think Russell & Whitehead even worried about the latter, since (they thought) a statement can't talk about its own provability. This last assumption is where Goedel proved them wrong. BTW, there's a fascinating "graphic novel" (i.e. "comic book for grown-ups") entitled _Logicomix_, just released or about to be released, about mathematical logic in the early 20th century. Bertrand Russell is the main protagonist; Cantor, Frege, Wittgenstein, Goedel, Whitehead, Hilbert, etc. are other major supporting characters. Stephen Bloch sbloch@adelphi.edu From hendrik at topoi.pooq.com Tue Jun 16 19:21:04 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Tue Jun 16 19:28:28 2009 Subject: [plt-scheme] The perfect teaching language--Is this too much to ask for? In-Reply-To: <904774730906131533j4e827f76m876fb60ee309568c@mail.gmail.com> References: <904774730906131445q6adbf6efwc52936016eff8cb0@mail.gmail.com> <63bb19ae0906131503t4dd1ba0qafa2ac8e8ba5f051@mail.gmail.com> <904774730906131533j4e827f76m876fb60ee309568c@mail.gmail.com> Message-ID: <20090616232104.GA10059@topoi.pooq.com> On Sat, Jun 13, 2009 at 06:33:41PM -0400, Todd O'Bryan wrote: > On Sat, Jun 13, 2009 at 6:03 PM, Sam TH wrote: > > On Sat, Jun 13, 2009 at 5:45 PM, Todd O'Bryan wrote: > > > > But if you really want to compute with the types, like this: > > > > (if (equal? (type-of 3) (type-of -3)) 'yes 'no) > > > > then that's more difficult to support, > > This is the kind of stuff I would like to do, yes. I guess I'm asking > for run-time type annotations, as Shriram correctly inferred from my > none-too-clear text, with a sufficiently developed semantics to handle > subtypes, unification, etc. > > > and if you want to do something > > like this: > > > > (: x (if stuff? Number String)) > > (define x ...) > > > > then static checking is suddenly much harder. > > This is clearly insane--I have never even considered such an idea. :-) I have. The problem is, in generality, infeasible, but it is possible to make useful approximations to it based on various heuristics. You can go further if you allow the programmer to provide sufficient proof hints, you can actually do this in much generality, but it becomes impractical to program. > > And it goes to show how naive about this stuff I am. If you limit > yourself to types, unions, parametric types, etc. in type declarations > and don't allow general Scheme code, I gather that the system doesn't > explode. Except for the paametric types, that looks like the type system in Algol 68 (dated 1968). Within a year or two it was generalized to allow parametric types, provided that values of these parametric types were always pointed to by references (something true of prett well everythig in Scheme.) > I'm more than willing to do that--thank you for pointing out > how taking my previous statement at face value would have caused a > mess to happen. > > > So, I would say, try to come up with specific use cases for > > computation with types, and then your question will be easier to > > answer. > > Thanks. I'm trying to work through HtDP the way I wish it worked. I'll > send examples as I come up with them. Maybe Shriram can intuit what I > really want and you can explain how to get at it. > > Todd > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From fare at tunes.org Wed Jun 17 00:29:50 2009 From: fare at tunes.org (Francois-Rene Rideau) Date: Wed Jun 17 00:30:13 2009 Subject: [plt-scheme] Boston Lisp Meeting Monday 2009-06-29: Eli Barzilay on Implementing Domain Specific Languages with PLT Scheme Message-ID: <20090617042950.865274247@bespin.org> Boston Lisp Meeting: Monday 2009-06-29 Eli Barzilay on Implementing Domain Specific Languages with PLT Scheme. http://fare.livejournal.com/144600.html A Boston Lisp Meeting will take place on Monday, June 29th 2009 at 1800 at MIT 34-401B, where Eli Barzilay will speak about Implementing Domain Specific Languages with PLT Scheme. Additionally, we are still accepting proposals for up to two volunteers to each give of a 5-minute Lightning Talk (followed by 2-minute Q&A). Also, there will be a buffet offered by ITA Software. Registration is not necessary but appreciated. See details below. * Eli Barzilay will speak about Implementing Domain Specific Languages with PLT Scheme. Many problems call for domain-specific languages (DSLs) to express them and their solutions; such languages enable a dialogue between domain experts and software developers. The Lisp and Scheme community has a decades-old tradition of creating and embedding special-purpose languages via macros. Over the last twenty years, we PLT Schemers have continued to develop this technology to the point where making up new languages is so quick and easy that PROGRAMMERS CREATE A LANGUAGE FOR WRITING A SINGLE PROGRAM. Embedded DSLs are appropriate for a whole range of domains and applications -- in both academia and industry. Notable examples include research languages, teaching languages, and application-specific languages like our text-friendly documentation language. In this talk Eli will demonstrate how to implement embedded *practical* DSLs in PLT Scheme. Eli Barzilay is a Researcher in the PLT group at Northeastern University. He has been a core PLT Scheme developer since 2003, and has used PLT's ability to implement new languages to an extreme. For his Programming Languages undergraduate course, he creates nearly one language per week. In addition to writing new languages, he is involved in helping PLT develop into a multi-lingual environment. His website is at http://barzilay.org/ * * Having observed the success of the formula at ILC'2009, we have instituted Lightning Talks at the Boston Lisp Meeting. At every meeting, before the main talk, there are two slots for strictly timed 5-minute talks followed by 2-minute for questions and answers. The slots for next Monday are still open. Step up and come talk about your pet project! * * * The Lisp Meeting will take place on Monday June 29th 2009 at 1800 (6pm) at MIT, Room 34-401B. As the numbers indicate, the room is in Building 34, on the 4th floor. This is the usual location, on 50 Vassar Street, Cambridge. MIT map: http://whereis.mit.edu/bin/map?selection=34 Google map: http://maps.google.com/maps?q=50+Vassar+St,+Cambridge,+MA+02139,+USA Many thanks go to Alexey Radul for arranging for the room, and to MIT for welcoming us. * * * * Dinner: ITA Software, a fine employer of Lisp hackers (disclaimer: I work there), is kindly purchasing a buffet to accompany our monthly Boston Lisp meeting. Anyone who attends is welcome to partake. We appreciate it if you let us know you're coming, and what food taboos you have, so that we can order the correct amount of food. Tell us by sending email to boston-lisp-meeting-register at common-lisp.net. We won't send any acknowledgement unless requested; importantly, we'll keep your identity and address confidential and won't communicate any such information to anyone, not even to our sponsors. * * * * * The previous Boston Lisp Meeting on May 26th had 40 participants. Norman Ramsey gave a talk about Using Higher-Order Functions and Continuation-Passing Style to Make Dataflow Optimization Simple. In the near future, we expect to have Bruce Lewis on 2009-07-27 about BRL http://brl.codesimply.net and ourdoings.com, Emmanuel Schanzer on 2009-08-31 about BootstrapWorld.org, and Christine Flood on some undetermined date about Fortress http://projectfortress.sun.com * * * * * * We're always looking for more speakers. The call for speakers and all the other details are at http://fare.livejournal.com/120393.html Also sought are volunteers to give Lightning Talks http://fare.livejournal.com/143723.html For more information, see our web site boston-lisp.org. For posts related to the Boston Lisp meetings in general, follow this link: http://fare.livejournal.com/tag/boston-lisp-meeting or subscribe to our RSS feed: http://fare.livejournal.com/data/rss?tag=boston-lisp-meeting Please forward this information to people you think would be interested. Please accept my apologies for your receiving this message multiple times. My apologies if this announce gets posted to a list where it shouldn't, or fails to get posted to a list where it should. Feedback welcome by private email reply to fare at tunes.org. From DekuDekuplex at Yahoo.com Wed Jun 17 02:36:10 2009 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Wed Jun 17 02:36:46 2009 Subject: [plt-scheme] Re: mathematical logic (was the perfect teaching language) References: <1D1394F3-C8B7-4135-9449-72C73DE0B074@adelphi.edu> <20090614033226.GA1269@topoi.pooq.com> <620BD8F6-2AC0-48EE-A58F-A75E2D676C42@adelphi.edu> <20090615150259.GA5110@topoi.pooq.com> <5AA3A5B0-45BB-435E-B1AE-99601DB38C80@adelphi.edu> <9B25E2EB-A845-41A2-8185-B08C753E38DC@adelphi.edu> <9B25E2EB-A845-41A2-8185-B08C753E38DC-0gPNHT79tk6Vc3sceRu5cw@public.gmane.org> Message-ID: <5h3h35p8u8qabhvmblqapv8gmf9mudnt9r@4ax.com> On Tue, 16 Jun 2009 14:22:08 -0400, Stephen Bloch wrote: >[...] > >BTW, there's a fascinating "graphic novel" (i.e. "comic book for >grown-ups") entitled _Logicomix_, just released or about to be >released, about mathematical logic in the early 20th century. >Bertrand Russell is the main protagonist; Cantor, Frege, >Wittgenstein, Goedel, Whitehead, Hilbert, etc. are other major >supporting characters. LOGICOMIX can be found at the following site: LOGICOMIX - Homepage http://www.logicomix.com/en/ Incidentally, I just found an article (see "Bertrand Russell's mathematical quest adds up to unlikely graphic novel hit" at http://www.guardian.co.uk/books/2009/apr/27/graphic-novel-logicomix-bertrand-russell) describing the story in LOGICOMIX, as follows: >Russell, who died aged 97 in 1970, is starring in a graphic novel based > on his life, Logicomix, which portrays the great pacifist's quest to pin >down the foundations of mathematics. First published in Greece last >year, where it has become an unexpected bestseller, Logicomix, >subtitled An Epic Search for Truth, is the brainchild of maths expert >and novelist Apostolos Doxiadis, who was admitted to Columbia >University at the tender age of 15. >Covering a span of 60 years, it tells the story of Russell's life, taking in >his childhood, brought up by his grandparents after he was orphaned >aged four, his four marriages, the writing of his great work Principia >Mathematica, his rivalry with Ludwig Wittgenstein, and his quest for >nuclear disarmament in the last decades of his life. >Peopled with his contemporaries -- Alfred North Whitehead, with >whom he co-authored Principia, Kurt Go"del, David Hilbert, Ludwig >Wittgenstein -- it charts the quest for knowledge that Russell >described in his autobiography: "I have wished to understand the >hearts of man. I have wished to know why the stars shine. And I >have tried to apprehend the Pythagorean power by which number >holds sway above the flux. A little of this, but not much, I have >achieved." -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ From czhu at cs.utah.edu Wed Jun 17 03:01:49 2009 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Wed Jun 17 03:02:22 2009 Subject: [plt-scheme] Boston Lisp Meeting Monday 2009-06-29: Eli Barzilay on Implementing Domain Specific Languages with PLT Scheme In-Reply-To: <20090617042950.865274247@bespin.org> References: <20090617042950.865274247@bespin.org> Message-ID: <4A3894DD.5080602@cs.utah.edu> Could I ask which DSL(s) Eli is going to talk about / use as example? Thanks, Chongkai Francois-Rene Rideau wrote: > Boston Lisp Meeting: > Monday 2009-06-29 > Eli Barzilay on Implementing Domain Specific Languages with PLT Scheme. > > http://fare.livejournal.com/144600.html > > From mflatt at cs.utah.edu Wed Jun 17 07:20:15 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Wed Jun 17 07:20:42 2009 Subject: [plt-scheme] poll: keyword syntax In-Reply-To: <20090614152554.ABAB96500CF@mail-svr1.cs.utah.edu> References: <20090614152554.ABAB96500CF@mail-svr1.cs.utah.edu> Message-ID: <20090617112019.114E86500BC@mail-svr1.cs.utah.edu> Of the 46 responses so far, there's a fairly even split among preferred syntax. Given the current choice of "#:" in PLT Scheme, about 40% think we should keep the same syntax, 40% don't care whether it stays the same or changes, and 20% think the syntax should change. (I think a lot more than 46 people read this list, so the main conclusion I draw is that most people are happy to go along with anything in PLT Scheme. Maybe they either don't feel informed on the issue, or maybe they really don't care.) Here are the results in more detail: http://www.cs.utah.edu/~mflatt/tmp/keyword-syntax-opinions.pdf The big numbers in the top row show the total number of people who said that the corresponding syntax was their first preference. There were no votes without a first preference. The numbers in the left column show total opinions about changing the syntax. The remaining big numbers correlate a favorite syntax and an opinion about changing; for example, 6 people prefer a ":" prefix but think we should keep the current syntax anyway. Reassuringly, 0 people who prefer "#:" think we should change to something else. The small numbers show second and third preferences. The two medium-sized numbers represent the two other alternatives in the order of their corresponding columns. The smaller number represents a third preference for the remaining choice. When two medium-sized numbers don't add up to the associated big number, that means that some votes didn't have a second preference. Similarly, when a small number doesn't match it's associated medium-sized number, that indicates a lack of some third preferences. For example, the first entry in the ":" prefix column is 15 11 17 1 1 which means that 17 people most prefer a ":" prefix; of those, 15 think that "#:" prefix is second best, 1 thinks that a suffix ":" is second best, and 1 has no second-favorite (or third-favorite) syntax. Among the 15 who think a ":" prefix is best while a "#:" prefix is second-best, 11 think that a suffix ":" is third-best, while the remaining 4 have no third preference. From ebellani at gmail.com Wed Jun 17 16:48:43 2009 From: ebellani at gmail.com (ebellani@gmail.com) Date: Wed Jun 17 16:57:03 2009 Subject: [plt-scheme] Alan Kay on OOP Message-ID: Kind of off-topic and old, but worthwhile reading http://userpage.fu-berlin.de/~ram/pub/pub_jf47ht81Ht/doc_kay_oop_en -- Eduardo Bellani www.cnxs.com.br Someone once called me "just a dreamer" That offended me, the "just" part. Being a dreamer is hard work. It really gets hard when you start believing in your dreams. --Doug Engelbart -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: OpenPGP digital signature Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090617/e4e85fae/signature.pgp From pocmatos at gmail.com Wed Jun 17 18:30:29 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Wed Jun 17 18:30:50 2009 Subject: [plt-scheme] Profiling Contracts Message-ID: <1245277829.15588.2.camel@drserver> Hi all, Is there a way to profile the time taken checking contracts? I have used contracts heavily in some parts of my model checker, many times checking things that are more than simple type checks... and would like to know if there is an easy way to know, 'hey for this exection, 5% of the time was spent checking contracts'. If there is nothing implemented to do this, are there any guidelines on how to find an approximation of this value? Cheers, Paulo Matos From danking at ccs.neu.edu Wed Jun 17 20:14:29 2009 From: danking at ccs.neu.edu (Daniel King) Date: Wed Jun 17 20:20:55 2009 Subject: [plt-scheme] Discrepancies in the documentation for PLT's Intermediate Student Language w/ Lambda Message-ID: I've noticed a couple of discrepancies between the documentation for Intermediate Student Language w/ Lambda and the actual results from the REPL. In particular the following are listed as primitive operations, but DrScheme's REPL claims they are undefined identifiers: string->int replicate string-ith I also think string-ith's contract is wrong. There might be other that I haven't stumbled upon yet. Also, the grammar for the language lists (quoteid) as a type of expr, I believe this should be (quote id) with a space. -- Dan King College of Computer and Information Science Northeastern University danking@ccs.neu.edu From robby at eecs.northwestern.edu Wed Jun 17 21:13:59 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Wed Jun 17 21:14:41 2009 Subject: [plt-scheme] Profiling Contracts In-Reply-To: <1245277829.15588.2.camel@drserver> References: <1245277829.15588.2.camel@drserver> Message-ID: <932b2f1f0906171813pf90f54fvfa66e6052638e49a@mail.gmail.com> I would just run the profiler to find out what I find out. But you can always just disable the contracts (define provide/contract to be just provide, after stripping out the contracts) and then see that way. Robby On Wed, Jun 17, 2009 at 5:30 PM, Paulo J. Matos wrote: > Hi all, > > Is there a way to profile the time taken checking contracts? > I have used contracts heavily in some parts of my model checker, many > times checking things that are more than simple type checks... and would > like to know if there is an easy way to know, 'hey for this exection, 5% > of the time was spent checking contracts'. If there is nothing > implemented to do this, are there any guidelines on how to find an > approximation of this value? > > Cheers, > > Paulo Matos > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From thecodewitch at gmail.com Wed Jun 17 21:57:41 2009 From: thecodewitch at gmail.com (Greg Santucci) Date: Wed Jun 17 22:05:57 2009 Subject: [plt-scheme] Defining and adding member functions at the REPL Message-ID: <66c9435a0906171857l4f505batd72deb10567e2d8e@mail.gmail.com> Hi all, Functions can be added and redefined freely at runtime at the REPL. However, I can't figure out how to change member function definitions at the REPL. Is there a way to do this? For example, when running gears.ss, I wish to add and modify member functions of gears-canvas at runtime. Greg -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090618/c0b3f6c3/attachment.htm From hsmyers at gmail.com Wed Jun 17 22:39:05 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Wed Jun 17 22:45:55 2009 Subject: [plt-scheme] multiple values question Message-ID: <408995400906171939v6eaeb634sf51ebd9bd39679c3@mail.gmail.com> Hi all, Given a function that returns a list: (define (f) (list 1 2 3)) How do I marry it up to (define!-values (a b c) ? If I do the obvious: > (define-values (a b c) (f)) I get: define-values: context (defining "a", ...) expected 3 values, received 1 value: (1 2 3) If I do something moderately bizarre like: (define-values (a b c) (eval (flatten (list 'values (f))))) it works in the REPL, but not as part of a function in the editor. --hsm p.s. CL has a 'Multiple-value-setq which provides pretty much what I need, but that is CL, not scheme... From eli at barzilay.org Wed Jun 17 22:48:18 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Jun 17 22:48:40 2009 Subject: [plt-scheme] multiple values question In-Reply-To: <408995400906171939v6eaeb634sf51ebd9bd39679c3@mail.gmail.com> References: <408995400906171939v6eaeb634sf51ebd9bd39679c3@mail.gmail.com> Message-ID: <19001.43762.290995.409685@winooski.ccs.neu.edu> On Jun 17, Hugh Myers wrote: > Hi all, > > Given a function that returns a list: > > (define (f) (list 1 2 3)) > > How do I marry it up to (define!-values (a b c) ? (define-values (a b c) (apply values (f))) or just make `f' return three values. > p.s. CL has a 'Multiple-value-setq which provides pretty much what I > need, but that is CL, not scheme... http://docs.plt-scheme.org/guide/set_.html#(part._.Multiple_.Values__set_-values) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From mflatt at cs.utah.edu Thu Jun 18 03:47:35 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Jun 18 03:47:59 2009 Subject: [plt-scheme] Discrepancies in the documentation for PLT's Intermediate Student Language w/ Lambda In-Reply-To: References: Message-ID: <20090618074738.945D765012D@mail-svr1.cs.utah.edu> At Wed, 17 Jun 2009 20:14:29 -0400, Daniel King wrote: > In particular the following are listed as primitive operations, but > DrScheme's REPL claims they are undefined identifiers: > string->int > replicate > string-ith Which version are you using? I think that these functions were added in v4.2. They're available for me. (Also, the implementation and the docs are derived from the same source, so it's difficult for them to be out of sync.) > I also think string-ith's contract is wrong. Right! There should should be a second argument that's a `nat'. > Also, the grammar for the language lists (quoteid) as a type of expr, > I believe this should be (quote id) with a space. Actually, it shouldn't be there at all, since the 'quoted line covers that case, so I've removed it for the next doc build. Thanks for the reports, Matthew From pocmatos at gmail.com Thu Jun 18 06:50:57 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Jun 18 06:51:41 2009 Subject: [plt-scheme] Profiling Contracts In-Reply-To: <932b2f1f0906171813pf90f54fvfa66e6052638e49a@mail.gmail.com> References: <1245277829.15588.2.camel@drserver> <932b2f1f0906171813pf90f54fvfa66e6052638e49a@mail.gmail.com> Message-ID: <11b141710906180350j4b9ea6f8x1c4275e84dc02575@mail.gmail.com> On Thu, Jun 18, 2009 at 2:13 AM, Robby Findler wrote: > I would just run the profiler to find out what I find out. > > But you can always just disable the contracts (define provide/contract > to be just provide, after stripping out the contracts) and then see > that way. > That's still some rewriting... It would be nice if it were possible to send a flag to provide/contract, such that if it is #t, contracts would not be applied at all and provide/contract would behave as provide. > Robby > > On Wed, Jun 17, 2009 at 5:30 PM, Paulo J. Matos wrote: >> Hi all, >> >> Is there a way to profile the time taken checking contracts? >> I have used contracts heavily in some parts of my model checker, many >> times checking things that are more than simple type checks... and would >> like to know if there is an easy way to know, 'hey for this exection, 5% >> of the time was spent checking contracts'. If there is nothing >> implemented to do this, are there any guidelines on how to find an >> approximation of this value? >> >> Cheers, >> >> Paulo Matos >> >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From dherman at ccs.neu.edu Thu Jun 18 12:41:31 2009 From: dherman at ccs.neu.edu (Dave Herman) Date: Thu Jun 18 12:42:01 2009 Subject: [plt-scheme] Profiling Contracts In-Reply-To: <11b141710906180350j4b9ea6f8x1c4275e84dc02575@mail.gmail.com> References: <1245277829.15588.2.camel@drserver> <932b2f1f0906171813pf90f54fvfa66e6052638e49a@mail.gmail.com> <11b141710906180350j4b9ea6f8x1c4275e84dc02575@mail.gmail.com> Message-ID: <4A3A6E3B.1050902@ccs.neu.edu> You can write your own wrapper: #lang scheme/base (require scheme/contract) (provide provide/contract*) (define-syntax provide/contract* (syntax-rules () [(_ #:disable [name contract] ...) (provide name ...)] [(_ . rest) (provide/contract . rest)])) Dave Paulo J. Matos wrote: > On Thu, Jun 18, 2009 at 2:13 AM, Robby > Findler wrote: >> I would just run the profiler to find out what I find out. >> >> But you can always just disable the contracts (define provide/contract >> to be just provide, after stripping out the contracts) and then see >> that way. >> > > That's still some rewriting... > It would be nice if it were possible to send a flag to > provide/contract, such that if it is #t, contracts would not be > applied at all and provide/contract would behave as provide. > >> Robby >> >> On Wed, Jun 17, 2009 at 5:30 PM, Paulo J. Matos wrote: >>> Hi all, >>> >>> Is there a way to profile the time taken checking contracts? >>> I have used contracts heavily in some parts of my model checker, many >>> times checking things that are more than simple type checks... and would >>> like to know if there is an easy way to know, 'hey for this exection, 5% >>> of the time was spent checking contracts'. If there is nothing >>> implemented to do this, are there any guidelines on how to find an >>> approximation of this value? >>> >>> Cheers, >>> >>> Paulo Matos >>> >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> > > > From pocmatos at gmail.com Thu Jun 18 13:21:19 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Jun 18 13:22:01 2009 Subject: [plt-scheme] Profiling Contracts In-Reply-To: <4A3A6E3B.1050902@ccs.neu.edu> References: <1245277829.15588.2.camel@drserver> <932b2f1f0906171813pf90f54fvfa66e6052638e49a@mail.gmail.com> <11b141710906180350j4b9ea6f8x1c4275e84dc02575@mail.gmail.com> <4A3A6E3B.1050902@ccs.neu.edu> Message-ID: <11b141710906181021o2b12f02bq1a386dd5df2d843a@mail.gmail.com> On Thu, Jun 18, 2009 at 5:41 PM, Dave Herman wrote: > You can write your own wrapper: > > #lang scheme/base > > (require scheme/contract) > (provide provide/contract*) > > (define-syntax provide/contract* > ?(syntax-rules () > ? ?[(_ #:disable [name contract] ...) > ? ? (provide name ...)] > ? ?[(_ . rest) > ? ? (provide/contract . rest)])) > Hummm, Thanks. I indeed thought about something along these lines but I would prefer something from 'certified' robby since there are cases where provide/contract doesn't receive a [name contract] but instead [struct name ...] for example which would render this not very useful except for the most basic of contracts. I would like to be sure that if I use something like this that it is general for all kinds of provide/contract constructs and does exactly what it is supposed to do when the contracts and enabled or disabled. I might try to generalize if I get to that point. Either way, thank you very much for the starting point! > Dave > > Paulo J. Matos wrote: >> >> On Thu, Jun 18, 2009 at 2:13 AM, Robby >> Findler wrote: >>> >>> I would just run the profiler to find out what I find out. >>> >>> But you can always just disable the contracts (define provide/contract >>> to be just provide, after stripping out the contracts) and then see >>> that way. >>> >> >> That's still some rewriting... >> ?It would be nice if it were possible to send a flag to >> provide/contract, such that if it is #t, contracts would not be >> applied at all and provide/contract would behave as provide. >> >>> Robby >>> >>> On Wed, Jun 17, 2009 at 5:30 PM, Paulo J. Matos >>> wrote: >>>> >>>> Hi all, >>>> >>>> Is there a way to profile the time taken checking contracts? >>>> I have used contracts heavily in some parts of my model checker, many >>>> times checking things that are more than simple type checks... and would >>>> like to know if there is an easy way to know, 'hey for this exection, 5% >>>> of the time was spent checking contracts'. If there is nothing >>>> implemented to do this, are there any guidelines on how to find an >>>> approximation of this value? >>>> >>>> Cheers, >>>> >>>> Paulo Matos >>>> >>>> _________________________________________________ >>>> ?For list-related administrative tasks: >>>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>>> >> >> >> > > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From robby at eecs.northwestern.edu Thu Jun 18 13:29:18 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Jun 18 13:29:40 2009 Subject: [plt-scheme] Profiling Contracts In-Reply-To: <11b141710906181021o2b12f02bq1a386dd5df2d843a@mail.gmail.com> References: <1245277829.15588.2.camel@drserver> <932b2f1f0906171813pf90f54fvfa66e6052638e49a@mail.gmail.com> <11b141710906180350j4b9ea6f8x1c4275e84dc02575@mail.gmail.com> <4A3A6E3B.1050902@ccs.neu.edu> <11b141710906181021o2b12f02bq1a386dd5df2d843a@mail.gmail.com> Message-ID: <932b2f1f0906181029o55999a9aof56a32758546cbdb@mail.gmail.com> You can turn (struct name ...) in to (struct-out name) these days, and be mostly right. I can say this much for sure: if there is no 'provide/contract' in your program (and no define/contract, with-contract, or just contract) then there is no contract checking.... Robby On Thu, Jun 18, 2009 at 12:21 PM, Paulo J. Matos wrote: > On Thu, Jun 18, 2009 at 5:41 PM, Dave Herman wrote: >> You can write your own wrapper: >> >> #lang scheme/base >> >> (require scheme/contract) >> (provide provide/contract*) >> >> (define-syntax provide/contract* >> ?(syntax-rules () >> ? ?[(_ #:disable [name contract] ...) >> ? ? (provide name ...)] >> ? ?[(_ . rest) >> ? ? (provide/contract . rest)])) >> > > Hummm, Thanks. I indeed thought about something along these lines but > I would prefer something from 'certified' robby since there are cases > where provide/contract doesn't receive a [name contract] but instead > [struct name ...] for example which would render this not very useful > except for the most basic of contracts. I would like to be sure that > if I use something like this that it is general for all kinds of > provide/contract constructs and does exactly what it is supposed to do > when the contracts and enabled or disabled. I might try to generalize > if I get to that point. Either way, thank you very much for the > starting point! > >> Dave >> >> Paulo J. Matos wrote: >>> >>> On Thu, Jun 18, 2009 at 2:13 AM, Robby >>> Findler wrote: >>>> >>>> I would just run the profiler to find out what I find out. >>>> >>>> But you can always just disable the contracts (define provide/contract >>>> to be just provide, after stripping out the contracts) and then see >>>> that way. >>>> >>> >>> That's still some rewriting... >>> ?It would be nice if it were possible to send a flag to >>> provide/contract, such that if it is #t, contracts would not be >>> applied at all and provide/contract would behave as provide. >>> >>>> Robby >>>> >>>> On Wed, Jun 17, 2009 at 5:30 PM, Paulo J. Matos >>>> wrote: >>>>> >>>>> Hi all, >>>>> >>>>> Is there a way to profile the time taken checking contracts? >>>>> I have used contracts heavily in some parts of my model checker, many >>>>> times checking things that are more than simple type checks... and would >>>>> like to know if there is an easy way to know, 'hey for this exection, 5% >>>>> of the time was spent checking contracts'. If there is nothing >>>>> implemented to do this, are there any guidelines on how to find an >>>>> approximation of this value? >>>>> >>>>> Cheers, >>>>> >>>>> Paulo Matos >>>>> >>>>> _________________________________________________ >>>>> ?For list-related administrative tasks: >>>>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>>>> >>> >>> >>> >> >> > > > > -- > Paulo Jorge Matos - pocmatos at gmail.com > http://www.pmatos.net > From pocmatos at gmail.com Thu Jun 18 13:35:22 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Jun 18 13:36:04 2009 Subject: [plt-scheme] Profiling Contracts In-Reply-To: <932b2f1f0906181029o55999a9aof56a32758546cbdb@mail.gmail.com> References: <1245277829.15588.2.camel@drserver> <932b2f1f0906171813pf90f54fvfa66e6052638e49a@mail.gmail.com> <11b141710906180350j4b9ea6f8x1c4275e84dc02575@mail.gmail.com> <4A3A6E3B.1050902@ccs.neu.edu> <11b141710906181021o2b12f02bq1a386dd5df2d843a@mail.gmail.com> <932b2f1f0906181029o55999a9aof56a32758546cbdb@mail.gmail.com> Message-ID: <11b141710906181035t159de085w29116087639affb4@mail.gmail.com> On Thu, Jun 18, 2009 at 6:29 PM, Robby Findler wrote: > You can turn (struct name ...) in to (struct-out name) these days, and > be mostly right. > > I can say this much for sure: if there is no 'provide/contract' in > your program (and no define/contract, with-contract, or just contract) > then there is no contract checking.... > OK, thanks! > Robby > > On Thu, Jun 18, 2009 at 12:21 PM, Paulo J. Matos wrote: >> On Thu, Jun 18, 2009 at 5:41 PM, Dave Herman wrote: >>> You can write your own wrapper: >>> >>> #lang scheme/base >>> >>> (require scheme/contract) >>> (provide provide/contract*) >>> >>> (define-syntax provide/contract* >>> ?(syntax-rules () >>> ? ?[(_ #:disable [name contract] ...) >>> ? ? (provide name ...)] >>> ? ?[(_ . rest) >>> ? ? (provide/contract . rest)])) >>> >> >> Hummm, Thanks. I indeed thought about something along these lines but >> I would prefer something from 'certified' robby since there are cases >> where provide/contract doesn't receive a [name contract] but instead >> [struct name ...] for example which would render this not very useful >> except for the most basic of contracts. I would like to be sure that >> if I use something like this that it is general for all kinds of >> provide/contract constructs and does exactly what it is supposed to do >> when the contracts and enabled or disabled. I might try to generalize >> if I get to that point. Either way, thank you very much for the >> starting point! >> >>> Dave >>> >>> Paulo J. Matos wrote: >>>> >>>> On Thu, Jun 18, 2009 at 2:13 AM, Robby >>>> Findler wrote: >>>>> >>>>> I would just run the profiler to find out what I find out. >>>>> >>>>> But you can always just disable the contracts (define provide/contract >>>>> to be just provide, after stripping out the contracts) and then see >>>>> that way. >>>>> >>>> >>>> That's still some rewriting... >>>> ?It would be nice if it were possible to send a flag to >>>> provide/contract, such that if it is #t, contracts would not be >>>> applied at all and provide/contract would behave as provide. >>>> >>>>> Robby >>>>> >>>>> On Wed, Jun 17, 2009 at 5:30 PM, Paulo J. Matos >>>>> wrote: >>>>>> >>>>>> Hi all, >>>>>> >>>>>> Is there a way to profile the time taken checking contracts? >>>>>> I have used contracts heavily in some parts of my model checker, many >>>>>> times checking things that are more than simple type checks... and would >>>>>> like to know if there is an easy way to know, 'hey for this exection, 5% >>>>>> of the time was spent checking contracts'. If there is nothing >>>>>> implemented to do this, are there any guidelines on how to find an >>>>>> approximation of this value? >>>>>> >>>>>> Cheers, >>>>>> >>>>>> Paulo Matos >>>>>> >>>>>> _________________________________________________ >>>>>> ?For list-related administrative tasks: >>>>>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>>>>> >>>> >>>> >>>> >>> >>> >> >> >> >> -- >> Paulo Jorge Matos - pocmatos at gmail.com >> http://www.pmatos.net >> > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From pocmatos at gmail.com Thu Jun 18 13:43:31 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Jun 18 13:44:13 2009 Subject: [plt-scheme] Error Checking Message-ID: <11b141710906181043t32943756x7dbfd09c4720e94b@mail.gmail.com> Hi all, I have been postponing proper error handling in my program. In general, I have been just doing (error ...) and that's it. However, I would like to be a bit more organized and actually catch errors and provide proper information to the users regarding the nature of the error. For that, I have been looking at exceptions. I thought about generating several exception structures as follows: exn:fail:user: with parent exn:fail:user exn:fail: with parent exn:fail would be a type of error regarding some part of my program, so user errors in the parser would be thrown as: exn:fail:user:parser and internal errors as exn:fail:parser which would carry information, for example of in which filename the parsing error occurred and at which position. However, to simplify my life I would like to easily have a raise function for each of these like raise-user-error I could have raise-user-error/parser or raise-error/parser respectively. I have tried to look at the definition of raise-user-error in the plt source code but couldn't find anything. Can someone point me to it or correct my design if I could do something simpler? Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From robert.winslow at gmail.com Thu Jun 18 13:59:44 2009 From: robert.winslow at gmail.com (Robert) Date: Thu Jun 18 14:00:09 2009 Subject: [plt-scheme] Re: Nanojit - an alternative to LLVM In-Reply-To: References: Message-ID: Parrot has been getting a lot of attention lately. What is your take on using that for PLT? On Jun 13, 3:08?am, Noel Welsh wrote: > A little while ago someone asked about using LLVM as an alternative > compiler backend to Lightning. Another alternative, with perhaps a > better set of tradeoffs (much smaller but lower performance than LLVM) > is Nanojit, used in the pre-release versions of Firefox: > > ?https://developer.mozilla.org/En/Nanojit > > It currently support x86 and ARM. I believe Sparc support is at least > on the wishlist. > > [Another alternative is libjit, but their website is makes ridiculous > claims, which doesn't inspire confidence in the project.] > > [Implementing a trace based compiler should lead to publishable > research, so it might be more appealing to those likely to actual do > the work.] > > N. > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From pocmatos at gmail.com Thu Jun 18 14:08:03 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Jun 18 14:08:44 2009 Subject: [plt-scheme] Parsing not ignoring \n Message-ID: <11b141710906181108x5faf235fse60651051f6700ce@mail.gmail.com> Hi, I have a question regarding on how to user parser tools to handle the following. My language has C style comments which means I have something like: (define-lex-abbrevs (line-comment (:: "//" (complement (:: any-string "\n" any-string)) "\n")) (c-style-comment (:: "/*" (complement (:: any-string "*/" any-string)) "*/"))) In the lexer: (define eb-lexer (lexer-src-pos ;; Ignore Comments ((:or whitespace c-style-comment line-comment) (return-without-pos (eb-lexer input-port))) ... ...) In the parser I then don't worry about newline... it's as if everything could be in the same line. Now, I want to change the language a bit, so that new lines _ending statements_ become important. However, the issue is that by stripping the line-comment, I am stripping the last new line. Is there a way to remove the line comment in the lexer but still maintaining the new line? So, if I have : TOKEN1 // comment \n TOKEN2 I could get TOKEN1 \n TOKEN2 ? Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From jpc-ml at zenburn.net Thu Jun 18 16:05:56 2009 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Thu Jun 18 16:14:23 2009 Subject: [plt-scheme] Re: Nanojit - an alternative to LLVM In-Reply-To: References: Message-ID: <4A3A9E24.7090209@zenburn.net> On 6/18/09 7:59 PM, Robert wrote: > Parrot has been getting a lot of attention lately. What is your take > on using that for PLT? AFAIK it's getting a lot of attention for at least several years now and it still does not offer anything usable. -- regards, Jakub Piotr C?apa From jpc-ml at zenburn.net Thu Jun 18 16:09:37 2009 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Thu Jun 18 16:16:23 2009 Subject: [plt-scheme] Nanojit - an alternative to LLVM In-Reply-To: References: Message-ID: <4A3A9F01.4060105@zenburn.net> On 6/13/09 9:08 AM, Noel Welsh wrote: > A little while ago someone asked about using LLVM as an alternative > compiler backend to Lightning. Another alternative, with perhaps a > better set of tradeoffs (much smaller but lower performance than LLVM) > is Nanojit, used in the pre-release versions of Firefox: > > https://developer.mozilla.org/En/Nanojit > > It currently support x86 and ARM. I believe Sparc support is at least > on the wishlist. > > [Another alternative is libjit, but their website is makes ridiculous > claims, which doesn't inspire confidence in the project.] I guess you are talking about the google code site [1]. The documentation page on dotgnu [2] looks a lot more credible. The pros for libjit are that it is written in pure C, is distributed as a library and the API is quite simple. One should be able to start experimenting with the API using the FFI. The pros for nanojit is that it get a lot more attention and probably is (or will be) much faster. [1]: http://code.google.com/p/libjit-linear-scan-register-allocator/ [2]: http://www.gnu.org/software/dotgnu/libjit-doc/libjit.html -- regards, Jakub Piotr C?apa From jpc-ml at zenburn.net Thu Jun 18 16:49:26 2009 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Thu Jun 18 16:49:46 2009 Subject: [plt-scheme] Error Checking In-Reply-To: <11b141710906181043t32943756x7dbfd09c4720e94b@mail.gmail.com> References: <11b141710906181043t32943756x7dbfd09c4720e94b@mail.gmail.com> Message-ID: <4A3AA856.7060604@zenburn.net> On 6/18/09 7:43 PM, Paulo J. Matos wrote: > I have tried to look at the > definition of raise-user-error in the plt source code but couldn't > find anything. Can someone point me to it or correct my design if I > could do something simpler? The raise functions are actually very simple. This is how I do it: (define-struct (exn:fail:syntax exn:fail) ()) (define (raise-syntax-error msg) (raise (make-exn:fail:syntax msg (current-continuation-marks)))) You would probably like to do something more interesing with msg. PS. Good exception design is something I am not quite sure how to do in Scheme (it is easier in Python). I also wonder whether restartable exceptions (a'la Common Lisp) are a good idea. -- regards, Jakub Piotr C?apa From carl.eastlund at gmail.com Thu Jun 18 16:56:19 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Thu Jun 18 16:56:57 2009 Subject: [plt-scheme] Error Checking In-Reply-To: <4A3AA856.7060604@zenburn.net> References: <11b141710906181043t32943756x7dbfd09c4720e94b@mail.gmail.com> <4A3AA856.7060604@zenburn.net> Message-ID: <990e0c030906181356x2257e738ne7c6fe3e7d478b80@mail.gmail.com> On Thu, Jun 18, 2009 at 4:49 PM, Jakub Piotr C?apa wrote: > On 6/18/09 7:43 PM, Paulo J. Matos wrote: >> >> I have tried to look at the >> definition of raise-user-error in the plt source code but couldn't >> find anything. Can someone point me to it or correct my design if I >> could do something simpler? > > The raise functions are actually very simple. This is how I do it: > > (define-struct (exn:fail:syntax exn:fail) ()) > > (define (raise-syntax-error msg) > ?(raise (make-exn:fail:syntax msg (current-continuation-marks)))) > > You would probably like to do something more interesing with msg. Note that exn:fail:syntax and raise-syntax-error already have definitions in PLT Scheme. But if I were to provide my own definition for a raise-* function, I would allow printf-style messages like this: (define (raise-syntax-error fmt . args) (raise (make-exn:fail:syntax (apply format fmt args) (current-continuation marks)))) --Carl From pocmatos at gmail.com Thu Jun 18 17:21:15 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Jun 18 17:21:56 2009 Subject: [plt-scheme] Error Checking In-Reply-To: <4A3AA856.7060604@zenburn.net> References: <11b141710906181043t32943756x7dbfd09c4720e94b@mail.gmail.com> <4A3AA856.7060604@zenburn.net> Message-ID: <11b141710906181421xd9689cbg2c24c82dcfafab1e@mail.gmail.com> On Thu, Jun 18, 2009 at 9:49 PM, Jakub Piotr C?apa wrote: > On 6/18/09 7:43 PM, Paulo J. Matos wrote: >> >> I have tried to look at the >> definition of raise-user-error in the plt source code but couldn't >> find anything. Can someone point me to it or correct my design if I >> could do something simpler? > > The raise functions are actually very simple. This is how I do it: > > (define-struct (exn:fail:syntax exn:fail) ()) > > (define (raise-syntax-error msg) > ?(raise (make-exn:fail:syntax msg (current-continuation-marks)))) > > You would probably like to do something more interesing with msg. > Thanks! > PS. Good exception design is something I am not quite sure how to do in > Scheme [snip] Neither do I... I would love to see a good treatment of this topic since I believe it is a very important issue in production software. > -- > regards, > Jakub Piotr C?apa > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From sk at cs.brown.edu Thu Jun 18 17:36:39 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Jun 18 17:37:25 2009 Subject: [plt-scheme] Re: Nanojit - an alternative to LLVM In-Reply-To: <4A3A9E24.7090209@zenburn.net> References: <4A3A9E24.7090209@zenburn.net> Message-ID: Ditto, though when I coincidentally said this two days ago to a systems person I respect greatly, he said, "Oh no, it's different now" -- and he's not even a part of the project or some other kind of booster. So maybe something is changing in Parrot-space. Shriram On Thu, Jun 18, 2009 at 4:05 PM, Jakub Piotr C?apa wrote: > On 6/18/09 7:59 PM, Robert wrote: >> >> Parrot has been getting a lot of attention lately. What is your take >> on using that for PLT? > > AFAIK it's getting a lot of attention for at least several years now and it > still does not offer anything usable. > > -- > regards, > Jakub Piotr C?apa > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From sshickey at qwest.net Fri Jun 19 01:09:35 2009 From: sshickey at qwest.net (Scott Hickey) Date: Fri Jun 19 01:43:04 2009 Subject: [plt-scheme] passing pointer from one FFI call as input into another FFI call Message-ID: <7a39c01c-33e2-4795-a52a-1e6b14932db0@r16g2000vbn.googlegroups.com> I have a C function that allocates a linked list of structs and it works great until I try to pass it into another C function. (define-cstruct _st_marker ([timestamp _int] [offset _int] [value _int] [next _st_marker/null])) ;; int get_markers(char *filename, struct st_marker **marker_list) (define get-markers (get-ffi-obj "get_markers" "libvfm" (_fun _string [markers : (_ptr o _st_marker-pointer/ null)] -> [status : _int] -> (values markers status)))) I want to pass the value returned in 'markers' above to the function below: ;; int create_event_list_from_marker_list(struct st_marker *marker_list, struct st_event **event_list) (define create-event-list-from-marker-list (get-ffi-obj "create_event_list_from_marker_list" "libvfm" (_fun [markers : (_ptr i _st_marker-pointer/null)] [events : (_ptr o _st_event-pointer/null)] -> [status : _int] -> (values events status)))) After searching for information on this, I saw on message that said there are problems reusing the data bound using _ptr o as input into another C function. Is there a different syntax I can use to accomplish this? Thanks, Scott Hickey From eli at barzilay.org Fri Jun 19 01:49:55 2009 From: eli at barzilay.org (Eli Barzilay) Date: Fri Jun 19 01:50:17 2009 Subject: [plt-scheme] passing pointer from one FFI call as input into another FFI call In-Reply-To: <7a39c01c-33e2-4795-a52a-1e6b14932db0@r16g2000vbn.googlegroups.com> References: <7a39c01c-33e2-4795-a52a-1e6b14932db0@r16g2000vbn.googlegroups.com> Message-ID: <19003.9987.402183.247469@winooski.ccs.neu.edu> On Jun 18, Scott Hickey wrote: > I have a C function that allocates a linked list of structs and it > works great until I try to pass it into another C function. > > (define-cstruct _st_marker ([timestamp _int] [offset _int] [value > _int] [next _st_marker/null])) > > ;; int get_markers(char *filename, struct st_marker **marker_list) > > (define get-markers > (get-ffi-obj "get_markers" "libvfm" > (_fun _string [markers : (_ptr o _st_marker-pointer/ > null)] > -> [status : _int] -> (values markers status)))) > > I want to pass the value returned in 'markers' above to the function > below: > > ;; int create_event_list_from_marker_list(struct st_marker > *marker_list, struct st_event **event_list) > > (define create-event-list-from-marker-list > (get-ffi-obj "create_event_list_from_marker_list" "libvfm" > (_fun [markers : (_ptr i _st_marker-pointer/null)] > [events : (_ptr o _st_event-pointer/null)] > -> [status : _int] -> (values events status)))) > > > After searching for information on this, I saw on message that said > there are problems reusing the data bound using _ptr o as input into > another C function. Is there a different syntax I can use to > accomplish this? It doesn't look like there should be a problem there -- you're using `_ptr o' which will allocate a pointer value, call the C function, then extract the value from that, so you're using the value that was pointed to (which in your case is also a pointer), not the temporary pointer that was passed out. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From beratn at gmail.com Fri Jun 19 04:58:39 2009 From: beratn at gmail.com (=?ISO-8859-9?Q?emre_berat_nebio=F0lu?=) Date: Fri Jun 19 05:03:59 2009 Subject: [plt-scheme] hey Message-ID: Some plt mail is in my inbox,some plt mail in my spam box.What is the possible reason of that ? Not : I didnt mark any plt mail as spam. Regards Berat -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090619/33ba1f79/attachment.htm From pocmatos at gmail.com Fri Jun 19 05:07:14 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Fri Jun 19 05:07:57 2009 Subject: [plt-scheme] hey In-Reply-To: References: Message-ID: <11b141710906190207m60f7c9bdlf91c89412112afcb@mail.gmail.com> On Fri, Jun 19, 2009 at 9:58 AM, emre berat nebio?lu wrote: > Some plt mail is in my inbox,some plt mail in my spam box.What is the > possible reason of that ? > Problems with your spam detector? > Not : I didnt mark any plt mail as spam. > > Regards > Berat > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From benjisimon at gmail.com Fri Jun 19 08:27:51 2009 From: benjisimon at gmail.com (Ben Simon) Date: Fri Jun 19 08:28:12 2009 Subject: [plt-scheme] Re: Scripting Excel with MysterX In-Reply-To: References: Message-ID: On Fri, Jun 12, 2009 at 3:19 PM, Ben Simon wrote: > I've got a project coming up that looks like it's going to require me to > write some VB code in Excel. That is, unless I can put together a Scheme > solution first :-). > > I've made some progress with MysterX and scripting excel by following the > example here: ... After a bunch of experimentation, I've figured this out. I've posted what I learned here: http://benjisimon.blogspot.com/2009/06/scripting-excel-with-plt-scheme-goodbye.html -Ben -- Have an idea for software? I can make it happen - http://www.ideas2executables.com My Blog: http://benjisimon.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090619/8e053f3f/attachment.html From AlvinSchatte at skytex.net Fri Jun 19 10:35:41 2009 From: AlvinSchatte at skytex.net (aschatte) Date: Fri Jun 19 10:44:40 2009 Subject: [plt-scheme] Interaction with .NET DLLs Message-ID: Hello, I have some hardware that is controlled using a .NET DLL that I was wanting to interface to scheme. There do not appear to be any reference strings or ordinals to get a handle on the internal functions. Is there any way that this can be done using Scheme? From sbloch at adelphi.edu Fri Jun 19 10:47:09 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Fri Jun 19 10:49:04 2009 Subject: [plt-scheme] slow "require planet" Message-ID: <73409367-B93C-4B29-9036-659A41C1013A@adelphi.edu> I just did a clean install of my "tiles" and "sb-world" teachpacks, using "(require (planet ...))". Each file took a second or two to download, and 10-15 MINUTES to "install". What's going on? Stephen Bloch sbloch@adelphi.edu From robby at eecs.northwestern.edu Fri Jun 19 10:56:09 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Fri Jun 19 10:56:29 2009 Subject: [plt-scheme] slow "require planet" In-Reply-To: <73409367-B93C-4B29-9036-659A41C1013A@adelphi.edu> References: <73409367-B93C-4B29-9036-659A41C1013A@adelphi.edu> Message-ID: <932b2f1f0906190756o1a1aeb92se07f58528beaf495@mail.gmail.com> On Fri, Jun 19, 2009 at 9:47 AM, Stephen Bloch wrote: > I just did a clean install of my "tiles" and "sb-world" teachpacks, using > "(require (planet ...))". Each file took a second or two to download, and > 10-15 MINUTES to "install". What's going on? When I do the same thing via the planet commandline tool, ie: % planet install sbloch sb-world.plt 1 4 I see most of the time being spent in rendering & re-rendering of start.scrbl, search.scrbl, and master-index.scrbl. Is that what you see? Robby From grettke at acm.org Fri Jun 19 11:44:50 2009 From: grettke at acm.org (Grant Rettke) Date: Fri Jun 19 11:45:09 2009 Subject: [plt-scheme] hey In-Reply-To: References: Message-ID: <756daca50906190844ue50876al5f576e10e4fca50d@mail.gmail.com> On Fri, Jun 19, 2009 at 3:58 AM, emre berat nebio?lu wrote: > Some plt mail is in my inbox,some plt mail in my spam box.What is the > possible reason of that ? > > Not : I didnt mark any plt mail as spam. Sometimes spam detectors get triggered when you don't expect it. From grettke at acm.org Fri Jun 19 11:42:49 2009 From: grettke at acm.org (Grant Rettke) Date: Fri Jun 19 11:49:34 2009 Subject: [plt-scheme] Interaction with .NET DLLs In-Reply-To: References: Message-ID: <756daca50906190842p7d95d5e7ta005c554f566a0e8@mail.gmail.com> On Fri, Jun 19, 2009 at 9:35 AM, aschatte wrote: > I have some hardware that is controlled using a .NET DLL that I was > wanting to interface to scheme. ?There do not appear to be any > reference strings or ordinals to get a handle on the internal > functions. ?Is there any way that this can be done using Scheme? Perhaps you could expose the DLL through .NET/COM-Interop and consume it with Scheme using MysterX? From m.douglas.williams at gmail.com Fri Jun 19 11:53:57 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Fri Jun 19 11:54:20 2009 Subject: [plt-scheme] Command Line Processing Message-ID: I am writing an application that uses command-line (from scheme/cmdline) to parse command line arguments. Consider the following simple test-app.ss program: #lang scheme (define verbose-mode (make-parameter #f)) (define input-file (make-parameter "input.xml")) (define output-directory (make-parameter "output")) (command-line #:program "test-app" #:once-each [("-v" "--verbose") "Generate with verbose messages" (verbose-mode #t)] [("-i" "--input-file") if "Input file" (input-file if)] [("-o" "--output-directory") od "Output directory" (output-directory od)] #:args () (void)) (printf "Test Command-Line Application~n") (printf " verbose-mode = ~a~n" (verbose-mode)) (printf " input-file = ~s~n" (input-file)) (printf " output-directory = ~s~n" (output-directory)) When I make an executable of this using Scheme>Create Executable ... and select Stand-alone and MzScheme, I can get it to work, but I have some questions. Why do I need "--" before my arguments? [They seem to be parsed by MzScheme if I don't.] For example: >test-app -v Welcome to MzScheme v4.2 [3m], Copyright (c) 2004-2009 PLT Scheme Inc. Test Command-Line Application verbose-mode = #f input-file = "input.xml" output-directory = "output" I get the MzScheme banner and my application doesn't see the "-v". So presumable, MzScheme parsed it. >test-app -- -v Test Command-Line Application verbose-mode = #t input-file = "input.xml" output-directory = "output" Works as expected. Is there any way to get this behavior without the "--"? Should I be using mzc to compile it instead of DrScheme? It seems to work as expected if I select Launcher when using Scheme>Create Executable .... What is the best way to test programs using command-line during development? It seems I'd like to be able to tell if I am NOT being executed from the command line and do some alternate processing in that case - either use the defaults or use current-command-line-arguments to set specific values and let command-line parse those. Any help/thoughts would be welcome. Thanks, Doug -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090619/50589dbc/attachment.html From pocmatos at gmail.com Fri Jun 19 12:39:03 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Fri Jun 19 12:39:45 2009 Subject: [plt-scheme] Command Line Processing In-Reply-To: References: Message-ID: <11b141710906190939m192ee821q499ef98e64053c50@mail.gmail.com> On Fri, Jun 19, 2009 at 4:53 PM, Doug Williams wrote: > I am writing an application that uses command-line (from scheme/cmdline) to > parse command line arguments. Consider the following simple test-app.ss > program: > > #lang scheme > > (define verbose-mode (make-parameter #f)) > > (define input-file (make-parameter "input.xml")) > > (define output-directory (make-parameter "output")) > > (command-line > ?#:program "test-app" > ?#:once-each > ?[("-v" "--verbose") "Generate with verbose messages" > ???????????????????? (verbose-mode #t)] > ?[("-i" "--input-file") if > ??????????????????????? "Input file" > ??????????????????????? (input-file if)] > ?[("-o" "--output-directory") od > ????????????????????????????? "Output directory" > ????????????????????????????? (output-directory od)] > ?#:args () (void)) > > (printf "Test Command-Line Application~n") > (printf "? verbose-mode = ~a~n" (verbose-mode)) > (printf "? input-file = ~s~n" (input-file)) > (printf "? output-directory = ~s~n" (output-directory)) > > When I make an executable of this using Scheme>Create Executable ... and > select Stand-alone and MzScheme, I can get it to work, but I have some > questions. > > Why do I need "--" before my arguments? [They seem to be parsed by MzScheme > if I don't.] > > For example: > >>test-app -v > Welcome to MzScheme v4.2 [3m], Copyright (c) 2004-2009 PLT Scheme Inc. > Test Command-Line Application > ? verbose-mode = #f > ? input-file = "input.xml" > ? output-directory = "output" > > I get the MzScheme banner and my application doesn't see the "-v". So > presumable, MzScheme parsed it. > >>test-app -- -v > Test Command-Line Application > ? verbose-mode = #t > ? input-file = "input.xml" > ? output-directory = "output" > > Works as expected. > > Is there any way to get this behavior without the "--"? Should I be using > mzc to compile it instead of DrScheme? > > It seems to work as expected if I select Launcher when using Scheme>Create > Executable .... > > What is the best way to test programs using command-line during development? > It seems I'd like to be able to tell if I am NOT being executed from the > command line and do some alternate processing in that case - either use the > defaults or use current-command-line-arguments to set specific values and > let command-line parse those. > > Any help/thoughts would be welcome. > It seems to have definitely to do with the fact that you are creating it inside DrScheme, because if you do in a command line (your file is saved as test.scm): pmatos@pocm06r ~ $ ~/Applications/plt/plt-4.2/bin/mzc --exe test test.scm pmatos@pocm06r ~ $ ./test -v Test Command-Line Application verbose-mode = #t input-file = "input.xml" output-directory = "output" Cheers, Paulo Matos > Thanks, > Doug > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From pocmatos at gmail.com Fri Jun 19 12:40:30 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Fri Jun 19 12:41:12 2009 Subject: [plt-scheme] hey In-Reply-To: References: Message-ID: <11b141710906190940k6f78c5a5p81d1d49612438f1c@mail.gmail.com> On Fri, Jun 19, 2009 at 9:58 AM, emre berat nebio?lu wrote: > Some plt mail is in my inbox,some plt mail in my spam box.What is the > possible reason of that ? > > Not : I didnt mark any plt mail as spam. > I guess my first reply was too terse... With GMail, you can simply create a filter for plt-scheme email and say: "Never mark as spam..." and that's it! :) > Regards > Berat > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From pocmatos at gmail.com Fri Jun 19 14:18:38 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Fri Jun 19 14:19:19 2009 Subject: [plt-scheme] Re: Parsing not ignoring \n In-Reply-To: <11b141710906181108x5faf235fse60651051f6700ce@mail.gmail.com> References: <11b141710906181108x5faf235fse60651051f6700ce@mail.gmail.com> Message-ID: <11b141710906191118o72a40f94qffbd1ad7b64cb55b@mail.gmail.com> Still on this, is it not possible to re-insert a char in an input-port? This way, once the lexer recognizes a one-line comment I could re-insert the \n into the port and keep lexing... On Thu, Jun 18, 2009 at 7:08 PM, Paulo J. Matos wrote: > Hi, > > I have a question regarding on how to user parser tools to handle the > following. My language has C style comments which means I have > something like: > (define-lex-abbrevs > ?(line-comment (:: "//" (complement (:: any-string "\n" any-string)) "\n")) > ?(c-style-comment (:: "/*" (complement (:: any-string "*/" any-string)) "*/"))) > > In the lexer: > (define eb-lexer > ?(lexer-src-pos > ? ;; Ignore Comments > ? ((:or whitespace c-style-comment line-comment) (return-without-pos > (eb-lexer input-port))) > ... > ...) > > In the parser I then don't worry about newline... it's as if > everything could be in the same line. > Now, I want to change the language a bit, so that new lines _ending > statements_ become important. > However, the issue is that by stripping the line-comment, I am > stripping the last new line. Is there a way to remove the line comment > in the lexer but still maintaining the new line? > > So, if I have : > TOKEN1 // comment \n TOKEN2 > I could get > TOKEN1 \n TOKEN2 > ? > > Cheers, > -- > Paulo Jorge Matos - pocmatos at gmail.com > http://www.pmatos.net > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From yinso.chen at gmail.com Fri Jun 19 14:40:06 2009 From: yinso.chen at gmail.com (YC) Date: Fri Jun 19 14:40:28 2009 Subject: [plt-scheme] Re: Parsing not ignoring \n In-Reply-To: <11b141710906191118o72a40f94qffbd1ad7b64cb55b@mail.gmail.com> References: <11b141710906181108x5faf235fse60651051f6700ce@mail.gmail.com> <11b141710906191118o72a40f94qffbd1ad7b64cb55b@mail.gmail.com> Message-ID: <779bf2730906191140n4606533fy8603c7dda76f6f32@mail.gmail.com> On Fri, Jun 19, 2009 at 11:18 AM, Paulo J. Matos wrote: > Still on this, is it not possible to re-insert a char in an input-port? > This way, once the lexer recognizes a one-line comment I could > re-insert the \n into the port and keep lexing... > If you are reading from either a file or string port, then you can use file-position to rewind the port to the correct position so the next lex will start from the correct place. http://docs.plt-scheme.org/reference/port-buffers.html#(def._((quote._~23~25kernel)._file-position)) Another approach is to use lexer to only handle the start of the comment, e.g., // and then write your own custom reader to read until it hits newline (but preserving it), and then hand the control back to the lexer. (define (custom-comment-reader in) (read-until-new-line ...)) ;; defined elsewhere (define eb-lexer (lexer ("//" (custom-comment-reader input-port) ...) ...)) Cheers, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090619/d48f49e3/attachment.htm From pocmatos at gmail.com Fri Jun 19 17:44:53 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Fri Jun 19 17:45:17 2009 Subject: [plt-scheme] Re: Parsing not ignoring \n In-Reply-To: <779bf2730906191140n4606533fy8603c7dda76f6f32@mail.gmail.com> References: <11b141710906181108x5faf235fse60651051f6700ce@mail.gmail.com> <11b141710906191118o72a40f94qffbd1ad7b64cb55b@mail.gmail.com> <779bf2730906191140n4606533fy8603c7dda76f6f32@mail.gmail.com> Message-ID: <1245447893.15603.6.camel@drserver> On Fri, 2009-06-19 at 11:40 -0700, YC wrote: > > On Fri, Jun 19, 2009 at 11:18 AM, Paulo J. Matos > wrote: > Still on this, is it not possible to re-insert a char in an > input-port? > This way, once the lexer recognizes a one-line comment I could > re-insert the \n into the port and keep lexing... > > > If you are reading from either a file or string port, then you can use > file-position to rewind the port to the correct position so the next > lex will start from the correct place. > > http://docs.plt-scheme.org/reference/port-buffers.html#(def._((quote._~23~25kernel)._file-position)) > > Another approach is to use lexer to only handle the start of the > comment, e.g., // and then write your own custom reader to read until > it hits newline (but preserving it), and then hand the control back to > the lexer. > > (define (custom-comment-reader in) > (read-until-new-line ...)) ;; defined elsewhere > > (define eb-lexer > (lexer > ("//" (custom-comment-reader input-port) > ...) > ...)) > This is a good idea. But in the meantime I also found another solution. Which is not to ignore one line comments and define ((:or #\newline one-line-comment) 'NEWLINE) then, in the parser I will have to know exactly where newlines can appear... this sounds messy. :) hehe Thanks! > Cheers, > yc > > > From grettke at acm.org Sat Jun 20 00:46:25 2009 From: grettke at acm.org (Grant Rettke) Date: Sat Jun 20 00:46:49 2009 Subject: [plt-scheme] Interaction with .NET DLLs In-Reply-To: References: Message-ID: <756daca50906192146q7ba7d3bcq482177eed5abeadc@mail.gmail.com> On Fri, Jun 19, 2009 at 9:35 AM, aschatte wrote: > I have some hardware that is controlled using a .NET DLL that I was > wanting to interface to scheme. ?There do not appear to be any > reference strings or ordinals to get a handle on the internal > functions. ?Is there any way that this can be done using Scheme? FWIW: I just followed this article, http://www.c-sharpcorner.com/UploadFile/yougerthen/910262008061425AM/9.aspx and was able to call the code via mysterx. Actually, I just followed the example but simplified it, I wrote one class that returns "Hello, world.". MSDN seems to have all of the documentation that one might need; but it is disjointed and confusing. Perhaps it make sense if you are a COM expert. I am not. From chust at web.de Sat Jun 20 07:10:24 2009 From: chust at web.de (Thomas Chust) Date: Sat Jun 20 07:10:47 2009 Subject: [plt-scheme] [ANN] MzXPCOM Message-ID: <1c1a33bc0906200410s7a1535d4vef18aa5e14044ea2@mail.gmail.com> Hello, as an exercise in PLT Scheme embedding and Mozilla XPCOM programming I have hacked together something similar to MzCOM but for the Mozilla platform instead of Windows COM. At the moment the code just implements a simple string to string evaluation interface, error handling and Scheme background thread polling. If I find the time, I plan to expand it in the future to provide full interoperability between Scheme code and XPCOM components. You can find the current code at http://code.launchpad.net/~chust/+junk/MzXPCOM A precompiled test application that should work with XULRunner 1.9 on ix86 Linux can be found at http://www.chust.org/blob/mzxpcom-example.xpi After downloading, use a command like `xulrunner --install-app mzcom-example.xpi /tmp` to set it up in a temporary directory. cu, Thomas -- When C++ is your hammer, every problem looks like your thumb. From robby at eecs.northwestern.edu Sat Jun 20 08:45:47 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sat Jun 20 08:46:08 2009 Subject: [plt-scheme] slow "require planet" In-Reply-To: <73409367-B93C-4B29-9036-659A41C1013A@adelphi.edu> References: <73409367-B93C-4B29-9036-659A41C1013A@adelphi.edu> Message-ID: <932b2f1f0906200545r5b3639a9y287ca6699391dacd@mail.gmail.com> I looked into this a little more and I'm not seeing what you're seeing. There is a known problem that when one planet package requires another one that the documentation are built twice, but that is not happening with your packages. Furthermore, when I install sb-world (on my very slow netbook), it takes 2 minutes for the whole thing. The only thing I can think of is that your plt tree somehow had some of its documentation rebuilt or .zo files recompiled. Robby On Fri, Jun 19, 2009 at 9:47 AM, Stephen Bloch wrote: > I just did a clean install of my "tiles" and "sb-world" teachpacks, using > "(require (planet ...))". ?Each file took a second or two to download, and > 10-15 MINUTES to "install". ?What's going on? > > Stephen Bloch > sbloch@adelphi.edu > > > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From pedro.e.pinto at gmail.com Sat Jun 20 10:13:23 2009 From: pedro.e.pinto at gmail.com (pp) Date: Sat Jun 20 10:25:04 2009 Subject: [plt-scheme] Re: Interaction with .NET DLLs In-Reply-To: References: Message-ID: <98c7cf1e-f7a5-45d4-ac3a-58051edae08b@l32g2000vba.googlegroups.com> Some time ago I wrote a bridge from PLT to .NET [1]. Unfortunatly bit rot has set in, but if you think it might be usefull I can forward the code. The basic approach was to write a Managed C++ (now days C++/Cli) wrapper that exposed the .NET reflection interface to PLT. You might not need something quite as comprehensive in which case you can just wrapp the .NET calls you need with PLT callable C functions. -pp [1] http://repository.readscheme.org/ftp/papers/sw2003/Dot-Scheme.pdf On Jun 19, 10:35?am, aschatte wrote: > Hello, > > I have some hardware that is controlled using a .NET DLL that I was > wanting to interface to scheme. ?There do not appear to be any > reference strings or ordinals to get a handle on the internal > functions. ?Is there any way that this can be done using Scheme? > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From grettke at acm.org Sat Jun 20 13:11:20 2009 From: grettke at acm.org (Grant Rettke) Date: Sat Jun 20 13:11:39 2009 Subject: [plt-scheme] Re: Interaction with .NET DLLs In-Reply-To: <98c7cf1e-f7a5-45d4-ac3a-58051edae08b@l32g2000vba.googlegroups.com> References: <98c7cf1e-f7a5-45d4-ac3a-58051edae08b@l32g2000vba.googlegroups.com> Message-ID: <756daca50906201011k4073b991uea8b7e93b1406d9f@mail.gmail.com> On Sat, Jun 20, 2009 at 9:13 AM, pp wrote: > Some time ago I wrote a bridge from PLT to .NET [1]. Unfortunatly bit > rot has set in, but if you think it might be usefull I can forward the > code. Yes please. If you would like I will post it on my blog in case someone wants to take it up. I would like to do so; but not at the moment :). From martindemello at gmail.com Sat Jun 20 13:35:50 2009 From: martindemello at gmail.com (Martin DeMello) Date: Sat Jun 20 13:36:27 2009 Subject: [plt-scheme] hey In-Reply-To: <756daca50906190844ue50876al5f576e10e4fca50d@mail.gmail.com> References: <756daca50906190844ue50876al5f576e10e4fca50d@mail.gmail.com> Message-ID: 2009/6/19 Grant Rettke : > On Fri, Jun 19, 2009 at 3:58 AM, emre berat nebio?lu wrote: >> Some plt mail is in my inbox,some plt mail in my spam box.What is the >> possible reason of that ? >> >> Not : I didnt mark any plt mail as spam. > > Sometimes spam detectors get triggered when you don't expect it. No one expects the spammish imposition! martin From rcleis at mac.com Sat Jun 20 13:44:10 2009 From: rcleis at mac.com (Richard Cleis) Date: Sat Jun 20 14:44:31 2009 Subject: [plt-scheme] hey In-Reply-To: References: <756daca50906190844ue50876al5f576e10e4fca50d@mail.gmail.com> Message-ID: <95B1ABC2-16DD-4B74-8EFD-65BE9344991C@mac.com> On Jun 20, 2009, at 11:35 AM, Martin DeMello wrote: > 2009/6/19 Grant Rettke : >> On Fri, Jun 19, 2009 at 3:58 AM, emre berat >> nebio?lu wrote: >>> Some plt mail is in my inbox,some plt mail in my spam box.What is >>> the >>> possible reason of that ? >>> >>> Not : I didnt mark any plt mail as spam. >> >> Sometimes spam detectors get triggered when you don't expect it. > > No one expects the spammish imposition! > > martin [rimshot] [cymbal crash] rac > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From andrew.wilcox at gmail.com Sat Jun 20 20:38:14 2009 From: andrew.wilcox at gmail.com (Andrew Wilcox) Date: Sat Jun 20 20:45:54 2009 Subject: [plt-scheme] mzscheme enters infinite loop when unable to write to stdout Message-ID: <151ba7440906201738u425b56b8t5cfa0dd560cc2844@mail.gmail.com> mzscheme enters an infinite loop printing "error writing to stream port" at the REPL if it is unable to write to stdout. (the odd position of the ">" prompt in the output is due to redirecting stdout to a pipe). $ mzscheme | head -n 5 Welcome to MzScheme v4.1.5 [3m], Copyright (c) 2004-2009 PLT Scheme Inc. 1 > 1 2 > 2 3 > 3 4 > 4 5 > 5 error writing to stream port (Broken pipe; errno=32) error writing to stream port (Broken pipe; errno=32) error writing to stream port (Broken pipe; errno=32) error writing to stream port (Broken pipe; errno=32) error writing to stream port (Broken pipe; errno=32) error writing to stream port (Broken pipe; errno=32) From pocmatos at gmail.com Sun Jun 21 07:08:05 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Sun Jun 21 07:08:29 2009 Subject: [plt-scheme] mzscheme enters infinite loop when unable to write to stdout In-Reply-To: <151ba7440906201738u425b56b8t5cfa0dd560cc2844@mail.gmail.com> References: <151ba7440906201738u425b56b8t5cfa0dd560cc2844@mail.gmail.com> Message-ID: <1245582485.15605.0.camel@drserver> On Sat, 2009-06-20 at 20:38 -0400, Andrew Wilcox wrote: > mzscheme enters an infinite loop printing "error writing to stream > port" at the REPL if it is unable to write to stdout. (the odd > position of the ">" prompt in the output is due to redirecting stdout > to a pipe). > I confirm this issue also in latest 4.2. > $ mzscheme | head -n 5 > Welcome to MzScheme v4.1.5 [3m], Copyright (c) 2004-2009 PLT Scheme Inc. > 1 > > 1 > 2 > > 2 > 3 > > 3 > 4 > > 4 > 5 > > 5 > error writing to stream port (Broken pipe; errno=32) > > error writing to stream port (Broken pipe; errno=32) > > error writing to stream port (Broken pipe; errno=32) > > error writing to stream port (Broken pipe; errno=32) > > error writing to stream port (Broken pipe; errno=32) > > error writing to stream port (Broken pipe; errno=32) > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From pocmatos at gmail.com Sun Jun 21 08:55:14 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Sun Jun 21 08:55:56 2009 Subject: [plt-scheme] Using LaTeX in Scribble Message-ID: <11b141710906210555l192111cdg5d3320bd0bc00090@mail.gmail.com> Hi all, I have started to write the docs for my model checker in LaTeX, however, after looking at Scribble I might give it a try. The issue is that some parts of the docs contain examples of the formal language I use and to display it in LaTeX I have a special mode for the listings package. Is it possible for me to use this listings package inside scribble or to \include a latex document in the middle of a scribble document? The reason for using scribble is that there's a lot of Scheme code in there and since hopefully I might release it in Planet soon scribble seems the way to go. Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From cs at cs.bilgi.edu.tr Sun Jun 21 13:24:12 2009 From: cs at cs.bilgi.edu.tr (Chris Stephenson) Date: Sun Jun 21 13:24:38 2009 Subject: [plt-scheme] Teaching in Istanbul Message-ID: <4A3E6CBC.4030500@cs.bilgi.edu.tr> Is there anyone out there (with a PhD) who would like to come and teach in Istanbul Bilgi University where we use HtDP and other books from the PLT ecole. There is the challenge of teaching students from a wide spectrum of ability and motivation. Our best students are a pleasure to teach. You can make a real contribution here. We have outreach projects as well. The University offers incentives for research and publication. and a reasonable deal. The department is informal and collective in its approach. We like to teach in teams. All teaching in our university is in English (except, naturally enough, for the Turkish langauge courses) Istanbul is a fantastic, vibrant place to live. If you would like to give it a try, send me your CV and your ideas. You can check us out on cs.bilgi.edu.tr courses.cs.bilgi.edu.tr (online course material) kleene.cs.bilgi.edu.tr (our outreach high school project) -- Chris Stephenson ?stanbul Bilgi ?niversitesi Bilgisayar Bilimleri B?l?m Ba?kan? From adityashukla1983 at gmail.com Sun Jun 21 20:27:51 2009 From: adityashukla1983 at gmail.com (aditya shukla) Date: Sun Jun 21 20:28:12 2009 Subject: [plt-scheme] HTDP Exercise 17.1.2 Message-ID: <73045cca0906211727i6c9830b0ib72cfe3096f2b73e@mail.gmail.com> I am trying to solve this particular exercise from htdp(17.1.2) .I have two questions here :- 1) In the data definition of los and lon do I have to consider the empty list scenario? 2) The design recipe before the example explains that one list can be considered atomic but in this case requires to extract each element from the two lists make a list of tha