Hi,
I just wrote a litte PicoLisp program to concatenate JSON files into one
(array) JSON file, like this:
(argv Fout)
(unless Fout
(prinl "No output file argument given") (bye) )
(de isJSON (F)
(= "json" (pack (stem (chop F) "."))) )
(out Fout
(let Sep "["
(for Fin (dir)
(when (isJSON Fin)
(prinl Sep)
(in Fin (echo))
(setq Sep ",") ) ) )
(prinl)
(prinl "]") )
(bye)
It works quite well. If I call it like this ...
pil ../concatJsonsIntoArray.l ../test.json +
.. then I get a file test.json that contains this:
[
{"dummy1": 1},
{"dummy2": 2},
{"dummy3": 3}
]
However, if I take away the final "(bye)", then I also get this in my
terminal:
[../test.json:1] !? ({"dummy1": 1} {"dummy2": 2} {"dummy3": 3})
{"dummy1": 1} -- Undefined
?
Why is that, and what should I have done different in my program?
/Jon
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe