在阅读Windows研究内核的内存管理代码时,我对工作集的概念感到困惑.
我在阅读Windows Research Kernel(WRK) 1.2中的源代码时遇到了这个预处理器定义:
#define assert(exp) ((void) 0)
Run Code Online (Sandbox Code Playgroud)
这段代码有什么作用?为什么定义?
我刚刚开始教自己Haskell出自"为了好的方面了解你一个好的东西"一书,我在第5章中使用where
以下内容重写了快速排序:
quicksort :: (Ord a) => [a] -> [a]
quicksort [] = []
quicksort (x:xs) = smaller ++ [x] ++ bigger
where smaller = quicksort [a | a <- xs, a <= x]
bigger = quicksort [a |a <- xs, a > x]
Run Code Online (Sandbox Code Playgroud)
但是当我将它加载到GHCi 7.0.3中时,我收到以下错误:
parse error on input '='
Run Code Online (Sandbox Code Playgroud)
书上的原始代码:
quicksort :: (Ord a) => [a] -> [a]
quicksort [] = []
quicksort (x:xs) =
let smallerSorted = quicksort [a | a <- xs, a <= x] …
Run Code Online (Sandbox Code Playgroud)