Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Scheme > Re: Sort a list...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 17 of 17 Topic 4626 of 4665
Post > Topic >>

Re: Sort a list of dotted pairs

by "Kjetil S. Matheussen" <k.s.matheussen@[EMAIL PROTECTED] > Jul 24, 2008 at 06:09 PM

On Thu, 24 Jul 2008, Pascal J. Bourguignon wrote:

> "Kjetil S. Matheussen" <k.s.matheussen@[EMAIL PROTECTED]
> writes:
> 
> > On Thu, 24 Jul 2008, Pascal J. Bourguignon wrote:
> >
> >> With (sort a-list function-which-compares-cars) you would have to
> >> write 2000 function-which-compares-some-key-some-way before.
> >> 
> >
> > What?
> >
> > Sure, common lisp is more convenient than scheme
> > in most ways, but reimplementing sort just because
> > you wan't to write "< :key car" instead of
> > "(lambda (a b) (< (car a) (car b)))" seems silly.
> >
> 
> Of course, that's why that's not what I did.  cl-sort is a wrapper
> over scheme-sort that builds that lambda automatically.
> 

Oh, okay, sorry, I didn't read closely enough.

Scheme is not scheme though. In Guile, for example, you
could implement cl-sort like this:

(define* (cl-sort alist less? :key (key (lambda (x) x)))
  (sort alist (lambda (a b) (less? (key a) (key b)))))
 




 17 Posts in Topic:
Sort a list of dotted pairs
BastiL2001@[EMAIL PROTECT  2008-07-23 08:20:08 
Re: Sort a list of dotted pairs
Grant Rettke <grettke@  2008-07-23 10:05:04 
Re: Sort a list of dotted pairs
pjb@[EMAIL PROTECTED] (P  2008-07-23 19:35:13 
Re: Sort a list of dotted pairs
Abdulaziz Ghuloum <agh  2008-07-23 11:51:56 
Re: Sort a list of dotted pairs
"Kjetil S. Matheusse  2008-07-24 10:25:16 
Re: Sort a list of dotted pairs
"Kjetil S. Matheusse  2008-07-24 12:59:28 
Re: Sort a list of dotted pairs
pjb@[EMAIL PROTECTED] (P  2008-07-24 14:36:45 
Re: Sort a list of dotted pairs
leppie <xacc.ide@[EMAI  2008-07-24 05:52:43 
Re: Sort a list of dotted pairs
leppie <xacc.ide@[EMAI  2008-07-24 05:55:43 
Re: Sort a list of dotted pairs
Grant Rettke <grettke@  2008-07-24 06:29:16 
Re: Sort a list of dotted pairs
"Kjetil S. Matheusse  2008-07-24 16:24:53 
Re: Sort a list of dotted pairs
pjb@[EMAIL PROTECTED] (P  2008-07-24 16:27:20 
Re: Sort a list of dotted pairs
"Kjetil S. Matheusse  2008-07-24 16:25:24 
Re: Sort a list of dotted pairs
leppie <xacc.ide@[EMAI  2008-07-24 07:46:52 
Re: Sort a list of dotted pairs
leppie <xacc.ide@[EMAI  2008-07-24 07:51:28 
Re: Sort a list of dotted pairs
Grant Rettke <grettke@  2008-07-24 08:43:25 
Re: Sort a list of dotted pairs
"Kjetil S. Matheusse  2008-07-24 18:09:38 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Aug 20 13:05:43 CDT 2008.