[racket] member et al.

From: Neil Toronto (neil.toronto at gmail.com)
Date: Thu Nov 11 10:58:17 EST 2010

Possibly unrelated, but I also had to write my own `member?' when I 
encoded a Bayesian spam filter in the Bayesian DSL I'm making. I didn't 
want a distribution over all Racket values, I wanted one over {#t,#f}. 
In fact, I'm going to have to wrap all the truth-valued functions 
because of this.

When not doing probability, I use truth-valued functions while 
pretending that they return actual booleans. I usually don't have to see 
the this particular language wart, but TR makes it obvious.

(Don't get me wrong, it's great that TR can actually type this kind of 
stuff! We wouldn't have TR otherwise, and that would be sad.)

I think we should retire this truthiness business, replace cond's `=>' 
with something that lets you easily nest conds (I have a proposal ready 
for this, and it is awesome), and stop using truthiness idioms. It's 
obfuscating, it's hard on newcomers, it makes reasoning about return 
values difficult, and it's very last-century.

Neil T

Shriram Krishnamurthi wrote:
> In fact, I proposed adding the ? forms of these functions where the new 
> ones are strictly boolean.
> 
> These are essential for the SLs since the standard versions are useless 
> due to the true/false tests in the language.
> 
>> On Nov 11, 2010 6:44 AM, "Jay McCarthy" <jay.mccarthy at gmail.com 
>> <mailto:jay.mccarthy at gmail.com>> wrote:
>>
>> I agree with Mark. I often write ? versions of functions like member
>> in my code when I write it the first time to show the "predicate
>> intent".
>>
>> Another important case is when you don't want internal values to
>> "escape" to the client because you forget that member/and/etc return
>> the thing, not #t.
>>
>> Jay
>>
>>
>> On Thu, Nov 11, 2010 at 6:07 AM, Sam Tobin-Hochstadt 
>> <samth at ccs.neu.edu <mailto:samth at ccs.neu.edu>> wrote:
>> > On Thu, Nov 11, 2...
>>
>> --
>> Jay McCarthy <jay at cs.byu.edu <mailto:jay at cs.byu.edu>>
>> Assistant Professor / Brigham Young University
>> http://faculty.cs.byu.edu/~jay
>>
>> "The glory of God is Intelligence" - D&C 93
>>
>> _________________________________________________
>> For list-related administrative tasks:
>> http://...
>>
> 
> ------------------------------------------------------------------------
> 
> _________________________________________________
>   For list-related administrative tasks:
>   http://lists.racket-lang.org/listinfo/users



Posted on the users mailing list.