I want to selectively modify some elements of the list, but not all, depending on whether members satisfy certain conditions. For example, in a list of values, I want to subtract 9 from all values that are greater than 9.
I tried
set nodeext2 map nodeext2 [ifelse-value (? > 9) [? - 9][?]]
But we get the "expected constant" error. I also tried if-else and played using brackets. Can someone help me? I feel that this is probably clearly indicated somewhere, but I could not find where.
You simply inverted the order of the arguments map: the reporter must come before the list. Try:
map
set nodeext2 map [ifelse-value (? > 9) [? - 9][?]] nodeext2
" " ifelse-value, , map , , [ifelse-value (? > 9) [? - 9][?]] ( , , ifelse-value ).
ifelse-value
[ifelse-value (? > 9) [? - 9][?]]
Source: https://habr.com/ru/post/1525216/More articles:how do you delete an object selected using placement new - c ++Armadillo - how to extract strings? - c ++How to record original AAC audio files on Android using MediaRecorder? AAC_ADTS not working - androidПочему spring не обеспечивает реализацию области потока? - scopegfortran не допускает массивы символов с различной длиной компонентов - fortranAndroid Range SeekBar - androidDjango: NoReverseMatch for HttpResponseRedirect with kwargs - pythonMFC: MIME type "text / css" not recognized IInternetProtocolSink - internet-explorerВ C, как выпустить глобальный статический указатель? - cAccessViolationException from WebBrowser control with custom IDownloadManager - c #All Articles