[plt-scheme] 12.4.2 word definition; is this OK?

From: Felix Klock's PLT scheme proxy (pltscheme at pnkfx.org)
Date: Tue May 12 14:53:38 EDT 2009


I think Henk's response to Grant is raising a point that Carl's  
response did not address, and therefore the finality ("Period.") of  
your response to Henk is quite misleading.

Grant's original question was: "Is this definition of word OK?"

Now, I cannot tell if Grant is asking about his Data Definition (which  
I would have written as a definition for a class "Word", with a  
capital "W", but that's just me), or if he meant to refer to his  
procedure definition, whose name is actually spelled "word?" with a  
question mark.

But either way, Henk points out that Grant's data definition is not  
great, because the reader cannot tell for sure if the elements of a  
word are constrained to only be the 26 symbols that correspond to the  
lowercase letters of the english alphabet.

Most of the responses to Grant have ignored the parenthetical "('a,  
'b, ..., 'z) in his data definition, but that may have been a very  
significant component.

I would say that Grant should clarify his data definition by either  
explicitly referring to a different class like Letter which consists  
(solely) of the 26 symbols of interest, *or* Grant should remove the  


On May 10, 2009, at 4:25 PM, Matthias Felleisen wrote:

> Carl is right. Period. -- Matthias
> On May 10, 2009, at 10:47 AM, Henk Boom wrote:
>> 2009/5/10 Grant Rettke <grettke at acm.org>:
>>> Is this definition of word OK?
>>> ;; A word is a list of 0 or more symbols ('a, 'b, ..., 'z).
>>> (check-expect empty (list))
>>> ;; word? : word -> boolean
>>> ;; to determine whether the argument is a word
>>> (define (word? arg)
>>> (cond ((empty? arg) true)
>>>       ((symbol? (first arg)) (word? (rest arg)))
>>>       (else false)))
>>> ; word? unit tests
>>> (check-expect true
>>>             (word? (list)))
>>> (check-expect true
>>>             (word? (list 'a)))
>>> (check-expect true
>>>             (word? (list 'a 'b)))
>>> (check-expect true
>>>             (word? (list 'a 'b 'c)))
>>> (check-expect false
>>>             (word? (list 'a 'b (list))))
>>> (check-expect false
>>>             (word? (list (list) 'b 'c)))
>> (check-expect (word? (list 'not 'a 'word)) false)
>>    Henk
>> _________________________________________________
>>  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

Posted on the users mailing list.