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 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 loops.) > > > On

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: > >> >> Y

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

2010-11-10 Thread John Clements
On Nov 10, 2010, at 6:50 AM, Matthias Felleisen wrote: > > Your reasoning is correct. What's the performance hit? In order to try it, I used the legendary 12.4.2, and... uh, it seg faulted. Okay, I submitted a bug report on that. Moving right along: Testing in the simplest way, here's what

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 im

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 Sam Tobin-Hochstadt
On Wed, Nov 10, 2010 at 10:40 AM, namekuseijin wrote: > On Wed, Nov 10, 2010 at 12:13 AM, John Clements > 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 (only-long-str

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 > 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 (only-long-strin

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

2010-11-10 Thread namekuseijin
On Wed, Nov 10, 2010 at 12:13 AM, John Clements 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 (only-long-strings l) >  (cond [(empty? l) empty] >        [else (cond [(< 2 (

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

2010-11-10 Thread Matthias Felleisen
Your reasoning is correct. What's the performance hit? On Nov 9, 2010, at 9:13 PM, John Clements wrote: > 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 l

[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 is