Skip to content

Commit

Permalink
docs: Fix typos (#462)
Browse files Browse the repository at this point in the history
  • Loading branch information
deining authored Feb 1, 2024
1 parent b3cd4f1 commit 2400c2a
Show file tree
Hide file tree
Showing 27 changed files with 66 additions and 66 deletions.
12 changes: 6 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,16 @@ see [CONTRIBUTING.md](CONTRIBUTING.md#release-instructions-for-a-new-version) fo
- overhaul: `array2d` module was updated, got additional tests and several
documentation updates
[#377](https://github.com/lunarmodules/Penlight/pull/377)
- feat: `aray2d` now accepts negative indices
- feat: `array2d` now accepts negative indices
- feat: `array2d.row` added to align with `column`
- fix: bad error message in `array2d.map`
- fix: `array2d.flatten` now ensures to deliver a 'square' result if `nil` is
encountered
- feat: `array2d.transpose` added
- feat: `array2d.swap_rows` and `array2d.swap_cols` now return the array
- fix: `aray2d.range` correctly recognizes `R` column in spreadsheet format, was
- fix: `array2d.range` correctly recognizes `R` column in spreadsheet format, was
mistaken for `R1C1` format.
- fix: `aray2d.range` correctly recognizes 2 char column in spreadsheet format
- fix: `array2d.range` correctly recognizes 2 char column in spreadsheet format
- feat: `array2d.default_range` added (previously private)
- feat: `array2d.set` if used with a function now passes `i,j` to the function
in line with the `new` implementation.
Expand Down Expand Up @@ -203,7 +203,7 @@ see [CONTRIBUTING.md](CONTRIBUTING.md#release-instructions-for-a-new-version) fo

- `utils.quote_arg` will now optionally take an array of arguments and escape
them all into a single string.
- `app.parse_args` now accepts a 3rd parameter with a list of valid flags and aliasses
- `app.parse_args` now accepts a 3rd parameter with a list of valid flags and aliases
- `app.script_name` returns the name of the current script (previously a private function)

### Changes
Expand Down Expand Up @@ -366,7 +366,7 @@ see [CONTRIBUTING.md](CONTRIBUTING.md#release-instructions-for-a-new-version) fo

### Fixes

- func was broken: do NOT use ipairs to iterate if __index is overriden!
- func was broken: do NOT use ipairs to iterate if __index is overridden!
- issue #133 pretty.read (naively) confused by unbalanced brackets
- xml attribute underscore fix for simple parser
- Fix path.normpath
Expand Down Expand Up @@ -491,7 +491,7 @@ particularly convenient for using from Moonscript.
- array2d.product was broken; more sensible implementation
- array2d.range, .slice, .write were broken
- text optional operator % overload broken for 'fmt % fun'; new tests
- a few occurances of non-existent function utils.error removed
- a few occurrences of non-existent function utils.error removed


## 0.9.6 (2011-09-11)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Here's how to go about contributing to Penlight:

1. [Fork the repository](https://github.com/lunarmodules/Penlight/fork) to
your Github account.
2. Create a *topical branch* - a branch whose name is succint but explains what
2. Create a *topical branch* - a branch whose name is succinct but explains what
you're doing, such as _"added-klingon-cloacking-device"_ - from `master` branch.
3. Make your changes, committing at logical breaks.
4. Push your branch to your personal account
Expand Down
6 changes: 3 additions & 3 deletions docs_topics/01-introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ For example,

return M

If you were to accidently type `mymod.Answer()`, then you would get a runtime
If you were to accidentally type `mymod.Answer()`, then you would get a runtime
error: "variable 'Answer' is not declared in 'mymod'".

This can be applied to existing modules. You may desire to have the same level
Expand Down Expand Up @@ -231,7 +231,7 @@ a function to all elements of a list is a common operation:
res[i] = fun(ls[i])
end

This can be efficiently and succintly expressed as `ls:map(fun)`. Not only is
This can be efficiently and succinctly expressed as `ls:map(fun)`. Not only is
there less typing but the intention of the code is clearer. If readers of your
code spend too much time trying to guess your intention by analyzing your loops,
then you have failed to express yourself clearly. Similarly, `ls:filter('>',0)`
Expand Down Expand Up @@ -330,7 +330,7 @@ for functions which don't access any globals.

`app.parse_args` is a simple command-line argument parser. If called without any
arguments, it tries to use the global `arg` array. It returns the _flags_
(options begining with '-') as a table of name/value pairs, and the _arguments_
(options beginning with '-') as a table of name/value pairs, and the _arguments_
as an array. It knows about long GNU-style flag names, e.g. `--value`, and
groups of short flags are understood, so that `-ab` is short for `-a -b`. The
flags result would then look like `{value=true,a=true,b=true}`.
Expand Down
2 changes: 1 addition & 1 deletion docs_topics/02-arrays.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ there is already `pop` (remove and return last value) and `append` acts like
`push` (add a value to the end). `push` is provided as an alias for `append`, and
the other stack operation (size) is simply the size operator `#`. Queues can
also be implemented; you use `pop` to take values out of the queue, and `put` to
insert a value at the begining.
insert a value at the beginning.

You may derive classes from `List`, and since the list-returning methods
are covariant, the result of `slice` etc will return lists of the derived type,
Expand Down
8 changes: 4 additions & 4 deletions docs_topics/03-strings.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Most of these can be fairly easily implemented using the Lua string library,
which is more general and powerful. But they are convenient operations to have
easily at hand. Note that can be injected into the `string` table if you use
`stringx.import`, but a simple alias like `local stringx = require 'pl.stringx'`
is preferrable. This is the recommended practice when writing modules for
is preferable. This is the recommended practice when writing modules for
consumption by other people, since it is bad manners to change the global state
of the rest of the system. Magic may be used for convenience, but there is always
a price.
Expand Down Expand Up @@ -104,7 +104,7 @@ lines that fit into a desired line width. As an extension, there is also `indent
for indenting multiline strings.

New in Penlight with the 0.9 series is `text.format_operator`. Calling this
enables Python-style string formating using the modulo operator `%`:
enables Python-style string formatting using the modulo operator `%`:

> text.format_operator()
> = '%s[%d]' % {'dog',1}
Expand All @@ -126,7 +126,7 @@ Preprocessor](http://lua-users.org/wiki/SlightlyLessSimpleLuaPreprocessor). Thi
allows you to mix Lua code with your templates in a straightforward way. There
are only two rules:

- Lines begining with `#` are Lua
- Lines beginning with `#` are Lua
- Otherwise, anything inside `$()` is a Lua expression.

So a template generating an HTML list would look like this:
Expand Down Expand Up @@ -223,6 +223,6 @@ takes the same arguments as standard file objects:
string.

`stringio.create` creates a writeable file-like object. You then use `write` to
this stream, and finally extract the builded string using `value`. This 'string
this stream, and finally extract the built string using `value`. This 'string
builder' pattern is useful for efficiently creating large strings.

4 changes: 2 additions & 2 deletions docs_topics/04-paths.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ For example, this little script converts a file into upper case:
text = assert(file.read(arg[1]))
assert(file.write(arg[2],text:upper()))

Copying files is suprisingly tricky. `file.copy` and `file.move` attempt to use
Copying files is surprisingly tricky. `file.copy` and `file.move` attempt to use
the best implementation possible. On Windows, they link to the API functions
`CopyFile` and `MoveFile`, but only if the `alien` package is installed (this is
true for Lua for Windows.) Otherwise, the system copy command is used. This can
Expand All @@ -109,7 +109,7 @@ table, unlike `lfs.dir` which returns an iterator.)

`dir.makepath` can create a full path, creating subdirectories as necessary;
`rmtree` is the Nuclear Option of file deleting functions, since it will
recursively clear out and delete all directories found begining at a path (there
recursively clear out and delete all directories found beginning at a path (there
is a similar function with this name in the Python `shutils` module.)

> = dir.makepath 't\\temp\\bonzo'
Expand Down
2 changes: 1 addition & 1 deletion docs_topics/05-dates.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ you full control of the format for both parsing and displaying dates:
> = amer:tostring(d)
04/10/2010

With the 0.9.7 relase, the `Date` constructor has become more flexible. You may
With the 0.9.7 release, the `Date` constructor has become more flexible. You may
omit any of the 'year', 'month' or 'day' fields:

> = Date { year = 2008 }
Expand Down
2 changes: 1 addition & 1 deletion docs_topics/06-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ gracefully.)
The scanners all have a second optional argument, which is a table which controls
whether you want to exclude spaces and/or comments. The default for `lexer.lua`
is `{space=true,comments=true}`. There is a third optional argument which
determines how string and number tokens are to be processsed.
determines how string and number tokens are to be processed.

The ultimate highly-structured data is of course, program source. Here is a
snippet from 'text-lexer.lua':
Expand Down
12 changes: 6 additions & 6 deletions docs_topics/07-functional.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Sequences can be _combined_, either by 'zipping' them or by concatenating them.
3

`seq.printall` is useful for printing out single-valued sequences, and provides
some finer control over formating, such as a delimiter, the number of fields per
some finer control over formatting, such as a delimiter, the number of fields per
line, and a format string to use (@see string.format)

> seq.printall(seq.random(10))
Expand Down Expand Up @@ -82,7 +82,7 @@ original table (equivalent to `tablex.filter(ls, '>', 0)`)

ls = seq.copy(seq.filter(ls, '>', 0))

We're already encounted `seq.sum` when discussing `input.numbers`. This can also
We're already encountered `seq.sum` when discussing `input.numbers`. This can also
be expressed with `seq.reduce`:

> seq.reduce(function(x,y) return x + y end, seq.list{1,2,3,4})
Expand Down Expand Up @@ -289,7 +289,7 @@ I'm emphasizing that a comprehension is a function which can take a list argumen
{20,40,60}

Here is a somewhat more explicit way of saying the same thing; `_1` is a
_placeholder_ refering to the _first_ argument passed to the comprehension.
_placeholder_ referring to the _first_ argument passed to the comprehension.

> = C '2*x for _,x in pairs(_1)' {10,20,30}
{20,40,60}
Expand Down Expand Up @@ -366,7 +366,7 @@ arguments where the first argument is bound to some value:
> tablex.filter({1,-2,10,-1,2},bind1(ops.le,0))
{1,10,2}

The last example unfortunately reads backwards, because `bind1` alway binds the
The last example unfortunately reads backwards, because `bind1` always binds the
first argument! Also unfortunately, in my youth I confused 'currying' with
'partial application', so the old name for `bind1` is `curry` - this alias still exists.

Expand Down Expand Up @@ -441,7 +441,7 @@ Functions of up to 5 arguments can be generated.
> = tablex.map2(_1+_2,{1,2,3}, {10,20,30})
{11,22,33}

These expressions can use arbitrary functions, altho they must first be
These expressions can use arbitrary functions, although they must first be
registered with the functional library. `func.register` brings in a single
function, and `func.import` brings in a whole table of functions, such as `math`.

Expand All @@ -458,7 +458,7 @@ A common operation is calling a method of a set of objects:
{'o','f','x'}

There are some restrictions on what operators can be used in PEs. For instance,
because the `__len` metamethod cannot be overriden by plain Lua tables, we need
because the `__len` metamethod cannot be overridden by plain Lua tables, we need
to define a special function to express `#_1':

> = tablex.map(Len(_1), {'one','four','x'})
Expand Down
2 changes: 1 addition & 1 deletion docs_topics/08-additional.md
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ perfectly legal to have '-vvv'. But normally the value of args.v is just a simpl
vlevel = not args.v[1] and 0 or #args.v
print(vlevel)

The vlevel assigment is a bit of Lua voodoo, so consider the cases:
The vlevel assignment is a bit of Lua voodoo, so consider the cases:

* No -v flag, v is just { false }
* One -v flags, v is { true }
Expand Down
4 changes: 2 additions & 2 deletions lua/pl/List.lua
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function List:insert(i, x)
return self
end

--- Insert an item at the begining of the list.
--- Insert an item at the beginning of the list.
-- @param x a data item
-- @return the list
function List:put (x)
Expand Down Expand Up @@ -526,7 +526,7 @@ function List:iter ()
return iter(self)
end

--- Create an iterator over a seqence.
--- Create an iterator over a sequence.
-- This captures the Python concept of 'sequence'.
-- For tables, iterates over all values with integer indices.
-- @param seq a sequence; a string (over characters), a table, a file object (over lines) or an iterator function
Expand Down
18 changes: 9 additions & 9 deletions lua/pl/app.lua
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ end
-- Multiple short args can be combined like so: ( `-abcd`).
--
-- When specifying the `flags_valid` parameter, its contents can also contain
-- aliasses, to convert short/long flags to the same output name. See the
-- aliases, to convert short/long flags to the same output name. See the
-- example below.
--
-- Note: if a flag is repeated, the last value wins.
Expand All @@ -163,7 +163,7 @@ end
-- { "hello", "world" }, -- list of flags taking values
-- { "l", "a", "b"}) -- list of allowed flags (value ones will be added)
--
-- -- More complex example using aliasses:
-- -- More complex example using aliases:
-- local valid = {
-- long = "l", -- if 'l' is specified, it is reported as 'long'
-- new = { "n", "old" }, -- here both 'n' and 'old' will go into 'new'
Expand Down Expand Up @@ -206,16 +206,16 @@ function app.parse_args (args,flags_with_values, flags_valid)
valid = setmetatable({},{ __index = function(_, key) return key end })
else
valid = {}
for k,aliasses in pairs(flags_valid) do
for k,aliases in pairs(flags_valid) do
if type(k) == "number" then -- array/list entry
k = aliasses
k = aliases
end
if type(aliasses) == "string" then -- single alias
aliasses = { aliasses }
if type(aliases) == "string" then -- single alias
aliases = { aliases }
end
if type(aliasses) == "table" then -- list of aliasses
if type(aliases) == "table" then -- list of aliases
-- it's the alternate name, so add the proper mappings
for i, alias in ipairs(aliasses) do
for i, alias in ipairs(aliases) do
valid[alias] = k
end
end
Expand All @@ -236,7 +236,7 @@ function app.parse_args (args,flags_with_values, flags_valid)
end

-- now check that all flags with values are reported as such under all
-- of their aliasses
-- of their aliases
for k, main_alias in pairs(valid) do
if with_values[main_alias] then
with_values[k] = true
Expand Down
4 changes: 2 additions & 2 deletions lua/pl/array2d.lua
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ function array2d.flatten (t)
return makelist(res)
end

--- reshape a 2D array. Reshape the aray by specifying a new nr of rows.
--- reshape a 2D array. Reshape the array by specifying a new nr of rows.
-- @array2d t 2d array
-- @int nrows new number of rows
-- @bool co use column-order (Fortran-style) (default false)
Expand Down Expand Up @@ -266,7 +266,7 @@ end
--- extract the specified columns.
-- @array2d t 2d array
-- @tparam {int} cidx a table of column indices
-- @return a new 2d array with the extracted colums
-- @return a new 2d array with the extracted columns
function array2d.extract_cols (t,cidx)
assert_arg(1,t,'table')
local res = {}
Expand Down
4 changes: 2 additions & 2 deletions lua/pl/class.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--- Provides a reuseable and convenient framework for creating classes in Lua.
--- Provides a reusable and convenient framework for creating classes in Lua.
-- Two possible notations:
--
-- B = class(A)
Expand All @@ -25,7 +25,7 @@ local function call_ctor (c,obj,...)
init = rawget(parent_with_init, '_init')
parent_with_init = rawget(parent_with_init, '_parent_with_init')
end
if parent_with_init then -- super() points to one above whereever _init came from
if parent_with_init then -- super() points to one above wherever _init came from
rawset(obj,'super',function(obj,...)
call_ctor(parent_with_init,obj,...)
end)
Expand Down
2 changes: 1 addition & 1 deletion lua/pl/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ local config = {}

--- like `io.lines`, but allows for lines to be continued with '`\`'.
-- @param file a file-like object (anything where read() returns the next line) or a filename.
-- Defaults to stardard input.
-- Defaults to standard input.
-- @return an iterator over the lines, or nil
-- @return error 'not a file-like object' or 'file is nil'
function config.lines(file)
Expand Down
2 changes: 1 addition & 1 deletion lua/pl/data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ function data.read(file,cnfg)

-- note that using dot as the thousands separator (@thousands_dot)
-- requires a special conversion function! For CSV, _empty fields_ are
-- considered to default to numerial zeroes.
-- considered to default to numerical zeroes.
local tonumber = tonumber
local function try_number(x)
if thousands_dot then x = x:gsub('%.(...)','%1') end
Expand Down
2 changes: 1 addition & 1 deletion lua/pl/func.lua
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ function repr (e,lastpred)
end
func.repr = repr

-- collect all the non-PE values in this PE into vlist, and replace each occurence
-- collect all the non-PE values in this PE into vlist, and replace each occurrence
-- with a constant PH (_C1, etc). Return the maximum placeholder index found.
local collect_values
function collect_values (e,vlist)
Expand Down
2 changes: 1 addition & 1 deletion lua/pl/import_into.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--------------
-- PL loader, for loading all PL libraries, only on demand.
-- Whenever a module is implicitly accesssed, the table will have the module automatically injected.
-- Whenever a module is implicitly accessed, the table will have the module automatically injected.
-- (e.g. `_ENV.tablex`)
-- then that module is dynamically loaded. The submodules are all brought into
-- the table that is provided as the argument, or returned in a new table.
Expand Down
2 changes: 1 addition & 1 deletion lua/pl/init.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--------------
-- Entry point for loading all PL libraries only on demand, into the global space.
-- Requiring 'pl' means that whenever a module is implicitly accesssed
-- Requiring 'pl' means that whenever a module is implicitly accessed
-- (e.g. `utils.split`)
-- then that module is dynamically loaded. The submodules are all brought into
-- the global space.
Expand Down
2 changes: 1 addition & 1 deletion lua/pl/permute.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ end

--- an iterator over all permutations of the elements of the given lists.
-- @param ... list-like tables, they are nil-safe if a length-field `n` is provided (see `utils.pack`)
-- @return an iterator which provides the next permutation as return values in the same order as the provided lists, preceeded by an index
-- @return an iterator which provides the next permutation as return values in the same order as the provided lists, preceded by an index
-- @usage
-- local strs = utils.pack("one", nil, "three") -- adds an 'n' field for nil-safety
-- local bools = utils.pack(true, false)
Expand Down
Loading

0 comments on commit 2400c2a

Please sign in to comment.