On 10/31/13 8:36 PM, "Paul Morris" <p...@paulwmorris.com> wrote:

>On Oct 28, 2013, at 11:51 PM, Carl Sorensen <c_soren...@byu.edu> 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


_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to