Welcome to the CHICKEN Scheme pasting service

autoload replacement used in ugarit added by alaricsp on Tue Sep 24 10:46:46 2013

 (define (get-bindings-from-module egg module bindings)
   (let* ((vektor (gensym))
          (rekuire-extension (gensym))
          (expression
           `(module ,(gensym) ()
                    (import
                     (rename
                      (only scheme vector require-extension quote) ; quote shouldn't need to be here
                      (vector ,vektor) (require-extension ,rekuire-extension)))
                    (,rekuire-extension ,module)
                    (,vektor ,@bindings))))
     (handle-exceptions
      exn (if ((condition-predicate 'syntax) exn)
              (signal (make-composite-condition
                       (make-property-condition 'exn
                                                'message
                                                (sprintf "This feature depends upon the optional module ~a being installed. Please install it with 'chicken-install -s ~a'." module egg))
                       (make-property-condition 'unsupported-feature
                                                'egg egg
                                                'module module
                                                'bindings bindings)))
              (signal exn))
      (eval expression))))

 ;; FIXME: Write a macro to generate these for us.

 (define (autoload-lzma!)
   (let ((real-bindings
          (get-bindings-from-module 'lzma 'lzma '(compress decompress))))
     (set! lzma:compress (vector-ref real-bindings 0))
     (set! lzma:decompress (vector-ref real-bindings 1))))

 (define lzma:compress
   (lambda args
     (autoload-lzma!)
     (apply lzma:compress args)))

 (define lzma:decompress
   (lambda args
     (autoload-lzma!)
     (apply lzma:decompress args)))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
What's the result of `(let ((- +)) (- 4 3 8))'?
Visually impaired? Let me spell it for you (wav file) download WAV