This commit is contained in:
Victor Fors 2022-05-14 13:50:43 +02:00
parent 894f62384e
commit dc5aaa7e08

View File

@ -17,6 +17,13 @@
(array . ,identity) (array . ,identity)
(null . ,(constantly '()))) (json-parsers))) (null . ,(constantly '()))) (json-parsers)))
;; The resultant type definition for the above parser rules.
(define-type json *)
(define-type json
(or string boolean number float null
(list-of json)
(list-of (pair symbol json))))
(: curry (procedure * --> procedure)) (: curry (procedure * --> procedure))
(define (curry fn a) (define (curry fn a)
(lambda (b) (lambda (b)
@ -94,11 +101,6 @@
(apply string-append (apply string-append
(map (curry2 upon symbol? (compose ->string (curry (flip value) ln))) statement))) (map (curry2 upon symbol? (compose ->string (curry (flip value) ln))) statement)))
(define-type json *)
(define-type json
(or string boolean number float null
(list-of json)
(list-of (pair symbol json))))
;;; Get data from a uri and parse it as json. ;;; Get data from a uri and parse it as json.
(: simple-json-request (string -> json)) (: simple-json-request (string -> json))