lilypond-user
[Top][All Lists]
Advanced

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

Re: nopc -- Proposed Predefines


From: Nicolas Sceaux
Subject: Re: nopc -- Proposed Predefines
Date: Mon, 14 Jul 2008 15:27:06 +0200

Le 14 juil. 08 à 14:19, Bertalan Fodor (LilyPondTool) a écrit :

Well, the fun is that it seems that Scheme creators like predefined commands as well. Think of the commands
cadr, caddr, cadddr, which are essentially:
(car (list-tail mylist 2)) (car (list-tail mylist 3)) (car (list- tail mylist 4)) In SRFI-1, the first extension of the Scheme language even includes the commands:
(first mylist) which equals (car mylist).
(second mylist) which equals (cadr mylist), ie. (car (list-tail mylist 2))
...
(tenth mylist) which would equal (cadddddddddr mylist) if one had had the idea to define such a command, ie. (car (list-tail mylist 10))

Am I insane that I find this complete nonsense?

Well, it does make sense. If you're dealing with a list (ie some
kind of sequence), FIRST and REST (and their friends, SECOND,
THIRD, etc) are to be used. If you're dealing with cons cells,
then CAR and CDR (and c[ad]*r) are to be used (think about it
like navigating in a binary tree). It's all about making clearer
what you intend to do. Behind the scene it is the same basic data
type, but the way you're using it is different, hence the different
names.

nicolas





reply via email to

[Prev in Thread] Current Thread [Next in Thread]