Re: [racket-dev] Simple loop checking in beginner?

2010-11-10 Thread Matthias Felleisen
On Nov 10, 2010, at 10:40 AM, namekuseijin wrote: On Wed, Nov 10, 2010 at 12:13 AM, John Clements cleme...@brinckerhoff.org wrote: ;; NOW I'M A STUDENT: ;; only-long-strings : (listof string) - (listof string) ;; return a list containing the strings longer than 2 chars (define/noloop

Re: [racket-dev] Simple loop checking in beginner?

2010-11-10 Thread Sam Tobin-Hochstadt
On Wed, Nov 10, 2010 at 10:40 AM, namekuseijin namekusei...@gmail.com wrote: On Wed, Nov 10, 2010 at 12:13 AM, John Clements cleme...@brinckerhoff.org wrote: ;; NOW I'M A STUDENT: ;; only-long-strings : (listof string) - (listof string) ;; return a list containing the strings longer than 2

Re: [racket-dev] Simple loop checking in beginner?

2010-11-10 Thread namekuseijin
I see the reasoning now, I apologize. It's a good choice for students, not so sure about ye old daily buggy sofware maintenance. OTOH, perhaps if this practice was widespread it would lead to less bugs or at least more maintenable software. At least for those aware of this idiom. On Wed, Nov

Re: [racket-dev] Simple loop checking in beginner?

2010-11-10 Thread Robby Findler
The value in the large comes when the data structures are more complex (in the function below you'd use a loop or filter, of course). When they are larger, you can pinpoint where to change your function based on a change to your data definition. For example, consider writing an interpreter. Now

Re: [racket-dev] Simple loop checking in beginner?

2010-11-10 Thread Matthias Felleisen
A factor of 2.+. (We could provide a type system, take away recursion, and replace it with a structural induction form. It would be impossible to write infinite loops.) On Nov 10, 2010, at 12:41 PM, John Clements wrote: On Nov 10, 2010, at 6:50 AM, Matthias Felleisen wrote: Your

Re: [racket-dev] Simple loop checking in beginner?

2010-11-10 Thread Nadeem Abdul Hamid
HtDP in Coq? Hadn't thought of of that before... On Wed, Nov 10, 2010 at 1:26 PM, Matthias Felleisen matth...@ccs.neu.edu wrote: A factor of 2.+. (We could provide a type system, take away recursion, and replace it with a structural induction form. It would be impossible to write infinite

[racket-dev] Simple loop checking in beginner?

2010-11-09 Thread John Clements
Here's a simple macro that prevents same-argument recursive calls (including non-tail ones). It's illustrated by a student function that made a teeny mistake which would result in looping forever, but (using this macro) instead signals an error. To the best of my limited knowledge, beginner