ghci

    1熱度

    2回答

    我試圖穿過Haskell stardard庫的Data.List函數,並在嘗試「排列組合」時出錯。我在這裏錯過了什麼?謝謝。 Prelude> map (\b-> b*b) [1,2,3] [1,4,9] Prelude> permutations "abc" <interactive>:1:0: Not in scope: `permutations'

    1熱度

    1回答

    我得到的錯誤「不在範圍:X」的時候做然而,如下... blanks :: Sudoku -> [Pos] blanks (Sudoku su) = [ fst x | x <- posSud | isBlank (snd x) ] where isBlank Nothing = True isBlank _ = False posSud = z

    5熱度

    3回答

    我正在嘗試編寫一個改變Sudoku的道具,然後檢查它是否仍然有效。 但是,我不知道如何正確使用「oneof」功能。你能給我一些提示嗎? prop_candidates :: Sudoku -> Bool prop_candidates su = isSudoku newSu && isOkay newSu where newSu = update su aBlank aC

    10熱度

    1回答

    我使用Ctrl p很多,而不是向上箭頭在終端上。如何使ghci支持Ctrl p上去? 我使用ghc98從端口ghci。 Mac OS X 10.5.8。

    3熱度

    1回答

    我在Haskell中定義了一個Tree數據類型,並且在關聯的'size'方法中計算了樹中元素的個數。在此之前的工作,但是我已經更新爲使用命名字段爲如下定義的樹數據類型: data Tree a = Empty | Leaf {value::a} | Node {left :: (Tree a), value :: a, right :: (Tree a)} deriving (Eq, Ord

    0熱度

    1回答

    我試圖從Learn You a Haskell for Great Good編譯此功能。 removeNonUppercase st = [ c | c <- st, c `elem` ['A'..'Z']] 將其放入removeNonUpperCase.hs文件中。 它編譯罰款,但經過論證時: ghci> removeNonUppercase "Hahaha! Ahahaha!" 編譯器