ob-julia icon indicating copy to clipboard operation
ob-julia copied to clipboard

Result formatting: Base, Dictionary

Open tecosaur opened this issue 4 years ago • 2 comments

What can I say, it's a bit weird at the moment.

#+begin_src julia
Dict([("A", 1), ("B", 2), ("C", 3)])
#+end_src

#+RESULTS:
| B | A => 1 | C => 3) |
|---+--------+---------|

Suggested output formats:

- A :: 1
- B :: 2
- C :: 3

or

| A | 1 |
| B | 2 |
| C | 3 |

tecosaur avatar Apr 24 '21 16:04 tecosaur

Yeah it's weird because it's not implemented :) The main problem with your options is that we should also deal with nested dictionaries. What are other languages doing?

As a side note, the way you construct dictionaries is strange. You are first constructing an array, and then converting it to dict. I guess the correct way is:

 Dict("A" => 1, "B" => 2, "C" => 3)

nico202 avatar Apr 24 '21 17:04 nico202

I checked python, and it wasn't doing anything good. For now, I've implemented the following behaviour:

#+begin_src julia
Dict("a" => 1, "b" => 2, "c" => Dict("d" => 3))
#+end_src

#+RESULTS:
| a |              1 |
| b |              2 |
| c | Dict("d" => 3) |

I think this is better than nothing, and we can always improve it.

tecosaur avatar Jul 10 '21 15:07 tecosaur