[ create a new paste ] login | about

Link: http://codepad.org/ZTwAr2w0    [ raw code | fork ]

jeeve - Scheme, pasted on Aug 27:
; To run this program, install Racket http://racket-lang.org/download 
; Start DrRacket, paste the program into the top area in DrRacket, 
; and click the Run button. 

#lang racket

(require 2htdp/image
         (planet joskoot/planet-fmt:1:9/fmt))

(define (no-photo photo)
  (< (image-width photo) 10))

(define (photos-site-iter cam sol site i)
  (let ([photo (cam sol site i)])
    (if (no-photo photo)
        '()
        (cons photo (photos-site-iter cam sol site (+ i 1))))))

(define (photos-site cam sol site)
  (photos-site-iter cam sol site 0))

(define (photos-iter cam sol i)
  (let ([photos-site (photos-site cam sol i)])
    (if  (< i 0)
         '()
         (if (empty? photos-site)
             (photos-iter cam sol (- i 1))
             (cons photos-site (photos-iter cam sol (- i 1)))))))

(define (photos cam sol)
  (photos-iter cam sol 9))

(define (mastcam-thumbnail left sol site i)
  (bitmap/url (string-append "http://mars.jpl.nasa.gov/msl-raw-images/msss/000"
                             (number->string sol)
                             "/mcam/00"
                             (number->string sol)
                             (if left
                                 "ML005"
                                 "MR005")
                             ((fmt "I##") 1 1 site)
                             ((fmt "I##") 3 3 i)
                             "000I1_DXXX.jpg")))

(define (mastcam-thumbnail-left sol site i)
  (mastcam-thumbnail #t sol site i))

(define (mastcam-thumbnail-right sol site i)
  (mastcam-thumbnail #f sol site i))

(photos mastcam-thumbnail-right 17) ; sol 17


Create a new paste based on this one


Comments: