Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Raku array will not sort

Tags:

raku

rakudo

I'm trying to sort a list/array of strings:

> my @e = Q (list_regex_files json_file_to_ref write_2d_array_to_tex_tabular dir get_sample_ID density_scatterplot violin_plot multiline_plot ref_to_json_file execute venn barplot scatterplot_2d_color worksheet_to_hash group_bar workbook_to_hash read_table)

using https://docs.raku.org/type/Array#(List)_routine_sort and I try

> say @e.sort
(list_regex_files json_file_to_ref write_2d_array_to_tex_tabular dir get_sample_ID density_scatterplot violin_plot multiline_plot ref_to_json_file execute venn barplot scatterplot_2d_color worksheet_to_hash group_bar workbook_to_hash read_table)

but

say <list_regex_files json_file_to_ref write_2d_array_to_tex_tabular dir get_sample_ID density_scatterplot violin_plot multiline_plot ref_to_json_file execute venn barplot scatterplot_2d_color worksheet_to_hash group_bar workbook_to_hash read_table>.sort

does work. However, how can I save the data to an array and then sort it? like say @e.sort?

like image 242
con Avatar asked Aug 30 '21 16:08

con


1 Answers

to echo @Elizabeth s comment, dd is your friend ...

> my @a1 = Q (a b c); dd @a1;   #Array @a1 = ["a b c"]
> my @a2 = <a b c>;   dd @a2;   #Array @a2 = ["a", "b", "c"]

here are the docs https://docs.raku.org/language/quoting for any passing readers

like image 130
p6steve Avatar answered Nov 14 '22 05:11

p6steve