stisa / jupyternim

A Jupyter kernel for nim
https://stisa.space/jupyternim/
MIT License
163 stars 14 forks source link

TODO/Help wanted #18

Open stisa opened 3 years ago

stisa commented 3 years ago

Some things that would be useful:

Some of these things may be harder than the rest :)

Other PRs are very welcome too!

edited: from hacktoberfest to general todo

voidpunk commented 3 years ago

What about giving the possibility to use Nimscript instead of compiled Nim? Even if still limited it can handle almost all the standard libraries and would be great for people just learning and experimenting Nim, the cells would execute way faster.

P.S. I can help with the less programming-intensive part (for sure with the Logo).

stisa commented 3 years ago

Having nim evaluate the code is an interesting idea, but the main reason I didn't implement that is graphs, as far as I know none of the plotting libraries work in the vm (ok, technically nim-plotly might work), and similarly numerical libraries.
Since that was my main use for this, I ended up with compiled nim. It should be relatively easy, just a matter of changing nim c to nim e.
Other option for faster cell execution is using https://bellard.org/tcc/ as the C compiler (this should work with most of nim) or feeding single lines to nim secret. I'll hopefully have time soon to update zmq code to work with the latest version, so maybe I'll give some of this a try.

Of course, any help is appreciated! And hearing from users is always very helpful to find bugs that just don't appear on my system.

voidpunk commented 3 years ago

Indeed Arraymancer and other libraries don't work on Nimscript, but it would be a great way for newbies to learn the basis of the language and of the standard library without having to wait 5-30 seconds for each cell. It would be nice to just have the option as alternative to the default compilation.

I would also report a issue I found: I receive the error "Kernel is dead" whenever I try to pass the flag #>flags --c:tcc.

Last but not least, I made a logo. Tell me if you like the idea or if you want me to modify something. However, it's made only for dark websites. It's thought for Github on dark mode, so it has white elements and transparent background, but I can easily made other versions once it is approved :slightly_smiling_face: JupyterNim

stisa commented 2 years ago

Hey! Sorry for not getting back to you, thanks for reporting a bug, I'll look into it. About the logo, nice work! What about using the crown instead of the orange parts? So it would just be Jupyternim superimposed on the crown, with the moons orbiting around it. I think that would look cleaner?

iacore commented 2 years ago

What about using inim? They are better at interactive stuff already.

nim>1
1 == type int
nim> 2
2 == type int
nim> 

It has "hot reload" too. It compiles the imported file again on every REPL loop.

stisa commented 2 years ago

Hey! Thanks for the comment. Jupyternim and inim work the same under the hood, or at least they did last time I checked. Neither implements hcl as it's still too buggy on the nim side. Switching to use inim doesn't seem to offer much benefit, compiling a cell is already slow, and switching from direct jupyter>nim>result to jupyter>inim>nim>result would probably make it worse. I'll see if I can provide a way to select the compiler, that way you could just run your code with nim or inim by changing a flag. The convenience of seeing value and type of the value is something we could probably add, although I'd prefer the type in the tooling part (eg with nim suggest) instead of the reply

iacore commented 2 years ago

inim's support for directly showing the expression value is buggy. A multiline expression will fail:

import sugar, sequtils

collect(newSeq):
  for i in 0..3:
    i