Search results

Jump to navigation Jump to search
  • instance (Applicative m) => Applicative (ReaderT r m) where ... instance (Alternative m) => Alternative (ReaderT r m) where ...
    3 KB (378 words) - 15:19, 6 February 2021
  • countLeaves (Branch _ l r) = countLeaves l + countLeaves r
    331 bytes (43 words) - 13:38, 25 December 2016
  • foldl :: (a -> x -> r) -> a -> [x] -> r foldl :: (a -> x -> r) -> a -> [x] -> r
    5 KB (891 words) - 14:21, 3 January 2018
  • atLevel (Branch v l r) n | n > 1 = atlevel l (n-1) ++ atlevel r (n-1)
    741 bytes (125 words) - 13:40, 25 December 2016
  • go mgu (Var l) r | not (r `contains` Var l) = Just $ (l, r) : mgu go mgu l (Var r) | not (l `contains` Var r) = Just $ (r, l) : mgu
    2 KB (410 words) - 11:26, 13 February 2019
  • layoutAux x y sep (Branch a l r) = (layoutAux (x+sep) (y+1) (sep `div` 2) r)
    2 KB (299 words) - 03:42, 10 January 2017
  • preorder (Branch x l r) = x : preorder l ++ preorder r inorder (Branch x l r) = inorder l ++ x : inorder r
    2 KB (280 words) - 03:43, 10 January 2017
  • So <hask>r = render ["fr", "pt"]</hask> will do the right thing. You just need to pass this <hask>r</hask> around in your code.
    2 KB (354 words) - 03:41, 14 August 2021
  • add x t@(Branch y l r) = case compare x y of LT -> Branch y (add x l) r
    741 bytes (117 words) - 22:03, 23 April 2021
  • <hask>L-T-R</hask> gives * <hask> (show L) ++ (show T ++ (show R)) </hask>
    3 KB (421 words) - 16:40, 1 August 2018
  • f (1, x) r = x : r f (k, x) r = x : f (k-1, x) r
    2 KB (362 words) - 17:33, 13 June 2020
  • f x r a@(Just q) | x == q = r a f x r _ = x : r (Just x)
    3 KB (454 words) - 15:07, 2 October 2020
  • new = fmap (\r -> Cons (writeIORef r) (readIORef r)) . newIORef new = fmap (\r -> Cons (writeSTRef r) (readSTRef r)) . newSTRef
    2 KB (338 words) - 20:04, 13 May 2020
  • Or using the slightly more verbose (w.r.t. <hask>(&&&)</hask>) Applicative combinators: f x r (Just a@(i,q)) | x == q = r (Just (i+1,q))
    3 KB (470 words) - 03:45, 19 May 2021
  • Given a binary tree as the usual Prolog term t(X,L,R) (or nil). As a preparation for drawing the tree, a layout algorithm is req layoutAux x y (Branch a l r) = (Branch (a, (x',y)) l' r', x'')
    2 KB (337 words) - 03:41, 10 January 2017
  • hbaltree x h = [Branch x l r | l <- hbaltree x hl, r <- hbaltree x hr]
    1 KB (215 words) - 13:38, 25 December 2016
  • leaves' (Branch _ l r) xs = leaves' l $ leaves' r xs
    615 bytes (90 words) - 13:39, 25 December 2016
  • insert k v (IMap xs) = insert' $ viewl r (l,r) = split (>= Key k undefined) xs
    2 KB (315 words) - 15:19, 6 February 2021
  • diff_select' n xs = do r <- randomRIO (0,(length xs)-1) let remaining = take r xs ++ drop (r+1) xs
    2 KB (244 words) - 00:09, 7 April 2019
  • reverseTree (Branch x l r) = Branch x (reverseTree r) (reverseTree l)
    666 bytes (91 words) - 13:37, 25 December 2016

View (previous 20 | next 20) (20 | 50 | 100 | 250 | 500)