Skip to content

Commit 8e1c69a

Browse files
authored
Tweak documentation (#21)
* Tweak documentation * Fix a typo
1 parent 1db4609 commit 8e1c69a

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

examples/lift-macro.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# # [`@?` tutorial](@id tutorial)
1+
# # [How to use `@?`](@id tutorial)
22

33
using Maybe
44

@@ -16,7 +16,7 @@ findfirst(x -> gcd(x, 42) == 21, 50:200)
1616

1717
@assert findlast(x -> gcd(x, 42) == 23, 50:200) === nothing
1818

19-
# Using such functions is rather tedious
19+
# It is rather tedious to combine such functions:
2020

2121
function find_some_random_range_1(data)
2222
f(x) = gcd(x, 42) == 21

src/docs/@?.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Idea:
77
* Each function `f(::T₁, ..., ::Tₙ) -> ::R` is (conceptually) lifted to
88
`f′(::Union{Some{T₁}, Nothing}, ..., ::Union{Some{Tₙ}, Nothing})
99
-> ::Union{Some{R}, R, Nothing}`.
10-
* If any of the argument is `nothing`, `@?` short-circuits and
11-
evaluates to `nothing`.
10+
* If any of the returned value is `nothing`, the evaluation of `expr`
11+
in `@?` short-circuits and evaluates to `nothing`.
1212

1313
See the [tutorial](@ref) for more information.
1414

@@ -24,8 +24,7 @@ Some(3)
2424
julia> @? dict[:a][:b] + dict[:c] # => nothing
2525
```
2626

27-
The expression in `@?` short-circuits when `nothing` appears in the
28-
argument position:
27+
The expression in `@?` short-circuits when a call returns `nothing`:
2928

3029
```jldoctest; setup = :(using Maybe)
3130
julia> f() = nothing;

src/docs/maybe.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
maybe(f) -> f′
22

33
Transform ("lift") function `f(::T₁, ..., ::Tₙ) -> ::Union{Some{R}, R,
4-
Nothing}` to `f′(::Union{Some{T₁}, Nothing}, ..., ::Union{Some{Tₙ},
5-
Nothing}) -> ::Union{Some{R}, Nothing}`.
4+
Nothing}` to `f′(::Union{T₁, Some{T₁}, Nothing}, ..., ::Union{Tₙ,
5+
Some{Tₙ}, Nothing}) -> ::Union{Some{R}, Nothing}`.
66

77
# Examples
88
```jldoctest

0 commit comments

Comments
 (0)