mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-02-14 17:49:53 +00:00
2.5 KiB
2.5 KiB
title, homepage, tagline
| title | homepage | tagline |
|---|---|---|
| Julia | https://julialang.org/ | Julia: A Language for Data Science, Visualization, and Machine Learning |
To update or switch versions, run webi julia@stable (or @v1.10, @beta,
etc).
Cheat Sheet
Julia is a programming language for Data Science - a far better alternative to (or plugin for) Python when performance matters.
Table of Contents
- Files
- Hello World
- Compile for Distribution
- Vim Plugin
Files
These are the files / directories that are created and/or modified with this install:
~/.config/envman/PATH.env
~/.local/opt/julia/
How to create a Hello World with Julia
Try out the REPL by coping and pasting the code below (it'll print some nice ASCII art to the console):
julia -i
function mandelbrot(a)
z = 0
for i=1:50
z = z^2 + a
end
return z
end
for y=1.0:-0.05:-1.0
for x=-2.0:0.0315:0.5
abs(mandelbrot(complex(x, y))) < 2 ? print("*") : print(" ")
end
println()
end
Or write the program to ./mandelbrot.jl and run it:
julia ./mandelbrot.jl
How to Build a Distributable Binary with Julia
Here's an example project that you can build:
- Clone and enter the example project
git clone --depth=1 https://github.com/JuliaLang/PackageCompiler.jl ./PackageCompiler pushd ./PackageCompiler/examples - Run Julia in project mode
julia -q --project - Compile the binary
using PackageCompiler create_app("MyApp", "MyAppCompiled") exit() - Test & Enjoy
./MyAppCompiled/bin/MyApp foo bar --julia-args -t4
See also:
- https://docs.juliahub.com/PackageCompiler/MMV8C/2.1.16/apps.html
- https://github.com/JuliaLang/PackageCompiler.jl/tree/master/examples/MyApp
How to Install the Language Server (for VSCode, Vim, etc)
Open the Julia REPL and add LanguageServer:
julia -i
using Pkg
Pkg.add("LanguageServer")
Pkg.add("SymbolServer")
You'll need to reinstall if you switch environments.
How to Install the Julia Vim Plugin
julia-vim adds support for:
- Latex-to-Unicode
- jumping from between start and end of blocks with
%
(and other block jump sequences)
mkdir -p ~/.vim/pack/plugins/start
git clone https://github.com/JuliaEditorSupport/julia-vim.git \
~/.vim/pack/plugins/start/julia-vim
Usage Examples:
\alpha<tab>will produceα
(meaning typing\alphaand hitting thetabkey)- Hitting
%on anendwill take you to thefunctionorfor, etc