Welcome to the CHICKEN Scheme pasting service

udev example added by mario-goulart on Wed Jul 9 19:20:52 2014

(use udev)

(define (dispatcher dev)
  (let* ((node (udev-device-node dev))
         (type (udev-device-type dev))
         (action (udev-device-action dev))
         (subsystem (udev-device-subsystem dev))
         (mountable? (and (equal? type "partition")
                          (equal? subsystem "block"))))
    (when mountable?
      (cond ((equal? action "add")
             (print "Mounting " node))
            ((equal? action "remove")
             (print "Unmounting " node))))))

(thread-join! (udev-monitor-start dispatcher))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
What's the operator to construct procedures?
Visually impaired? Let me spell it for you (wav file) download WAV