[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issue: REDUCE-ARGUMENT-EXTRACTION (version 1)



    From: Daniels.pa@Xerox.COM
    Subject: Re: Issue: REDUCE-ARGUMENT-EXTRACTION (version 1)

    Masinter writes:
    
        I think that it is true that
    
        (reduce <fn> sequence :key <key-fn>)  = (reduce <fn> (mapcar
        <key-fn> sequence))
    
        except of course in the matter of order of evaluation.
    
    Well, that and the fact that MAPCAR doesn't work on arrays...
    
Make that:
   (reduce <fn> sequence :key <key-fn>) = 
        (reduce <fn> (map 'list <key-fn> sequence))

Feel free to replace the "'list" with your favorite sequence type.
I'll change REDUCE-ARGUMENT-EXTRACTION to use this construct as the
present case.  You're absolutely right that my previous code was badly
broken and attempts to fix it up produce a real mess.  This almost
makes it interesting because the result is as cons-efficient as the
proposed new feature, while the mapping approach builds a whole new,
unecessary structure.