Commit c6aa29b6fd

Erik Arvstedt <erik.arvstedt@gmail.com>
2023-07-15 11:29:09
SinglyLinkedList: rename `invert` -> `reverse`
1 parent 7dd1cf2
Changed files (1)
lib/std/linked_list.zig
@@ -62,9 +62,9 @@ pub fn SinglyLinkedList(comptime T: type) type {
                 return count;
             }
 
-            /// Invert the list starting from this node in-place.
+            /// Reverse the list starting from this node in-place.
             /// This operation is O(N).
-            pub fn invert(indirect: *?*Node) void {
+            pub fn reverse(indirect: *?*Node) void {
                 if (indirect.* == null) {
                     return;
                 }
@@ -164,7 +164,7 @@ test "basic SinglyLinkedList test" {
     try testing.expect(list.first.?.next.?.data == 4);
     try testing.expect(list.first.?.next.?.next == null);
 
-    L.Node.invert(&list.first);
+    L.Node.reverse(&list.first);
 
     try testing.expect(list.first.?.data == 4);
     try testing.expect(list.first.?.next.?.data == 2);