how to pass a class method as argument to another method of the class in perl 6
问题 I have a script like the below. Intent is to have different filter methods to filter a list. Here is the code. 2 3 class list_filter { 4 has @.my_list = (1..20); 5 6 method filter($l) { return True; } 7 8 # filter method 9 method filter_lt_10($l) { 10 if ($l > 10) { return False; } 11 return True; 12 } 13 14 # filter method 15 method filter_gt_10($l) { 16 if ($l < 10) { return False; } 17 return True; 18 } 19 20 # expecting a list of (1..10) to be the output here 21 method get_filtered_list