Welcome to the CHICKEN Scheme pasting service

No output for (planet 1) added by LewisCowper on Wed Jan 14 16:47:12 2015

(require-extension http-client medea intarweb uri-common)

;; Will get put in the user-agent header if non-#f...
(client-software '(("scheme-swapi" #f #f)))

;; Get all planets
(define (planets)
    (with-input-from-request "http://swapi.co/api/planets/" #f read-json))

;; Succeeds in getting data on tatooine
(define (tatooine)
    (with-input-from-request "http://swapi.co/api/planets/1" #f read-json))

;; (planet 1) -> no output and a new line in the repl, awaiting a command
(define (planet x)
  (number->string x)
  (let* ((planeturi (update-uri (uri-reference "http://swapi.co/")
                                 path: `(/ "api" "planets" ,x)))
         (req (make-request
               method: 'Get
               uri: planeturi)))
    (with-input-from-request req #f read-json)))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which egg provides `string-pad-right'?
Visually impaired? Let me spell it for you (wav file) download WAV