Skip to main content

Files

Image Preview

You can drop any image available in the folder of your notebook and type its filename in a new cell.

randompic.png

Reading and Writing Files

In principle, you can print the contents of any file located in the notebook's folder by typing its name without line breaks.

filename.txt

For writing, the process is the same, but the actual content goes on the next line:

filename.txt
Hello World

Or, if you are writing a package, this might come in handy:

cell 1
IR.wl

BeginPackage["JerryI`Mirage`IR`"]

(* utils *)
MapHeld[f_, list_] := Table[Extract[Unevaluated[list], i, f], {i, 1, Length[Unevaluated[list]]}]
SetAttributes[MapHeld, HoldAll]

ClearAll[Lexer]
SetAttributes[Lexer, HoldAll]

...

And then, it can be imported easily:

cell 2
Get["IR.wl"];
info

The frontend detects the file extension and tries to apply the appropriate syntax highlighting scheme.