lilypond-user
[Top][All Lists]
Advanced

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

Re: New "make-path-stencil" function


From: Carl Sorensen
Subject: Re: New "make-path-stencil" function
Date: Fri, 1 Nov 2013 02:44:25 +0000
User-agent: Microsoft-MacOutlook/14.3.8.130913


On 10/31/13 8:36 PM, "Paul Morris" <address@hidden> wrote:

>On Oct 28, 2013, at 11:51 PM, Carl Sorensen <address@hidden> wrote:
>
>> I haven't tried to rewrite your code, but when I first learned Scheme I
>> was told that anytime you saw lots of set! expressions in the code, you
>> were trying to write procedural code (I.e. c) instead of functional code
>> (Scheme).  Your code seems to have lots of set! expressions; it may be
>> possible to rewrite it in a more functional manner.
>
>Hi Carl,  
>
>Thanks again for this tip.  Attached is a revision that's much more
>functional in coding style, at least as far as I understand the
>distinction after reading up on it a bit. (Not a single "set!" to be
>found.) Style considerations aside, I think this revision is also just
>generally better overall.
>
>-Paul

It looks much more Scheme-y now; and generally this means the logic is
better.

Here's one place that it seems to me you're extra verbose:

;; pointlist is only the absolute x and y values,
     ;; so remove the head of each expression and any closepaths
     (pointlist (map
                 (lambda (x) (cdr x))
                 (delete (list 'closepath) commandlist)))



(map (lambda (x) (cdr x)) (delete (list 'close path) command list))

should be able to be replaced by

(map cdr (delete (list 'close path) command list))

shouldn't it?

Thanks,

Carl




reply via email to

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