基本功能

介绍

Julia Base 中包含一系列适用于科学及数值计算的函数和宏,但也可以用于通用编程,其它功能则由 Julia 生态圈中的各种库来提供。函数按主题划分如下:

一些通用的提示:

  • 可以通过 Import Module 导入想要使用的模块,并利用 Module.fn(x) 语句来实现对模块内函数的调用。

  • 此外,using Module 语句会将名为 Module 的模块中的所有可调函数引入当前的命名空间。

  • 按照约定,名字以感叹号(!)结尾的函数会改变其输入参数的内容。 一些函数同时拥有改变参数(例如 sort!)和不改变参数(sort)的版本

The behaviors of Base and standard libraries are stable as defined in SemVer only if they are documented; i.e., included in the Julia documentation and not marked as unstable. See API FAQ for more information.

Getting Around

  1. Base.exit
  2. Base.atexit
  3. Base.isinteractive
  4. Base.summarysize
  5. Base.require
  6. Base.compilecache
  7. Base.__precompile__
  8. Base.include
  9. Base.MainInclude.include
  10. Base.include_string
  11. Base.include_dependency
  12. Base.which(::Any, ::Any)
  13. Base.methods
  14. Base.@show
  15. ans
  16. Base.active_project

Keywords

This is the list of reserved keywords in Julia: baremodule, begin, break, catch, const, continue, do, else, elseif, end, export, false, finally, for, function, global, if, import, let, local, macro, module, quote, return, struct, true, try, using, while. Those keywords are not allowed to be used as variable names.

The following two-word sequences are reserved: abstract type, mutable struct, primitive type. However, you can create variables with names: abstract, mutable, primitive and type.

Finally: where is parsed as an infix operator for writing parametric method and type definitions; in and isa are parsed as infix operators; and outer is parsed as a keyword when used to modify the scope of a variable in an iteration specification of a for loop or generator expression. Creation of variables named where, in, isa or outer is allowed though.

  1. module
  2. export
  3. import
  4. using
  5. baremodule
  6. function
  7. macro
  8. return
  9. do
  10. begin
  11. end
  12. let
  13. if
  14. for
  15. while
  16. break
  17. continue
  18. try
  19. finally
  20. quote
  21. local
  22. global
  23. const
  24. struct
  25. mutable struct
  26. abstract type
  27. primitive type
  28. where
  29. ...
  30. ;
  31. =
  32. ?:

Standard Modules

  1. Main
  2. Core
  3. Base

Base Submodules

  1. Base.Broadcast
  2. Base.Docs
  3. Base.Iterators
  4. Base.Libc
  5. Base.Meta
  6. Base.StackTraces
  7. Base.Sys
  8. Base.Threads
  9. Base.GC

All Objects

  1. Core.:(===)
  2. Core.isa
  3. Base.isequal
  4. Base.isless
  5. Base.ifelse
  6. Core.typeassert
  7. Core.typeof
  8. Core.tuple
  9. Base.ntuple
  10. Base.objectid
  11. Base.hash
  12. Base.finalizer
  13. Base.finalize
  14. Base.copy
  15. Base.deepcopy
  16. Base.getproperty
  17. Base.setproperty!
  18. Base.propertynames
  19. Base.hasproperty
  20. Core.getfield
  21. Core.setfield!
  22. Core.isdefined
  23. Base.@isdefined
  24. Base.convert
  25. Base.promote
  26. Base.oftype
  27. Base.widen
  28. Base.identity

Properties of Types

Type relations

  1. Base.supertype
  2. Core.Type
  3. Core.DataType
  4. Core.:(<:)
  5. Base.:(>:)
  6. Base.typejoin
  7. Base.typeintersect
  8. Base.promote_type
  9. Base.promote_rule
  10. Base.promote_typejoin
  11. Base.isdispatchtuple

Declared structure

  1. Base.ismutable
  2. Base.isimmutable
  3. Base.isabstracttype
  4. Base.isprimitivetype
  5. Base.issingletontype
  6. Base.isstructtype
  7. Base.nameof(::DataType)
  8. Base.fieldnames
  9. Base.fieldname
  10. Base.hasfield

Memory layout

  1. Base.sizeof(::Type)
  2. Base.isconcretetype
  3. Base.isbits
  4. Base.isbitstype
  5. Core.fieldtype
  6. Base.fieldtypes
  7. Base.fieldcount
  8. Base.fieldoffset
  9. Base.datatype_alignment
  10. Base.datatype_haspadding
  11. Base.datatype_pointerfree

Special values

  1. Base.typemin
  2. Base.typemax
  3. Base.floatmin
  4. Base.floatmax
  5. Base.maxintfloat
  6. Base.eps(::Type{<:AbstractFloat})
  7. Base.eps(::AbstractFloat)
  8. Base.instances

Special Types

  1. Core.Any
  2. Core.Union
  3. Union{}
  4. Core.UnionAll
  5. Core.Tuple
  6. Core.NTuple
  7. Core.NamedTuple
  8. Base.@NamedTuple
  9. Base.Val
  10. Core.Vararg
  11. Core.Nothing
  12. Base.isnothing
  13. Base.notnothing
  14. Base.Some
  15. Base.something
  16. Base.@something
  17. Base.Enums.Enum
  18. Base.Enums.@enum
  19. Core.Expr
  20. Core.Symbol
  21. Core.Symbol(x...)
  22. Core.Module

Generic Functions

  1. Core.Function
  2. Base.hasmethod
  3. Core.applicable
  4. Base.isambiguous
  5. Core.invoke
  6. Base.@invoke
  7. Base.invokelatest
  8. Base.@invokelatest
  9. new
  10. Base.:(|>)
  11. Base.:(∘)
  12. Base.ComposedFunction
  13. Base.splat
  14. Base.Fix1
  15. Base.Fix2

Syntax

  1. Core.eval
  2. Base.MainInclude.eval
  3. Base.@eval
  4. Base.evalfile
  5. Base.esc
  6. Base.@inbounds
  7. Base.@boundscheck
  8. Base.@propagate_inbounds
  9. Base.@inline
  10. Base.@noinline
  11. Base.@nospecialize
  12. Base.@specialize
  13. Base.gensym
  14. Base.@gensym
  15. var"name"
  16. Base.@goto
  17. Base.@label
  18. Base.@simd
  19. Base.@polly
  20. Base.@generated
  21. Base.@pure
  22. Base.@deprecate

Missing Values

  1. Base.Missing
  2. Base.missing
  3. Base.coalesce
  4. Base.@coalesce
  5. Base.ismissing
  6. Base.skipmissing
  7. Base.nonmissingtype

System

  1. Base.run
  2. Base.devnull
  3. Base.success
  4. Base.process_running
  5. Base.process_exited
  6. Base.kill(::Base.Process, ::Integer)
  7. Base.Sys.set_process_title
  8. Base.Sys.get_process_title
  9. Base.ignorestatus
  10. Base.detach
  11. Base.Cmd
  12. Base.setenv
  13. Base.addenv
  14. Base.withenv
  15. Base.pipeline(::Any, ::Any, ::Any, ::Any...)
  16. Base.pipeline(::Base.AbstractCmd)
  17. Base.Libc.gethostname
  18. Base.Libc.getpid
  19. Base.Libc.time()
  20. Base.time_ns
  21. Base.@time
  22. Base.@timev
  23. Base.@timed
  24. Base.@elapsed
  25. Base.@allocated
  26. Base.EnvDict
  27. Base.ENV
  28. Base.Sys.isunix
  29. Base.Sys.isapple
  30. Base.Sys.islinux
  31. Base.Sys.isbsd
  32. Base.Sys.isfreebsd
  33. Base.Sys.isopenbsd
  34. Base.Sys.isnetbsd
  35. Base.Sys.isdragonfly
  36. Base.Sys.iswindows
  37. Base.Sys.windows_version
  38. Base.Sys.free_memory
  39. Base.Sys.total_memory
  40. Base.@static

Versioning

  1. Base.VersionNumber
  2. Base.@v_str

Errors

  1. Base.error
  2. Core.throw
  3. Base.rethrow
  4. Base.backtrace
  5. Base.catch_backtrace
  6. Base.current_exceptions
  7. Base.@assert
  8. Base.Experimental.register_error_hint
  9. Base.Experimental.show_error_hints
  10. Base.ArgumentError
  11. Base.AssertionError
  12. Core.BoundsError
  13. Base.CompositeException
  14. Base.DimensionMismatch
  15. Core.DivideError
  16. Core.DomainError
  17. Base.EOFError
  18. Core.ErrorException
  19. Core.InexactError
  20. Core.InterruptException
  21. Base.KeyError
  22. Base.LoadError
  23. Base.MethodError
  24. Base.MissingException
  25. Core.OutOfMemoryError
  26. Core.ReadOnlyMemoryError
  27. Core.OverflowError
  28. Base.ProcessFailedException
  29. Core.StackOverflowError
  30. Base.SystemError
  31. Core.TypeError
  32. Core.UndefKeywordError
  33. Core.UndefRefError
  34. Core.UndefVarError
  35. Base.StringIndexError
  36. Base.InitError
  37. Base.retry
  38. Base.ExponentialBackOff

Events

  1. Base.Timer(::Function, ::Real)
  2. Base.Timer
  3. Base.AsyncCondition
  4. Base.AsyncCondition(::Function)

Reflection

  1. Base.nameof(::Module)
  2. Base.parentmodule
  3. Base.pathof(::Module)
  4. Base.pkgdir(::Module)
  5. Base.moduleroot
  6. __module__
  7. __source__
  8. Base.@__MODULE__
  9. Base.@__FILE__
  10. Base.@__DIR__
  11. Base.@__LINE__
  12. Base.fullname
  13. Base.names
  14. Core.nfields
  15. Base.isconst
  16. Base.nameof(::Function)
  17. Base.functionloc(::Any, ::Any)
  18. Base.functionloc(::Method)
  19. Base.@locals

Internals

  1. Base.GC.gc
  2. Base.GC.enable
  3. Base.GC.@preserve
  4. Base.GC.safepoint
  5. Meta.lower
  6. Meta.@lower
  7. Meta.parse(::AbstractString, ::Int)
  8. Meta.parse(::AbstractString)
  9. Meta.ParseError
  10. Core.QuoteNode
  11. Base.macroexpand
  12. Base.@macroexpand
  13. Base.@macroexpand1
  14. Base.code_lowered
  15. Base.code_typed
  16. Base.precompile

Meta

  1. Meta.quot
  2. Meta.isexpr
  3. Meta.isidentifier
  4. Meta.isoperator
  5. Meta.isunaryoperator
  6. Meta.isbinaryoperator
  7. Meta.show_sexpr