On Sunday, 5 January 2014 23:33:41 UTC, Brandon Bloom wrote:
>
> Michał: This is awesome. Thanks for the continued awesome work on data 
> structures!
>  
>
>>   ;; if the key is not present in the collection, -1 is returned: 
>>   (avl/rank-of (avl/sorted-set 3 4 5) 0) 
>>   ;= -1 
>>
>
> Curious: Why not return nil instead of -1?
>

Without commenting on the specifics of data.avl: The usual reason to do 
this in index lookup code is that -1 is a valid primitive return value. If 
you wanted to use nil instead, it would mean boxing all other return 
values, which could be quite a big performance issue in various algorithms.

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to