nextjournal

2021-10-09T17:29:48.065700Z

I noticed that Clerk does not play nicely yet with "certain very dynamic data structures based on reify macro".

2021-10-09T17:31:03.067100Z

In the tech.ml.dataset world a lot of data structures get realised vi reify of interfaces

2021-10-09T17:34:01.067700Z

So a vector-of-maps, which looks like:

[{:dan-sleep 4.0, :dan-grump 90.20926835578194}
 {:dan-sleep 4.1, :dan-grump 89.31559277383866}
 {:dan-sleep 4.2, :dan-grump 88.42191719189539}] 

2021-10-09T17:35:14.068200Z

Might have a Clojure type of: tech.v3.dataset.readers$mapseq_reader$reify__25236

2021-10-09T17:38:10.069Z

It is sequential? and implements all interface to work exactly like a sequence

2021-10-09T17:39:16.069600Z

Showing in in Clerk gives:

#object[Error Error: No reader function for tag array-buffer<object>]

2021-10-09T17:40:21.070600Z

Converting into a real

clojure.lang.LazySeq

2021-10-09T17:40:27.070800Z

make its then work:

2021-10-09T17:40:39.071100Z

(seq predictions)

2021-10-09T17:41:12.071300Z

(seq predictions)

2021-10-09T17:41:22.071400Z

2021-10-09T17:42:46.072300Z

This issues we don't see in a repl, neither in other notebooks, like notespace

mkvlr 2021-10-09T17:52:08.073200Z

@carsten.behring thanks a lot for the report, I’ll see that I fix that for the next release.

2021-10-09T17:54:39.073700Z

I will do a quick reproducible example

🖤 1
mkvlr 2021-10-09T18:00:20.074600Z

also noticed a few last minute regressions in the viewers, like false and fns not showing up that I’ve fixed

mkvlr 2021-10-09T18:01:45.075300Z

I guess (Object.) the minimum reproducible example 😼

2021-10-09T18:02:23.076200Z

It comes from classes / types om the dtype-next library:

(tech.v3.datatype/->array-buffer [1 2])

mkvlr 2021-10-09T18:02:44.076500Z

perfect, thanks

2021-10-09T18:03:22.076900Z

https://github.com/cnuernber/dtype-next by @chris441

2021-10-09T18:24:20.077900Z

One other type with issues:

(byte-array (repeat 1000 2))

2021-10-09T18:24:44.078100Z

#object[Error Error: No reader function for tag object]

2021-10-09T18:28:26.078700Z

Could I fix this by registering additional viewers ?

2021-10-09T18:28:35.079Z

Or is it "deeper down" ?

mkvlr 2021-10-09T18:41:57.080700Z

the reader is not yet open, so this can't yet be fixed in userland

mkvlr 2021-10-09T19:08:46.082Z

@carsten.behring I have a fix for (Object.) which also fixes the byte array. Later we’ll probably want a hex viewer for binary. Looking into the array buffer next.

🙌 1
mkvlr 2021-10-09T19:44:25.083Z

@carsten.behring how does the array buffer get displayed in notespace? Like a vector?

mkvlr 2021-10-09T19:46:10.083700Z

is there anything I need to do to make this readable or is this expected?

(tech.v3.datatype/->array-buffer [1 2])
(read-string "#array-buffer<object>[2] [1, 2]")

2021-10-09T19:46:32.084Z

We don't do anything special with it.

2021-10-09T19:46:57.084600Z

So it implements ".toString()" in some form, I belive.

2021-10-09T19:47:11.084900Z

So something like: "#array-buffer<object>[2]\n[1, 2]"

2021-10-09T19:47:17.085100Z

would be "expected"

2021-10-09T19:48:04.085500Z

not pretty, I agree....

2021-10-09T19:48:39.085900Z

I think that notespace has a fallback, to "str" or similar.

2021-10-09T19:49:06.086300Z

So it prints any Java Object in some form.

mkvlr 2021-10-09T19:49:44.086800Z

yeah, printing isn’t the problem, reading it back is

2021-10-09T19:49:48.086900Z

as in the repl: user> (def x (tech.v3.datatype/->array-buffer [1 2])) ;; => #'user/x user> x ;; => #array-buffer<object>[2] [1, 2]

mkvlr 2021-10-09T19:50:09.087100Z

yes, but that can’t be read again

2021-10-09T19:50:24.087300Z

indeed.

2021-10-09T19:50:37.087600Z

Notespace does not need this.

2021-10-09T19:51:27.088300Z

Notespace does nothing with the clojure reader, I think.

mkvlr 2021-10-09T19:51:36.088500Z

if I define the reader I get this, but it doesn’t really represent the underlying data meaningfully

mkvlr 2021-10-09T19:55:56.089700Z

I think I need a small patch to edamame to make this work, see https://clojurians.slack.com/archives/C015LCR9MHD/p1633809296061200

2021-10-09T20:02:49.090400Z

I would expect that str is called on anything unknown:

2021-10-09T20:03:22.091100Z

so that the last output is te output of the expression before as well

2021-10-09T20:06:47.091800Z

This "error" in rendering prevents as well other rendering which is using the data:

mkvlr 2021-10-09T20:25:41.093300Z

yeah, that's a reasonable fallback and it's actually possible with edamame today

mkvlr 2021-10-09T20:30:54.095Z

will try to get a release with these fixes out tomorrow or early next week

Daniel Slutsky 2021-10-09T20:56:31.096Z

An interesting case that @jsa-aerial pointed out at our study session today. Somehow, a nested map structure is transformed on rendering.

mkvlr 2021-10-09T21:02:11.097100Z

@daslu oh, that's a bug I thought I had fixed before the release, I guess not completely

🙏 1
mkvlr 2021-10-09T21:07:42.098100Z

it's great to get all those error reports, thanks so much!