Skip to content

Commit c6c51b4

Browse files
committed
updated for loop parameter name
1 parent d11c4d9 commit c6c51b4

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ Despite AutoHotKey (1.1.28 at the moment) supporting Arrays and Function Objects
2828
* unshift
2929

3030
### Installation
31-
There are two options for using importing these functions, either as global functions stored in **array_.ahk** or by extending the built-in Array object stored in **array_base.ahk**. The sorting function in both files depends on the object defined in **array_quicksort.ahk**. This object must be present for sorting to work properly.
31+
There are two options for using these functions, either as global functions stored in **array_.ahk** or by extending the built-in Array object with the object stored in **array_base.ahk**. The sorting function in both files depend on the object defined in **array_quicksort.ahk**. This object must be present for sorting to work properly.
3232

33-
Some dislike extending built-in objects. For that reason **array_base.ahk**'s base object does not automatically extend Array. Extending Array, or a custom collections object, is left to the implementer (See _**Extend Array Object**_ below).
33+
Some dislike extending built-in objects. For that reason **array_base.ahk**'s object does not automatically extend Array. Extending Array, or a custom collections object, is left to the implementer (See _**As Array Object Extension**_ below).
3434

3535
### Usage
3636
_**As Global Functions**_
37-
**array_.ahk** contains each ported function as a global function declaration in the form of *array_<func>*. The input array is always located in the first parameter position.
37+
**array_.ahk** contains each ported function as a global function declaration in the form of *array_\<func\>*. The input array is always located in the first parameter position.
3838

3939
Usage: `array_<fn>(array[, params*])`
4040
```autohotkey
@@ -57,9 +57,9 @@ get_name(obj) {
5757
```
5858

5959
_**As Array Object Extension**_
60-
**array_base.ahk** contains each ported function as a method of a single object.
60+
**array_base.ahk** contains each ported function as a method of the object *_Array*. The most intuitive use case is extending the built-in Array object (assigning it's base object). Some environments avoid modifying built-ins and prefer using custom collection objects.
6161

62-
Usage: `Array.<fn>([params*])`
62+
Usage: `Array.<fn>([params*])` (Assuming Array's base object was extended)
6363
```autohotkey
6464
#include array_base.ahk
6565
@@ -88,8 +88,8 @@ get_name(obj) {
8888
_**Sorting**_
8989
**array_quicksort.ahk** contains the sorting logic. The quicksort behavior is wrapped in a callable function object to avoid cluttering the global namespace.
9090

91-
Indirect Usage: `array_sort(array, [params*])` or `array.sort([params*])`
92-
Direct Usage: `Array_Quicksort.Call(array, [params*])`
91+
Indirect Usage: `array_sort(Array, [params*])` or `Array.sort([params*])`
92+
Direct Usage: `Array_Quicksort.Call(Array, [params*])`
9393
```autohotkey
9494
arrayInt := [11,9,5,10,1,6,3,4,7,8,2]
9595

array_.ahk

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ array_concat(arrays*) {
33

44
results := []
55

6-
for _, array in arrays
7-
for _, element in array
6+
for index, array in arrays
7+
for index, element in array
88
results.push(element)
99

1010
return results

array_base.ahk

+8-8
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ class _Array {
1717
results := []
1818

1919
; First add the values from the instance being called on
20-
for i,v in this
21-
results.push(v)
20+
for index, value in this
21+
results.push(value)
2222

2323
; Second, add arrays given in parameter
24-
for _, array in arrays
25-
for _, element in array
24+
for index, array in arrays
25+
for index, element in array
2626
results.push(element)
2727

2828
return results
@@ -442,9 +442,9 @@ class _Array {
442442
}
443443

444444
; Simple swap
445-
swap(idx1, idx2) {
446-
tmp := this[idx1]
447-
this[idx1] := this[idx2]
448-
this[idx2] := tmp
445+
swap(index1, index2) {
446+
tmp := this[index1]
447+
this[index1] := this[index2]
448+
this[index2] := tmp
449449
}
450450
}

0 commit comments

Comments
 (0)