Skip to content

Commit

Permalink
start fix basic docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Rratic committed Jul 25, 2022
1 parent 1552f7e commit c2a59fc
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 17 deletions.
24 changes: 13 additions & 11 deletions docs/basic/int.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
| UInt64 | N | 64 |
| Int128 | Y | 128 |
| UInt128 | N | 128 |

* `int``整数(integer)`的缩写
* `U`开头的表示无符号类型,即该类型的值保持在非负整数
* 末尾的数字表示类型的位数
Expand All @@ -35,12 +36,13 @@ julia> typemax(Int64) # typemax可以查看一个类型的最大值
```

## 整数字面表示
* 有符号整数以标准形式表示;若能用32位表示则会依据系统位数,否则使用64位。特别地,当输入的数足够大时,会使用[`高精度整数(BigInt)`](#高精度整数)
有符号整数以标准形式表示;若能用32位表示则会依据系统位数,否则使用64位。特别地,当输入的数足够大时,会使用[`高精度整数(BigInt)`](#高精度整数)
```jl
julia> typeof(1234)
Int64
```
* 无符号整数以十六进制、二进制或八进制表示(~~后2个基本没人用~~),会根据数据大小自动改变类型位数

无符号整数以十六进制、二进制或八进制表示(后2个基本没人用),会根据数据大小自动改变类型位数
```jl
julia> typeof(0xbeef)
UInt16
Expand All @@ -51,15 +53,17 @@ UInt16
julia> typeof(0x0)
UInt8
```
* 如果你没有得到你期望的结果,可以强制转化

如果你没有得到你期望的结果,可以强制类型转化
```jl
julia> x=UInt8(100)
0x64

julia> typeof(x)
UInt8
```
* 如果你有在数字间加`,`的习惯,可以改用`_`

如果你有在数字间加`,`的习惯,可以改用`_`

## 其它预定义类型
预定义了`Int``UInt`类型,位数对应系统位数(通常是64)
Expand All @@ -71,8 +75,7 @@ UInt8
它们对应C中的类型

## 高精度整数
* 类型`BigInt`
* 可以使用`big(值)`定义
高精度整数的类型名为 `BigInt`,它们可以使用 `big(值)` 定义
```jl
julia> big(2)^100
1267650600228229401496703205376
Expand All @@ -89,9 +92,9 @@ julia> big(2)^100
| x ÷ y | 除法(取商) | 使用`\div`打出 |
| x ^ y || x 的 y 次幂 |
| x % y | 取余 | 等价于 `rem(x,y)`,会保留x的正负号 |
| mod(x,y) | 取模 | 得到非负数 |
| `mod(x, y)` | 取模 | 得到非负数 |

数学运算的混合使用和你所学的相同
数学运算的混合使用与通用数学规则相同
```jl
julia> 1 + 2 + 3
6
Expand Down Expand Up @@ -151,7 +154,7 @@ Int64
| --- | --- | --- |
| ~x | 按位取反 | |
| x & y | 按位与 | |
| x | y | 按位或 | |
| `x | y` | 按位或 | |
| x ⊻ y | 按位异或 | 也可以使用`xor(x,y)` |
| x ⊼ y | 按位非与 |
| x ⊽ y | 按位非或 |
Expand All @@ -163,7 +166,6 @@ Int64
`nand``nor`至少需要 Julia 1.7

## 比较

| 操作符 | 名称 |
| --- | --- |
| == | 相等 |
Expand All @@ -187,4 +189,4 @@ true
julia> left <= x <= right # 你通常会这样用它
```

[^1]: https://docs.juliacn.com/latest/manual/mathematical-operations/
[^1]: 更多内容参见 <https://docs.juliacn.com/latest/manual/mathematical-operations/>
7 changes: 6 additions & 1 deletion docs/basic/setup_environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
## 下载
* 可以在[官网](https://julialang.org/downloads/)根据提示下载
* 可以使用[中文社区](https://discourse.juliacn.com/)提供的[下载页面](https://cn.julialang.org/downloads/)
* 如果你已有`python`可以用[安装脚本](https://github.com/johnnychen94/jill.py)
* 如果你已有`python`,可以使用[此脚本](https://github.com/johnnychen94/jill.py)
* 如果你是大佬且闲得慌,可以本地[build](https://github.com/JuliaLang/julia#building-julia)
* 基于`rust`的跨平台安装工具[juliaup](https://github.com/JuliaLang/juliaup)
* windows商店(命令行):`winget install julia -s msstore`
* Mac & Linux curl `curl -fsSL https://install.julialang.org | sh`
* Homebrew `brew install juliaup`
* [Arch Linux](https://aur.archlinux.org/packages/juliaup)
* openSUSE `zypper install juliaup`

通常建议选择`长期维护版(LTS)`\
官网提供的针对操作系统的下载[帮助](https://julialang.org/downloads/platform/)
Expand Down
12 changes: 7 additions & 5 deletions docs/basic/variable_basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ julia> 变量(4)
julia暂时不支持变量删除,如果有占空间的变量希望删除,可以赋值为[nothing](little_types.md#无)

## 变量命名
- 变量名区分大小写
变量名区分大小写
```jl
julia> a=0
0

julia> A=1
1

julia> a,A
julia> a, A # 一种方便的查看方式
(0, 1)
```
- 可以使用 UTF-8 编码的 Unicode 字符作为变量名(允许大部分Unicode,包括大部分中文字符)
- 变量名不允许使用[关键字](../lists/keywords.md)

可以使用 UTF-8 编码的 Unicode 字符作为变量名(允许大部分Unicode,包括大部分中文字符),但不允许使用[关键字](../lists/keywords.md)

```jl
julia> for=1
Expand All @@ -50,7 +50,9 @@ Stacktrace:
[1] top-level scope
@ none:1
```
- 在REPL和一些其它的环境中,很多Unicode数学符号可以使用`\``LaTeX`符号名再按`tab`打出

在REPL和一些其它的环境中,很多Unicode数学符号可以通过键入 `\`[`LaTeX`](../packages/markdown.md#LaTeX) 符号名,再按 `tab` 打出

```jl
julia> α=1 # \alpha<tab>
1
Expand Down
4 changes: 4 additions & 0 deletions docs/meta/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
- 双击代码块可以复制代码
- 下方的讨论区可以在注册github后进行讨论(看不到可以尝试刷新)

## 特性指南
- 文档中部分链接可能在已学知识的后面,你可以提前了解或抱着“这东西迟早读到”的心态继续阅读
- 下方的设置决定了是否添加部分内容,会被存储在浏览器缓存中。如果你有 javascript 基础,也可以配置 `localStorage``is-newbie`

## 设置
```insert-setting
type = "select-is"
Expand Down

0 comments on commit c2a59fc

Please sign in to comment.