Created
October 17, 2024 03:49
-
-
Save taruma/f8d0cbaa587f0cfe82df039198465f7e to your computer and use it in GitHub Desktop.
Ini koleksi lambda di pertemuan consilium.7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// INI DAFTAR KOLEKSI LAMBDA PADA PERTEMUAN | |
// CONSILIUM.7 SHARE TO INNOVATE | |
XMIN = LAMBDA(lookup_vector, return_array, | |
LET( | |
min_value, MIN(lookup_vector), | |
XLOOKUP(min_value, lookup_vector, return_array) | |
) | |
); | |
XMAX = LAMBDA(lookup_vector, return_array, | |
LET( | |
max_value, MAX(lookup_vector), | |
// XLOOKUP(max_value, lookup_vector, return_array) | |
FILTER(return_array, lookup_vector=max_value) | |
) | |
); | |
XMINMAX = LAMBDA(lookup_vector, return_array, | |
VSTACK( | |
XMIN(lookup_vector, return_array), | |
XMAX(lookup_vector, return_array) | |
) | |
); | |
XFILTER = LAMBDA(lookup_array, | |
return_array, | |
LET( | |
n_columns, COLUMNS(lookup_array), | |
seq_columns, SEQUENCE(n_columns), | |
// pick_1, CHOOSECOLS(lookup_array, 1), | |
// result_1, XMINMAX( | |
// pick_1, return_array | |
// ), | |
// pick_2, CHOOSECOLS(lookup_array, 2), | |
// result_2, XMINMAX( | |
// pick_2, return_array | |
// ), | |
// VSTACK(result_1, result_2) | |
reduce_result, REDUCE( | |
"", | |
seq_columns, | |
LAMBDA( | |
acc, curr, | |
LET( | |
pick_column, CHOOSECOLS(lookup_array, curr), | |
result, XMINMAX(pick_column, return_array), | |
VSTACK( | |
acc, | |
result | |
) | |
) | |
) | |
), | |
DROP(reduce_result, 1) | |
) | |
); | |
LUAS_LINGKARAN = LAMBDA( | |
jari_jari, PI()*jari_jari^2 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment