如何清除julia-app mac OS-X中的屏幕?

sur*_*upa 2 julia

**如何在julia-app mac OS-X中清除屏幕**

在mac终端 - clear将清除终端屏幕.

如何在Mac OS X中的julia交互式应用程序中执行相同的操作?

Sal*_*apa 6

使用键盘快捷键:Ctrl + L.

使用Julia的REPL shell模式:

julia> ; # upon typing ;, the prompt changes (in place) to: shell>

shell> clear    # unix

shell> cmd /c cls    # windows
Run Code Online (Sandbox Code Playgroud)

如果您需要一个功能,您可以使用该run功能:

julia> ? # upon typing ?, the prompt changes (in place) to: help>

help?> run
INFO: Loading help data...
Base.run(command)

   Run a command object, constructed with backticks. Throws an error
   if anything goes wrong, including the process exiting with a non-
   zero status.

julia> using Compat: @static, is_unix    # `Pkg.add("Compat")` if not installed.

julia> clear() = run(@static is_unix() ? `clear` : `cmd /c cls`)
clear (generic function with 1 method)

julia> clear()
Run Code Online (Sandbox Code Playgroud)

这适用于平台和版本无关的方式(在Windows和Linux中测试,Julia版本0.3.12,0.4.5和0.5.+).