How to define a variable based on an if/then/else statement

I'm trying to translate some python code to haskell. However I reached a point where I'm not sure how to proceed.

if len(prod) % 2 == 0:
    ss = float(1.5 * count_vowels(cust))
else:
    ss = float(count_consonants(cust)) # muliplicaton by 1 is implied.

if len(cust_factors.intersection(prod_factors)) > 0:
    ss *= 1.5

return ss

I've tried to translate it to this:


if odd length prod
    then ss = countConsonants cust
    else ss = countVowels cust
if  length (cust intersect prod) > 0
    then ss = 1.5 * ss
    else Nothing

return ss

Но я продолжаю получать ошибки:

Ошибка синтаксического анализа при вводе `= '

Любая помощь или мудрые слова по этому поводу будут с благодарностью.

5
задан Greg S 24 August 2010 в 08:18
поделиться