I'm trying to run the following code to get subsets of k-elements but getting variable not in scope:ksubsets Not exactly sure whY?
Code:
subsets :: [a] -> [[a]]
subsets [] = [[]]
subsets (x:xs) = [zs | ys <- subsets xs, zs <- [ys, (x:ys)]]
ksubsets k xs = [ys | ys<-subsets xs, length ys==k]
:rthen useksubsets 3 [1,2,3,4,5]@WillemVanOnsemghciitself, since an:rwill indeed clean the memory, and thus remove the ones not in the file.ghci> :{, then copy-paste your lines, thenghci> :}. (that's multi-line input mode)