LWN.net Logo

maybe not only familiarity

maybe not only familiarity

Posted Dec 10, 2012 17:06 UTC (Mon) by nybble41 (subscriber, #55106)
In reply to: maybe not only familiarity by tpo
Parent article: GNU Guile 2.0.7 released

Deeply nested expressions are a problem in any language, moreso in natural languages which are not traditionally formatted to highlight the subexpressions. If you find yourself writing such expressions in Scheme, you may want to look into refactoring the code, or at least taking advantage of the "nest" macro to flatten the expression. An example:

(do arg1
    (another_do
      (yet_another_do
        (and_more_do arg2
                     (and_still_more_do arg3 arg4)))))

is equivalent to:

(nest [(do arg1)
       (another-do)
       (yet-another-do)
       (and-more-do arg2)
       (and-still-more-do arg3)]
  arg4)


(Log in to post comments)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds