From 44e77f36791a313cd2ec6d4dfe7bf1361d2c7665 Mon Sep 17 00:00:00 2001 From: Artem Darius Weber Date: Fri, 29 Nov 2024 15:43:21 +0300 Subject: [PATCH] feat: rename task1 function to indices_sorted_by_descending_values for clarity --- lab3_task1_funcation_block_arg/main.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lab3_task1_funcation_block_arg/main.rb b/lab3_task1_funcation_block_arg/main.rb index fac45b4..676b966 100644 --- a/lab3_task1_funcation_block_arg/main.rb +++ b/lab3_task1_funcation_block_arg/main.rb @@ -1,4 +1,4 @@ -def task1(array) +def indices_sorted_by_descending_values(array) indices = array.each_with_index.to_a sorted_indices = indices.sort_by { |(element, index)| -element } result = sorted_indices.map { |(element, index)| index } @@ -8,4 +8,4 @@ end # Ex array = [5, 3, 8, 1, 7] puts "Indices in order of decreasing elements:" -puts task1(array).join(", ") +puts indices_sorted_by_descending_values(array).join(", ")