Welcome to the CHICKEN Scheme pasting service

and-let* values added by andyjpb on Mon Jun 2 22:35:56 2014

(define (import-from-dropbox dropbox-id path-str)
  (or
    (and-let* ((the-dropbox (if (account 'has-available? dropbox-id (current-user))
			      (dropbox 'read dropbox-id) #f))
	       ; download based on root, path and revision. if that failes, try root and path. if that fails, give up
	       (the-metadata (parameterize ((dropbox:table-scope `((node-id . ,(dropbox 'get 'node-id the-dropbox))
								   (seqno . ,(dropbox 'get 'seqno the-dropbox)))))
					   (dropbox:ls path-str #t)))
	       (_ (= 1 (length the-metadata)))
	       (_ #f)
	       (the-metadata (car the-metadata))
	       (_ (null? (alist-ref 'is_dir the-metadata)))
	       (the-import-job (import-job 'make "dropbox-api"))
	       (_ (import-job 'set 'source-path-requested    (alist-ref 'path  the-metadata) the-import-job))
	       (_ (import-job 'set 'source-version-requested (alist-ref 'rev   the-metadata) the-import-job))
	       (_ (import-job 'set 'bytes-expected (alist-ref 'bytes the-metadata) the-import-job))
	       (_ (import-job 'from dropbox-id the-import-job))
	       (import-job-id (import-job 'create the-import-job))
	       (downloader (dropbox 'downloader the-metadata the-dropbox latest-rev: #t)))
      (import-job 'q import-job-id downloader) ; Queue up / run the import job.
      (values the-import-job (alist-ref 'mime_type the-metadata)))
    (values #f #f)))


-----

Warning: in toplevel procedure `knapp.app#import-from-dropbox':
  branches in conditional expression differ in the number of results:

(if downloader890
  (let ((t891 ...)) (values the-import-job884 (alist-ref ... the-metadata882)))
  #f)

Warning: in toplevel procedure `knapp.app#import-from-dropbox':
  branches in conditional expression differ in the number of results:

(if tmp859861 tmp859861 (values #f #f))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
What does `(string-chomp "foobar")' produce?
Visually impaired? Let me spell it for you (wav file) download WAV