How to convert this map value [2.2] to a decimal value?
App Development3 posts108 viewsLast activity Jul 2022
SA
Sarah_CaloobananOP
Jul 2022I have this code let price = map (\or → (getMarketBuyPrice(snd or))) setprice
it returns [2.2] but i want convert it to decimal value because it has an error when I try to compare this one to 2.2
ST
Stephen
Jul 2022It’s difficult to say what would be best here without knowing: why is setprice a list?
There are possibilities like
- comparing every element to 2.2
- same, but also there must be at least one element
- allowing only one-element lists, where the sole element is 2.2
- taking the sum and comparing that to 2.2
- or the average
- checking that there is at least one element that is 2.2, but the other elements can be anything
- more…this list is not exhaustive
SA
Sarah_Caloobanan
Jul 2022thank you so much for answering. I made something like this List.head [2.2]