[Top][All Lists]

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

[Chicken-users] Re: photo album in chicken

From: Reed Sheridan
Subject: [Chicken-users] Re: photo album in chicken
Date: Sun, 30 Apr 2006 11:44:41 -0500

From: "Ashish Shrestha" <address@hidden >
Subject: [Chicken-users] photo album in chicken
To: address@hidden
        < address@hidden>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed


Chicken scripts to generate a HTML gallery. Something I wrote to learn
scheme so is less scheme than most would like to see. Yes I know I
have a lot to learn so would love to get feedback on the code.

The album uses Lightbox JS and sample albums are at Specially the new albums.

The source is available at

Would love to hear about the code. What is the correct way to handle
errors and an issue with memory. I run out of memory and the script
hangs when I am working with large (5 mega pix or higher) images.
Process a few images before it runs out of memory. How do I run the
script so it has more memory? How do I ensure that I release the
unused memory or more correctly, I don't hang on to stuffs that I have
already processed.


It looks pretty good.  But how are you indenting your code?  What editor are you using?  The indentation is both unconvential and inconsistent.  If you're counting parentheses and/or indenting by hand, you should get a real editor, like Emacs.

Also, here is a more schemely and more compact normalise-path function:

(define (rps-normalise-path path)
  (let loop ((reverse-parts (reverse (string-split path "/")))
         (skip 0)
         (acc '()))
    (match reverse-parts
      (() (string-join acc "/"))
      (("." . more) (loop more skip acc))
      ((".." . more) (loop more (add1 skip) acc))
      ((path-part . more)
         (if (zero? skip)
             (loop more 0 (cons path-part acc))
             (loop more (sub1 skip) acc))))))

This version handles paths with "../../", but drops the leading "/" from absolute paths (so did yours).

Also, you wrote things like (display (format "foo...~A" foo)).  It's slightly cleaner and more convenient to do either (printf "foo...~A" foo) or (print "foo.." foo).

Reed Sheridan

reply via email to

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