Simon Cozens <[EMAIL PROTECTED]> writes:
>On Mon, Mar 26, 2001 at 10:50:09AM -0500, Uri Guttman wrote:
>> SC> it? That is, @s = sort { f($a) <=> f($b) } @t
>>
>> because that would require the PSI::ESP module which isn't working
>> yet. how would perl intuit exactly the relationship between the records
>> and the keys extraction and comparison? the ST defines that by the first
>> map and the comparison callback. just providing the comparison would
>> entail perl parsing an arbitrarily complex piece of code and then
>> autognerating the map that would produce an anon array that fits it. not
>> a simple task.
>
>No, it wouldn't, don't be silly. The ST can always be generalized to
>
> ST(data, func, compare) =
> map { $_->[0] } sort { compare($a->[1], $b->[1]) } map { [$_, f($_)] } data
>
>In fact, you can implement it in LISP just like that:
>
>(defun Schwartzian (list func compare)
> (mapcar
> (lambda (x) (car x))
> (sort
> (mapcar
> (lambda (x) (cons x (funcall func x)))
> list
> )
> (lambda (x y) (funcall compare (cdr x) (cdr y)))
> )
> )
> )
So can you write that in perl5 rather than LISP?
If not what does perl6 need so we can write it in perl6.
sub Schwartzian
{
...
}
>
>Do you see any ESP there? Do you see any parsing of arbitrary pieces of
>code? No, me neither.
--
Nick Ing-Simmons <[EMAIL PROTECTED]>
Via, but not speaking for: Texas Instruments Ltd.