I would like to write one function that extracts only odd numbers from a list. Sort of:
fun odd(nil) = nil | odd(a::nil) = a | odd(a::(b::c)) = a::odd(c);
But this causes this error:
Operatorand operand disagree [roundness]
and operand disagree [roundness]
In your second case, odd(a::nil) = a you return a , which is a single element. In two other cases, you return the list. If you change it to odd(a::nil) = [a] , then all cases return a list, it works.
odd(a::nil) = a
a
odd(a::nil) = [a]
Source: https://habr.com/ru/post/1334770/More articles:No android.permission.RECEIVE_BOOT_COMPLETED required? - androidCheck if Rhythmbox works through Python - pythonUsing Thor, can I pass the CLI only an argument (not a task) and send it to the default method / task? - ruby ββ| fooobar.comBranching in ClearCase? - unixConfirmation of form validation disables the submit button until all fields are filled in WPF - c #Razor template for javascript string - javascriptWhat is the preferred way to write my linux daemons? - c ++Locating socks in musical notation - c ++Find tunes for a few octaves of musical notes? - windows-phone-7WP7 - Dynamically changing the start page depending on the setting - windows-phone-7All Articles