Gauche > Archives > 2024/07/04

2024/07/04 08:22:41 UTCshiro
#
If you get 'rfc.zlib not found', it may be that your Gauche is configured without zlib support.
#
Evaluate this on REPL:
(cond-expand [gauche.sys.zlib 'yes] [else 'no])
If you get no, your Gauche doesn't have zlib support.
#
If you compiled Gauche from release tarball, it automatically adds zlib support when the system has one. So it is possible that you didn't have zlib fully installed. On Debian/Ubuntu, you need zlib1g-dev package.
2024/07/04 08:55:17 UTCshiro
#
There are a couple of other things. (1) there's no text.json; you mean rfc.json? (2) to get a list of *.json.gz, you can use glob. (glob "**/*.json.gz") finds all *.json.gz under the current directory.
2024/07/04 09:00:24 UTCshiro
#
Actually, rfc.json has a different API from your code snippet. Are you using an external library?
2024/07/04 14:32:46 UTCOber
#
I built it explicitly with it assuming that was the problem. even make in ext/zlib directory and make install
2024/07/04 14:50:12 UTCOber
#
If I run gosh, and run the test it finds it. however the script can't.
#
https://github.com/ober/kunabi-scheme/blob/main/gauche.scm is the updated version using rfc.json
2024/07/04 15:19:56 UTCOber
#
solved the problem.
#
thanks
2024/07/04 19:53:35 UTCshiro
#
What was the cause?
2024/07/04 20:21:04 UTCOber
#
s/rpc/rfc/
2024/07/04 20:26:33 UTCOber
#
(((Records . #(((eventVersion . 1.09) ... ;; this is a pair. but I can't get assoc-ref/assoc/alist->hash-table to work.
2024/07/04 20:29:57 UTCshiro
#
The assoc list is in the car of that data.
#
But I'm not sure where you encounter that, since in a single JSON parse result, a pair can only appear as an alist. However, if you have "a list of json objects", as a result of parse-json*, the toplevel pair is a list, not an alist. You need to iterate each element in the list.
#
Sometimes it is confusing that a pair is used both as a list and an assoc list. One way is to provide a custon mapper (json-object-handler) and change the JSON object to other scheme object (e.g. hashtable) as JSON is parsed.
2024/07/04 20:45:48 UTCOber
#
https://github.com/ober/kunabi-scheme/blob/main/gauche.scm is working now. function ct worked it out
2024/07/04 20:55:49 UTCshiro
#
Good to know. (walk-directory dir) can be (glob (build-path dir "**" "*.json.gz"))
2024/07/04 21:00:13 UTCOber
#
ok ty
#
C-h f let-alist would be great. :P use to let-hash on Gerbil
2024/07/04 21:25:36 UTCshiro
#
Looked up let-hash in Gerbil. That's interesting. Since we have a universal referencer, we could have a syntax sugar (let-anything obj body ...) where inside a body some reader macro (say, #.x) resolves to (~ obj 'x). Something to ponder.
2024/07/04 21:26:28 UTCOber
#
I use it extensively when parsing large json files.
#
Does glob work recursively?
2024/07/04 21:29:22 UTCshiro
#
If the path component contains "**", it matches zero or more intermediate directories.
2024/07/04 21:31:02 UTCOber
#
awesome