Utilities
Haskell-like array slicing
Those who know Haskell probably started learning it by manipulating lists with head
and tail
. Those functionalities are not available in Julia by default and array slicing - with an ugly syntax - is required. Since this is done often in the fields of application of WallyToolbox
, both head
and tail
together with a body
functions are available in its core. They are simple wrapers over the @view
macro and work with both iterable types and arrays. The following snippet illustrates their usage.
julia> v = collect(1:4);
julia> head(v) == [1; 2; 3]
true
julia> tail(v) == [2; 3; 4]
true
julia> body(v) == [2; 3]
true
More examples are provided in the documentation of each of the functions.
WallyToolbox.head
— Functionhead(z)
Access view of array head. See also tail
and body
.
julia> head(1:4)
1:3
julia> head([1, 2, 3, 4])
3-element view(::Vector{Int64}, 1:3) with eltype Int64:
1
2
3
WallyToolbox.tail
— Functiontail(z)
Access view of array tail. See also head
and body
.
julia> tail([1, 2, 3, 4])
3-element view(::Vector{Int64}, 2:4) with eltype Int64:
2
3
4
julia> tail(1:4)
2:4
WallyToolbox.body
— Functionbody(z)
Access view of array body. See also head
and tail
.
julia> body([1, 2, 3, 4])
2-element view(::Vector{Int64}, 2:3) with eltype Int64:
2
3
julia> body(1:4)
2:3
General utilities
WallyToolbox.defaultvalue
— FunctionSyntax sugar for handling a possibly nothing value.
WallyToolbox.tuplefy
— FunctionSyntax sugar for converting a dictionary into a named tuple.
WallyToolbox.redirect_to_files
— FunctionHelper function to redirect outputs to the right files.
WallyToolbox.test_exhaustive
— FunctionRun all assertions before throwing an error.
WallyToolbox.mute_execution
— FunctionManage redirection of all output to pipe.
Literate programming
Because WallyToolbox
is intended to be run from a portable Julia environment without footprint in the local system, some particularities arise in setting a Jupyter toolset. The following tools tools provide launchers for starting local Jupyter Notebook and Jupyterlab sessions.
Notice it is up to the user to define the path JUPYTER_DATA_DIR
as an environment variable; default Jupyter configuration is not accepted because it might break the local system.
WallyToolbox.Notebook.launch_notebook
— FunctionLaunch Jupyter notebook session with WallyToolbox kernel.
WallyToolbox.Notebook.launch_jupyterlab
— FunctionLaunch Jupyterlab session with WallyToolbox kernel.
WallyToolbox.Notebook.launch_pluto
— FunctionLaunch a Pluto notebook session with a template notebook.