authorgravatar for erik.arvstedt@gmail.comErik Arvstedt <erik.arvstedt@gmail.com> 2023-07-15 11:29:09+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-15 21:37:54-07:00
logc6aa29b6fdba1606bfd218b17de89f64179c0ed8
treebf6481ceb650ba7d9ef6502426acc2734268e917
parent7dd1cf26f9b0cb104ada166a10ff356ca272577a

SinglyLinkedList: rename `invert` -> `reverse`


1 files changed, 3 insertions(+), 3 deletions(-)

lib/std/linked_list.zig+3-3
...@@ -62,9 +62,9 @@ pub fn SinglyLinkedList(comptime T: type) type {...@@ -62,9 +62,9 @@ pub fn SinglyLinkedList(comptime T: type) type {
62 return count;62 return count;
63 }63 }
6464
65 /// Invert the list starting from this node in-place.65 /// Reverse the list starting from this node in-place.
66 /// This operation is O(N).66 /// This operation is O(N).
67 pub fn invert(indirect: *?*Node) void {67 pub fn reverse(indirect: *?*Node) void {
68 if (indirect.* == null) {68 if (indirect.* == null) {
69 return;69 return;
70 }70 }
...@@ -164,7 +164,7 @@ test "basic SinglyLinkedList test" {...@@ -164,7 +164,7 @@ test "basic SinglyLinkedList test" {
164 try testing.expect(list.first.?.next.?.data == 4);164 try testing.expect(list.first.?.next.?.data == 4);
165 try testing.expect(list.first.?.next.?.next == null);165 try testing.expect(list.first.?.next.?.next == null);
166166
167 L.Node.invert(&list.first);167 L.Node.reverse(&list.first);
168168
169 try testing.expect(list.first.?.data == 4);169 try testing.expect(list.first.?.data == 4);
170 try testing.expect(list.first.?.next.?.data == 2);170 try testing.expect(list.first.?.next.?.data == 2);