04:57
ygrek has quit [Remote host closed the connection]
06:22
<
abu[7] >
Hi tankf33der!
06:24
<
abu[7] >
Can't it be simpler? Do you flatten only the top level?
06:24
<
abu[7] >
Otherwise 'fish'
06:24
<
tankf33der >
Only top
06:26
<
abu[7] >
You could (or (pair L) (list L))
06:29
<
tankf33der >
I am building curl call list and supporting -u credentials only if passed
06:35
<
tankf33der >
I have built picolisp library for monero-wallet-rpc daemon. Very flexible. Now i could do whatever i want to.
06:35
<
tankf33der >
Simple example of usage
07:33
<
tankf33der >
i like this
08:02
<
abu[7] >
Yeah, but this goes deeper (not only top level)
08:21
<
tankf33der >
i have maximum 1 level: ("1" ("2" "3") "4")
08:30
rob_w has joined #picolisp
09:03
rob_w has quit [Ping timeout: 252 seconds]
09:29
<
tankf33der >
abu[7]: here or meeting ?
09:31
<
abu[7] >
Meeting in 2 h
09:31
<
tankf33der >
ok. no hurry
09:37
<
abu[7] >
No problem. A difficult question?
09:38
<
tankf33der >
can not make a array of objects from @lib/json.l
09:39
<
abu[7] >
'printJson' ?
09:40
<
tankf33der >
{"id": "0", "params": {"dests": {"amount": 1, "address": "aaa"}}}
09:40
<
abu[7] >
hmm, an older version had an "array" flag arg, but this is gone
09:40
<
tankf33der >
dests must be array
09:40
<
tankf33der >
array of objects..
09:41
<
abu[7] >
works only for atoms
09:41
<
abu[7] >
str or num
09:42
<
tankf33der >
damn. eh.
09:42
<
abu[7] >
I don't remember why this was removed
09:44
<
tankf33der >
this is bad for me.
09:44
<
abu[7] >
We should revert
09:44
<
abu[7] >
it was somewhen in pil64
09:46
<
abu[7] >
still in latest pil64
09:46
<
tankf33der >
yes, please. i will use it
09:48
<
abu[7] >
Can you try with json.l from 24nov16abu
09:48
<
abu[7] >
if it makes sense?
09:48
<
abu[7] >
Do you have it?
09:48
<
abu[7] >
or should I paste?
09:49
<
tankf33der >
i will copy from github's repo
09:50
<
abu[7] >
Can you investigate if we can revert?
09:50
<
abu[7] >
import some fragments?
09:51
<
abu[7] >
The 'Arr' and 'T' stuff
09:55
<
tankf33der >
jsonOLD is beaking everything. new library - new knowledge how to use it. jsonrpc returns "Parse error" out of box
09:56
<
abu[7] >
That's why I say we need to import fragments
09:56
<
abu[7] >
the other parts are ok
09:59
<
abu[7] >
I don't remember why we removed it
10:00
<
abu[7] >
was not satisfactory somehow
10:03
<
abu[7] >
For printJson it just needs ((=T (car Item)) and (cdr Item)
10:04
<
abu[7] >
Shall I re-introduce into pil21?
10:04
<
tankf33der >
yeap. try
10:04
<
abu[7] >
Why was this feature removed?
10:04
<
tankf33der >
its not me.
10:05
<
abu[7] >
I hope it does not conflict
10:07
<
tankf33der >
do you use it somewhere ?
10:07
<
tankf33der >
you can test firstly
10:09
<
abu[7] >
I newer used the array feature iirc
10:11
<
tankf33der >
this code breaks anyway with old json
10:12
<
tankf33der >
i imagine "address" will be array of objects
10:13
<
abu[7] >
let me re-import Arr
10:15
<
abu[7] >
needs alsp parse
10:17
<
abu[7] >
packJson I mean
10:18
<
abu[7] >
Can you try?
10:18
<
tankf33der >
i will named jsonNEW
10:18
<
tankf33der >
i will named jsonNEW.l
10:22
<
tankf33der >
not breaking current code
10:22
<
tankf33der >
good sign
10:22
<
tankf33der >
and where i should put T ?
10:23
<
abu[7] >
Cons it to a list that should be printed as array
10:24
<
abu[7] >
OK, I also adjusted 'packJson'
10:25
<
tankf33der >
how to modify this code to make dests an array
10:26
<
abu[7] >
(list T '(id . "0") (list 'params ..
10:27
<
tankf33der >
hm. now working. checking
10:28
<
tankf33der >
[{"5927829442663": !? (cdar X)
10:28
<
tankf33der >
id -- List expected
10:31
<
abu[7] >
Hmm, it should work as before
10:34
<
tankf33der >
i never use json until this week.
10:34
<
tankf33der >
and never touched in pil too
10:34
<
abu[7] >
Can you investigate more?
10:35
<
tankf33der >
i will try, but you see on your side ?
10:35
<
tankf33der >
run this code with newer version
10:35
<
tankf33der >
with (list T ...
10:35
<
tankf33der >
works ?
10:40
<
abu[7] >
{"id": "0", "params": {"dests": {"amount": 1, "address": "aaa"}}}-> "}"
10:41
<
tankf33der >
with list T ?
10:41
rob_w has joined #picolisp
10:41
<
abu[7] >
It has no T
10:41
<
tankf33der >
copy paste your code
10:41
<
tankf33der >
please
10:42
<
abu[7] >
I get an error
10:42
<
abu[7] >
Item is (id . "0")
10:43
<
abu[7] >
We should now have the same as old pil
10:44
<
tankf33der >
pil64 ?
10:44
<
abu[7] >
is (id . "0") wrong syntax?
10:44
<
abu[7] >
I don't remember
10:44
<
tankf33der >
i thought now.
10:44
<
tankf33der >
(cons 'id "0") or '(id . "0")
10:45
<
tankf33der >
i thought yes, correct
10:45
<
tankf33der >
but i do not have much correct examples. i reverse engineered library to understand how it is working. :(
10:47
<
abu[7] >
The code of ((=T (car Item)) and (T is different
10:48
<
abu[7] >
(printJson (car X)) vs (printJson (cdar X))
10:48
<
abu[7] >
and (prin "\"") etc.
10:49
<
abu[7] >
So old version was not right?
10:49
<
abu[7] >
Or different meanang?
10:49
<
tankf33der >
i can not use it with T
10:50
<
tankf33der >
jsonNEW.l i meant
10:50
<
abu[7] >
but what is correct?
10:50
<
abu[7] >
should the cond clauses be the same?
10:51
<
abu[7] >
ok, I change
10:52
<
tankf33der >
i am on jsonNEW.l right now.
10:52
<
tankf33der >
and need support for arrays.
10:53
<
tankf33der >
(list T 'dests ...)
10:54
<
abu[7] >
Same logic
10:54
<
tankf33der >
will be jsonNEW.l on my side
10:54
<
abu[7] >
for both clauses
10:54
<
abu[7] >
needs also packJson
10:54
<
abu[7] >
I will release
10:56
<
tankf33der >
code is working out of box so far
10:56
<
tankf33der >
and how to enable arrays on jsonNEW.l ?
10:56
<
tankf33der >
or what i testing ? :)
10:57
<
abu[7] >
Code for both clauses is redundant now
10:57
<
abu[7] >
should rewrite as 'if'
11:01
<
abu[7] >
Sorry, no time
11:01
<
abu[7] >
Can you investigate more?
11:01
<
abu[7] >
The correct way for print and pack?
11:02
<
tankf33der >
arrays ?
11:02
<
abu[7] >
I want to release then
11:03
<
tankf33der >
eh. this is beyond me.
11:03
<
abu[7] >
No, you understand that
11:03
<
abu[7] >
I can't concentrate atm
11:03
<
abu[7] >
phone calls all the time
11:04
<
abu[7] >
and meeting soon all afternoon
11:04
<
abu[7] >
Thanks!! ☺
11:04
<
tankf33der >
no hurry
11:04
<
abu[7] >
I think the code of json.l is no magic
11:09
<
tankf33der >
fucking recursion, this is my weak spot
11:14
<
abu[7] >
I wll look at it this evening. Perhaps the whole thing needs to be done differently
11:15
<
abu[7] >
parseJson and readJson are OK?
11:15
<
tankf33der >
seems so
11:22
<
tankf33der >
i found json testsuite from Nicolas Seriot
11:23
<
tankf33der >
another now.
11:24
<
abu[7] >
I made a stupid erro
11:24
<
abu[7] >
replaced map with for
11:33
<
tankf33der >
much better.
11:34
<
tankf33der >
old code works. array works.
11:35
<
abu[7] >
Can you check more? Also the other functions? Then we can release this evening or tomorrow
11:36
<
tankf33der >
if that then i must write my own testsuite.
11:36
<
tankf33der >
lunch break.
11:36
<
abu[7] >
a test suite would be fantastic
11:48
<
tankf33der >
But it will test only parser
11:48
<
tankf33der >
readJson right?
11:50
<
abu[7] >
packJson is analog to printJson
11:53
<
tankf33der >
Why two then?
11:55
<
tankf33der >
They do different things, right?
11:55
<
abu[7] >
pack vs. print
11:55
<
tankf33der >
Aaaa, ok
11:59
<
tankf33der >
I am hacking from 4am, this is crazy
12:10
<
tankf33der >
open this link
12:10
<
tankf33der >
you will see json below as example
12:11
<
tankf33der >
destinations is array of objects
12:11
<
abu[7] >
Later, now in meeting
12:11
<
tankf33der >
not 1,2,3 BUT pairs
12:11
<
tankf33der >
of course.
13:01
<
tankf33der >
testsuite will be here
13:02
<
tankf33der >
but first you should not use (quit ...) :)
13:03
<
aw- >
tankf33der: i should run my parser against those files
13:09
<
tankf33der >
perfect
13:09
<
aw- >
my parser returns NIl if it fails to parse a JSON string (or file)
13:10
<
aw- >
i wrote a quick script to test each file and i just got a large list of NILs haha
13:11
<
aw- >
i dunno if that's correct
13:11
<
aw- >
it doesn't treat a lonely "true" as a valid JSON
13:11
<
aw- >
even though technically it is
13:11
<
aw- >
i find it stupid
14:46
<
beneroth >
booleans are easy, the hard is the allowed E-notation for numbers (even such which are not valid in Javascript)
14:46
<
beneroth >
I guess it is not widely used in practice, but still...
14:58
rob_w has quit [Remote host closed the connection]
15:02
<
tankf33der >
current json can not create such json: {"mike": [{"1": "2", "2": "2"}, {"1":"2","3":"4"}]}
15:03
<
tankf33der >
this can: {"mike": [1, 2]}
15:40
ygrek has joined #picolisp
16:31
<
abu[7] >
tankf33der, I think 'quit' is needed. Can you 'catch' it?
16:35
<
tankf33der >
But i fail on faulty tests
16:37
<
abu[7] >
You cat test '@@' after catch
16:38
<
abu[7] >
See the 'if2' example in the ref for 'catch'
16:45
<
tankf33der >
i do (in "fail.file" (readJson))
16:45
<
tankf33der >
right ?
16:49
<
tankf33der >
having fun
16:51
<
abu[7] >
Instead of (in "file" ..) you can also use 'pipe' or 'input'
16:52
<
tankf33der >
catch ok
16:52
<
tankf33der >
lets see
16:58
<
abu[7] >
: (let S (chop "{a: 1}") (input (++ S) (readJson)))
16:59
<
abu[7] >
-> ((a . 1))
17:17
<
tankf33der >
if fail file passed is it ok ?
17:18
<
abu[7] >
I think this is good. A negative-test.
17:19
<
tankf33der >
pass files passed
17:19
<
tankf33der >
for one test
17:19
<
tankf33der >
doing second
17:21
<
abu[7] >
What is your impression? Shall I release it?
17:22
<
tankf33der >
you can release it, but i did not get what i really need. see above.
17:23
<
tankf33der >
failed, but should somehow pass
17:23
<
abu[7] >
Which above?
17:24
<
tankf33der >
17:02 <tankf33der> current json can not create such json: {"mike": [{"1": "2", "2": "2"}, {"1":"2","3":"4"}]}
17:24
<
tankf33der >
17:03 <tankf33der> this can: {"mike": [1, 2]}
17:29
<
abu[7] >
How did you make the second?
17:30
<
abu[7] >
(printJson '((mike (T (a . 1)))))
17:30
<
abu[7] >
(printJson '((mike (T (a . 1)))))
17:32
<
tankf33der >
(printJson
17:32
<
tankf33der >
(list 'mike 1 2) ) )
17:32
<
tankf33der >
like this
17:34
<
tankf33der >
and this code does not work on jsonNEW.l
17:34
<
tankf33der >
but jsonNEW passed test suite
17:34
<
tankf33der >
no regressions
17:35
<
abu[7] >
Hmm, should we redesign the whole lib?
17:35
<
tankf33der >
eh. hard decision
17:36
<
abu[7] >
Is it only print?
17:36
<
abu[7] >
or also read?
17:37
<
abu[7] >
(printJson '((mike (a . 1)))) {"mike": {"a": 1}}
17:38
<
abu[7] >
(printJson '((mike ((a . 1) (b . 2))))) {"mike": {"(a . 1)": {"b": 2}}}
17:38
<
tankf33der >
second is not correct
17:39
<
tankf33der >
thats why i always use list or cons
17:39
<
tankf33der >
bulletproof
17:39
<
abu[7] >
Thats the same
17:40
<
tankf33der >
of course, i am a human :)
17:41
<
abu[7] >
So let's not release it
17:41
<
abu[7] >
I must rethink the whole structure
17:42
<
abu[7] >
I don't even know a BNF for Json
17:42
<
tankf33der >
there is a picture
17:43
<
abu[7] >
ok, I think about it tomorrow
17:45
<
abu[7] >
Too bad that this page does not work in a text browser
18:17
<
tankf33der >
json BNF in txt
20:15
<
abu[7] >
The problem is unsolvable
20:16
<
abu[7] >
The s-expr's we have don't map uniquely to all possible combinations of Json syntax
20:17
<
abu[7] >
We would need to define more markup syntax as we have with 'T'
20:22
<
abu[7] >
I find tomorrow ;)
20:48
<
abu[7] >
Good night
20:50
<
beneroth >
yeah, I made a DOM (similar to HTML DOM) from JSON based on pil symbols/OOP, and then have methods to print/pack it, functions to parse JSON and generate the DOM, and a DSL to generate the DOM
20:50
<
beneroth >
somewhat overhead, but can represent and handle all JSON
23:07
<
aw- >
I wrote a JSON parser almost a decade ago for PicoLisp
23:07
<
aw- >
why are people in here ALWAYS trying to re-create the same thing?
23:07
<
beneroth >
lisp curse
23:07
<
aw- >
this has been a solved problem, it works
23:07
<
beneroth >
(I need support for true)
23:10
<
bjorkintosh >
aw-: NIH, or lisp curse as beneroth said..
23:11
<
beneroth >
NIH and lisp curse is not the same thing I would say, though arguably highly related
23:14
<
bjorkintosh >
you're right.
23:14
<
bjorkintosh >
it's NIH NIMBY Lisp curse.
23:15
<
beneroth >
well I wrote my own JSON lib because I wanted full support also for untrusted and/or partially broken JSONs.
23:16
<
beneroth >
I've also addded a way to specify the expected JSON structure so the parser can stop early when the JSON structure is not in the expected format
23:16
<
beneroth >
my use case is interfaces/imports/APIs of bullshit business software
23:17
<
aw- >
lisp curse, holy hell
23:18
<
aw- >
beneroth: JSON-schema?
23:19
<
beneroth >
no, I've looked into it but couldn't make me commit to that mess yet xD
23:19
<
beneroth >
aw-, I think the reason I didn't use your (very good) implementation is because I needed support for floating point / decimal numbers
23:28
<
aw- >
yeah that's a hairy mess I'd rather avoid in PicoLisp haha