官术网_书友最值得收藏!

  • Julia for Data Science
  • Anshul Joshi
  • 226字
  • 2021-07-08 11:49:32

Using REPL

Read-Eval-Print-Loop is an interactive shell or the language shell that provides the functionality to test out pieces of code. Julia provides an interactive shell with a Just-in-Time compiler at the backend. We can give inputs in a line, it is compiled and evaluated, and the result is given in the next line.

The benefit of using the REPL is that we can test out our code for possible errors. Also, it is a good environment for beginners. We can type in the expressions and press Enter to evaluate.

A Julia library, or custom-written Julia program, can be included in the REPL using include. For example, I have a file called hello.jl, which I will include in the REPL by doing the following:

julia> include ("hello.jl") 

Julia also stores all the commands written in the REPL in the .julia_history. This file is located at /home/$USER on Ubuntu, C:\Users\username on Windows, or ~/.julia_history on OS X.

As with a Linux Terminal, we can reverse-search using Ctrl + R in Julia's shell. This is a really nice feature as we can go back in the history of typed commands.

Typing ? in the language shell will change the prompt to:

help?> 

To clear the screen, press Ctrl + L. To come out of the REPL press Ctrl + D or type the following:

julia> exit(). 
主站蜘蛛池模板: 寿宁县| 重庆市| 景德镇市| 广德县| 革吉县| 寻甸| 将乐县| 内江市| 商洛市| 肃北| 建宁县| 兴国县| 谷城县| 怀化市| 凭祥市| 秦安县| 乳源| 长治市| 多伦县| 和田市| 商洛市| 浠水县| 会同县| 武城县| 甘肃省| 邵阳县| 和龙市| 大埔区| 新丰县| 逊克县| 新宾| 竹山县| 若尔盖县| 福清市| 康马县| 日照市| 仁怀市| 丰台区| 昌乐县| 松阳县| 海南省|