Problem with matching pasted by sz0ka on Tue Nov 20 17:03:38 2012

#!/usr/bin/env chicken                                                                                                                                                                                                                         
(use posix files matchable)                                                                                                                                                                                                                    
                                                                                                                                                                                                                                               
(file-copy "uuids.csv" "/tmp/uuids.csv")                                                                                                                                                                                                       
(file-copy "maskImage.png" "/tmp/maskImage.png")                                                                                                                                                                                               
                                                                                                                                                                                                                                               
(define glob-list (glob "/tmp/*"))                                                                                                                                                                                                             
(define filenames (map pathname-file glob-list))                                                                                                                                                                                               
                                                                                                                                                                                                                                               
(for-each                                                                                                                                                                                                                                      
 (lambda (filename)                                                                                                                                                                                                                            
   (match filename                                                                                                                                                                                                                             
          ['("uuids")                                                                                                                                                                                                                          
           (print "uuids copied successfully")]                                                                                                                                                                                                
          ['("maskImage")                                                                                                                                                                                                                      
           (print "maskImage copied successfully")]))                                                                                                                                                                                          
                                                                                                                                                                                                                                               
 filenames)

Problem with matching II pasted by sz0ka on Tue Nov 20 17:17:38 2012

#!/usr/bin/env chicken                                                                                                                                                                                                                         
(use posix files matchable)                                                                                                                                                                                                                    
                                                                                                                                                                                                                                               
(file-copy "uuids.csv" "/tmp/uuids.csv")                                                                                                                                                                                                       
(file-copy "maskImage.png" "/tmp/maskImage.png")                                                                                                                                                                                               
                                                                                                                                                                                                                                               
(define glob-list (glob "/tmp/*"))                                                                                                                                                                                                             
(define filenames (map pathname-file glob-list))                                                                                                                                                                                               
                                                                                                                                                                                                                                               
(for-each                                                                                                                                                                                                                                      
 (lambda (filename)                                                                                                                                                                                                                            
   (match filename                                                                                                                                                                                                                             
          ( "uuids"                                                                                                                                                                                                                            
            (print "uuids copied successfully"))                                                                                                                                                                                               
          ( "maskImage"                                                                                                                                                                                                                        
            (print "maskImage copied successfully"))))                                                                                                                                                                                         
                                                                                                                                                                                                                                               
 filenames) 

The same as above using match-lambda added by DerGuteMoritz on Tue Nov 20 17:21:58 2012

(for-each
 (match-lambda
  ("uuids"
   (print "uuids copied successfully"))
  ("maskImage"
   (print "maskImage copied successfully")))
 filenames)