我想concactenate兩個json文件在一起。如果我直接做他們然後 有pamentalhesis的問題。我希望他們兩個concactenate作爲兩個jsexp,然後寫入輸出文件。你如何在球拍中簡化兩個jsexpr?你怎麼追加一個jsexpr到另一個jsexpr在球拍
(define (write-or-append-to-json destfile newfile)
(define full-json
(lambda (json-str)
(let ((jsexp (string->jsexpr json-str)))
(hash-refs jsexp '()))))
(let ((dest-json #f)
(new-json #f))
(set! new-json (full-json (file->string newfile)))
(if (file-exists? destfile)
(begin ;insert insert-what of newjson into destjson
(set! dest-json (full-json (file->string destfile)))
(delete-file destfile)
;;Append two jsexp together. i.e. append new-json info to dest-json)
(begin ;json does not exist, simply create it
(write-json new-json destfile)))))