Programowanie w systemie UNIX/Julia
Przejdź do nawigacji
Przejdź do wyszukiwania
Instalacja[edytuj]
sudo snap install julia # version 1.0.4
or
sudo apt install julia # version 1.4.1+dfsg-1
uruchamianie[edytuj]
bash[edytuj]
W terminalu wpisujemy
julia
Przykładowy wynik:
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.4.1
_/ |\__'_|_|_|\__'_| | Ubuntu ⛬ julia/1.4.1+dfsg-1
|__/ |
lub z argumentami:[3]
julia script.jl arg1 arg2...
Kończenie programu:[4]
- Ctrl-d
REPL[edytuj]
Po uruchomieniu julii w terminalu wpisujemy
include("hello_world.jl")
inaczej:[5]
julia> include("path/to/script-name.jl")
tryby[edytuj]
REPL ma 5 trybów wprowadzania ( ang. prompt modes )[6]
- Julian mode( domyślny)
- help
- shell
- search
- reverse search
katalogi[edytuj]
Aktualny katalog roboczy: w REPL wpisujemy:[7]
pwd()
przykładowy wynik :
"/home/a"
Katalog domowy :
homedir()
"
moduły[edytuj]
GUI[edytuj]
CUDA[edytuj]
isinstalled(pkg::String) = any(x -> x.name == pkg && x.is_direct_dep, values(Pkg.dependencies()))
pk = ["CUDA"]
using Pkg; for p in pk; isinstalled(p) || Pkg.add(p); end
Pkg.test("CUDA")
Pkg[edytuj]
Pkg zawiera własny REPL.[8]
Otwórz Pkg REPL, naciskając ] w Julia REPL. Aby wrócić do Julia REPL, naciśnij klawisz Backspace lub ^ C.
GR[edytuj]
Dodawanie modułu w trybie Julia REPL:
Pkg.add("GR")
lub w trybie Pkg REPL-mode:
add GR
plots[edytuj]
" from https://juliabyexample.helpmanual.io/"
"https://discourse.julialang.org/t/how-to-use-pkg-dependencies-instead-of-pkg-installed/36416/13"
isinstalled(pkg::String) = any(x -> x.name == pkg && x.is_direct_dep, values(Pkg.dependencies()))
pk = ["Plots"]
using Pkg; for p in pk; isinstalled(p) || Pkg.add(p); end
using Plots
" pwd() "
cd("Dokumenty/julia/")
# plot some data
Plots.plot([cumsum(rand(500) .- 0.5), cumsum(rand(500) .- 0.5)])
# save the current figure in
Plots.savefig("plots.svg")
# .eps, .pdf, & .png are also supported
# we used svg here because it respects the width and height specified above
RootsAndPoles[edytuj]
Pakiet RootsAndPoles jest na juliahub
Instalacja
using Pkg
PKG.add("RootsAndPoles");
skróty klawiaturowe[edytuj]
Opis ( ang. Key bindings)[9]
Program control
- ^D Exit (when buffer is empty)
- ^C Interrupt or cancel
- ^L Clear console screen
- Return/Enter, ^J New line, executing if it is complete
- meta-Return/Enter Insert new line without executing it
- ? or ; Enter help or shell mode (when at start of a line)
- ^R, ^S Incremental history search
Gdzie Meta oznacza Alt
Zobacz również[edytuj]
Żródła[edytuj]
- ↑ docker: Julia
- ↑ ISTE NITH : Julia_on_the_GPU/mandlebrot/
- ↑ julia lang manual: getting-started
- ↑ stackoverflow question: how-to-alias-quit-to-quit
- ↑ stackoverflow questionrunning-julia-jl-files
- ↑ docs julialang : stdlib REPL
- ↑ stackoverflow question : setting-working-directory-julia-versus-r
- ↑ docs of julialang : Pkg getting-Started
- ↑ docs.julialang.org: Key-bindings