Posts

Showing posts from November 30, 2018

Haskell: parse error on input ‘=’ in where

Image
up vote 3 down vote favorite I am new in Haskell and practicing Algorithm in Haskell follow the book "Pearls of Functional Algorithm Design" This is the algo to find the smallest natural number not in a given finite set X of natural numbers import Data.List import Data.Array minfree xs = if null ([0..b-1] \ us) then head ([b..] \ vs) else head ([0..b-1] \ us) where (us, vs) = (partition (<b) xs) b = div (length xs) 2 Pff the compiler error like this Prelude Data.Array Data.List> :load 01_the_smallest_free_number.hs [1 of 1] Compiling Main ( 01_the_smallest_free_number.hs, interpreted ) 01_the_smallest_free_number.hs:11:29: error: parse error on input ‘=’ Perhaps you need a 'let' in a 'do' block? e.g. 'let x = 5' instead of 'x = 5' | 11 | b = div (length xs) 2 | ^ Failed, no modules loaded. Well obveriously add let before b is not the right answer I've tried. Then I replaced all b to div (length xs) 2 that work...

高麗航空

Image
高丽航空 고려항공 / 高麗航空 IATA JS ICAO KOR 呼号 AIR KORYO 創立於 1955年9月21日 營運基地 平壤順安國際機場 机队数量 19 通航城市 26 总部   朝鲜平壤 网站 www.airkoryo.com.kp (朝鲜语、英文、简体中文) 高麗航空機組員 高丽航空旧版登機證 朝鮮高麗航空商社 (韓語: 고려항공 / 高麗航空 , 英语: Air Koryo )是朝鮮民主主義人民共...