Skip to content

Commit 7ba3501

Browse files
authored
Merge pull request #712 from axch/main
Drive-by proofreading of julia/README.md.
2 parents 1e25a68 + 9bcdaf7 commit 7ba3501

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

julia/README.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ julia> evaluate(raw"sum $ for i. exp [log 2.0, log 4.0].i")
1616
## `DexModule` run a whole bunch of Dex code defining a module.
1717
Similar to `evaluate`, `DexModule` takes a string full of Dex code and runs it.
1818
However, DexModule is a bit more powerful.
19-
It allowed you to run multiple expressions, and returns a namespaced module object that you can query to get variables out from.
19+
It allows you to run multiple expressions, and returns a namespaced module object that you can query to get variables out from.
2020

2121

2222
```julia
@@ -77,8 +77,8 @@ Int32
7777

7878
It is not presently possible to `juliaize`/`dexize` arrays (but you can use them / get them as the input/output of `NativeFunction`s, see below).
7979

80-
You can also use [`convert`](https://docs.julialang.org/en/v1/manual/conversion-and-promotion/#Conversion) to convert between `Atom`sand Julia objects.
81-
When converting to a Julia typeit will make the minimal change from the Dex type to get to the type you requested.
80+
You can also use [`convert`](https://docs.julialang.org/en/v1/manual/conversion-and-promotion/#Conversion) to convert between `Atom`s and Julia objects.
81+
When converting to a Julia type it will make the minimal change from the Dex type to get to the type you requested.
8282
```julia
8383
julia> typeof(convert(Integer, m.x))
8484
Int32
@@ -93,8 +93,8 @@ julia> convert(Number, convert(Atom, 1.5))
9393
1.5
9494
```
9595

96-
To convert function `Atom`s into something you can execute as if it was a regular julia function use `NativeFunction`.
97-
This will compile it and handing inputs and outputs without needing to del with `Atom`s directly.
96+
To convert function `Atom`s into something you can execute as if it was a regular Julia function use `NativeFunction`.
97+
This will compile it and handle inputs and outputs without needing to deal with `Atom`s directly.
9898

9999
```julia
100100
julia> const add_two = NativeFunction(m.addTwo)
@@ -107,18 +107,17 @@ julia> add_two([0f0, 10f0, 100f0])
107107
102.0
108108
```
109109

110-
**Performance Note:** at present, when passing multidimensional arrays to or from a `NativeFunction` they are copied.
111-
This is due to Dex using C memory layout, and Julia's default `Array` using Fortran memory layout.
110+
**Performance Note:** at present, passing multidimensional arrays to or from a `NativeFunction` copies them.
111+
This is due to Dex using the C memory layout, while Julia's default `Array` uses the Fortran memory layout.
112112
We hope to address this in future versions.
113113

114-
## `dex_func` compile Dex code directly into a function you can call from julia.
114+
## `dex_func` compile Dex code directly into a function you can call from Julia.
115115

116-
The `dex_func` [string macro](https://docs.julialang.org/en/v1/manual/metaprogramming/#Non-Standard-String-Literals) allows you to define a function in Dex that you can then call from julia.
116+
The `dex_func` [string macro](https://docs.julialang.org/en/v1/manual/metaprogramming/#Non-Standard-String-Literals) allows you to define a function in Dex that you can then call from Julia.
117117
The function type it defines is a `NativeFunction` as described above.
118118
In functionality, `dex_func` is very similar to `NativeFunction ∘ evaluate` except that it does a whole ton of the work at parse time -- including compiling the Dex function.
119119

120-
You can use it to define either named functions.
121-
Both in long form:
120+
You can use it to define named functions in long form:
122121
```julia
123122
julia> dex_func"""
124123
def myTranspose (n: Int) ?-> (m: Int) ?->
@@ -153,6 +152,6 @@ julia> map(dex_func"\x:Float. pow 2.0 x", [1f0, 2f0, 3f0])
153152
8.0
154153
```
155154

156-
By adding a `c` flag after the string for a named function (in either long or short form), you can make it declared as const.
157-
Which is [a good idea if declaring it at global scope](https://docs.julialang.org/en/v1/manual/performance-tips/#Avoid-global-variables).
158-
For example: `dex_func"inc = \a:Int. a + 1"c`
155+
By adding a `c` flag after the string for a named function (in either long or short form), you can declare it as const.
156+
This is [a good idea if declaring it at global scope](https://docs.julialang.org/en/v1/manual/performance-tips/#Avoid-global-variables).
157+
For example: `dex_func"inc = \a:Int. a + 1"c`

0 commit comments

Comments
 (0)