Conversion and evaluation of Raku files

This post proclaims a presentation in which we do Raku files conversion and evaluation. Those procedures facilitate Literate programming with Raku.


Presentation plan


Mermaid diagram


Jupyter notebook

SystemOpen["http://localhost:8888/tree/GitHub/lizmat/articles"]

Raku setup

In order to use Raku in Mathematica we have to:

  • Load a “Raku mode” package
  • Covert the notebook into “Raku mode”
  • Start a Raku session.

Remark: If no Raku session is started then every Raku cell evaluation is “on its own”, i.e. independent from the rest.

Import["https://raw.githubusercontent.com/antononcube/ConversationalAgents/master/Packages/WL/RakuMode.m"]
StartRakuProcess["Raku" -> $HomeDirectory <> "/.rakubrew/shims/raku"]

(* KillRakuProcess[]
   KillRakuSockets[] *) 

Here convert the “hosting” notebook into “Raku mode”;

RakuMode[]

Raku cell example:

1+1_000
(*"1001"*)

All shell commands

 1048  git pull
 1049  cat dont-fear-the-grepper-* > dont-fear-the-grepper-all.md
 1050  open dont-fear-the-grepper-all.md
 1051  file-code-chunks-eval dont-fear-the-grepper-all.md
 1052  open dont-fear-the-grepper-all_woven.md
 1053  from-markdown dont-fear-the-grepper-all.md
 1054  from-markdown dont-fear-the-grepper-all.md -t=pod6 -o=dont-fear-the-grepper-all.pod6
 1055  open dont-fear-the-grepper-all.pod6
 1056  file-code-chunks-eval dont-fear-the-grepper-all.pod6
 1057  open dont-fear-the-grepper-all_woven.pod6
 1058  from-markdown dont-fear-the-grepper-all.md | pbcopy
 1059  open dont-fear-the-grepper-all_woven.md
 1060  from-markdown --help
 1061  from-markdown dont-fear-the-grepper-all.md --raku-code-cell-name=RakuInputExecute --l=raku | pbcopy
 1064  jupytext --help
 1066  jupytext --from=md --to=ipynb dont-fear-the-grepper-all.md -o=dont-fear-the-grepper-all.ipynb
 1067  open dont-fear-the-grepper-all.ipynb
 1068  open dont-fear-the-grepper-all.md
 1069  jupytext --from=md --to=ipynb dont-fear-the-grepper-all.md -o=dont-fear-the-grepper-all.ipynb
 1070  open http://localhost:8888/tree/GitHub/lizmat/articles 


References

Articles

[AA1] Anton Antonov, “Raku Text::CodeProcessing”, (2021), RakuForPrediction at WordPress.

[AA2] Anton Antonov, “Connecting Mathematica and Raku”, (2021), RakuForPrediction at WordPress.

[EM1] Elizabeth Mattijsen, “Don’t fear the grepper” series of articles at Dev.to.

Packages and programs

[AAp1] Anton Antonov, “Text::CodeProcessing” Raku package, (2021), GitHub/antononcube.

[AAp2] Anton Antonov, “Markdown::Grammar” Raku package, (2022), GitHub/antononcube.

[BDp1] Brian Duggan, Jupyter::Kernel Raku package, (2017), GitHub/bduggan.

[JTp1] jupytext , “Jupyter Notebooks as Markdown Documents, Julia, Python or R Scripts”, jupytext.readthedocs.io.

Advertisement

3 thoughts on “Conversion and evaluation of Raku files

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s