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
  • ...<code>Bool</code>, for instance. Then a function of type <code>(t -> r) -> r</code>, is like a box which takes a question about a value of type <code>t< newtype Cont r t = Cont ((t -> r) -> r)
    7 KB (1,253 words) - 23:34, 25 June 2021
  • cbalTree n = let (q, r) = (n - 1) `quotRem` 2 in [Branch 'x' left right | i <- [q .. q + r],
    4 KB (694 words) - 01:23, 7 June 2021
  • range l r = scanl (+) l (replicate (l - r) 1) range l r = scanl op l $ replicate diff 1
    1 KB (214 words) - 02:08, 5 April 2014
  • removeAt k (x:xs) = let (a, r) = removeAt (k - 1) xs in (a, x:r) removeAt n (x:xs) = (l, x:r)
    2 KB (340 words) - 11:56, 26 April 2016
  • where (l, t', r) = layoutAux x1 1 t layoutAux x y (Branch a l r) = (ll', Branch (a, (x,y)) l' r', rr')
    4 KB (637 words) - 03:42, 10 January 2017
  • ...internals' (Branch x l r) xs = (x :) $ internals' l $ internals' r xs
    717 bytes (98 words) - 13:39, 25 December 2016
  • ...this string representation, if the tree is given as usual (as nil or t(X,L,R) term). Then write a predicate which does this inverse; i.e. given the stri treeToString (Branch x l r) =
    2 KB (372 words) - 03:43, 10 January 2017
  • ...20). Below, I set up the array <hask>r</hask> for exactly that, with <hask>r!0</hask> forced to <hask>True</hask> to bootstrap the whole thing. buyable n = r!n
    6 KB (929 words) - 06:42, 21 November 2020
  • <br /><hask>u :: Empty -> r</hask> <br /><hask>u :: r -> ()</hask>
    7 KB (1,086 words) - 10:33, 9 March 2023
  • symmetric (Branch _ l r) = mirror l r
    1 KB (179 words) - 13:36, 25 December 2016
  • ...en2 -bg '#324c80' -fg '#adbadd' -e '' -ta l -w 400 -fn '-misc-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*'" ...| dzen2 -e '' -x 400 -w 880 -ta r -fg $FG -bg $BG -fn '-misc-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*' &
    2 KB (236 words) - 00:49, 27 January 2018
  • Left l, Right r -> l + r ModDur (Tempo r) d -> d / r
    3 KB (470 words) - 23:09, 11 July 2021
  • filled (Branch _ l r) = [True] : zipWith (++) (filled l) (filled r)... (r, xss'') = cbt xss'
    9 KB (727 words) - 03:41, 10 January 2017
  • foldr (\p r -> p*p > n || ((n `rem` p) /= 0 && r)) | r == 0 = p : go q ps
    4 KB (605 words) - 17:09, 18 July 2022
  • uncompress t x = let (r,_) = runState (bar t) x in r do r <- baz
    8 KB (1,072 words) - 18:32, 16 January 2017
  • countNodes (Branch _ l r) = countNodes l + countNodes r + 1 baltree h n = [Branch x l r |
    3 KB (407 words) - 13:38, 25 December 2016
  • where rand = do r <- randomRIO (0, (length xs) - 1) return (xs!!r)
    4 KB (666 words) - 13:03, 10 May 2014
  • r x = fromJust . find ((== x) . snd) $ t putStrLn . unwords . map fst . head . sort . map (sort . map r) . sol $ n
    1 KB (177 words) - 22:56, 5 April 2021
  • class Resturi r where x :: r -> r
    4 KB (586 words) - 15:17, 6 February 2021
  • ...ient function phi(m) is defined as the number of positive integers r (1 <= r < m) that are coprime to m.
    1 KB (224 words) - 19:44, 18 January 2014
  • ...bject <math>A</math> of <math>\mathcal{C}</math> to <math>R^{\mathcal{C}(A,R)}</math> corresponding to the CPS monad in Haskell.
    3 KB (547 words) - 07:53, 16 April 2019
  • tree2ds (Branch x l r) = x:(tree2ds l ++ tree2ds r)
    3 KB (285 words) - 03:44, 10 January 2017
  • | y == x = let (f,r) = getReps ys in (y:f, r)
    2 KB (347 words) - 21:03, 20 December 2018
  • rec p <- newIORef (Node 0 r) r <- newIORef (Node 1 p)
    10 KB (1,757 words) - 23:34, 24 July 2021
  • newtype ContT r m a ...type <hask>a</hask> and a final result of type <hask>r</hask>. The <hask>r</hask> type can be polymorphic most of the time. You only need to specify
    12 KB (2,067 words) - 05:43, 9 March 2021
  • *<code>C-c C-r</code> reload current Haskell interpreter session ...>C-c C-l</code> to load the file. Then, you can go on to type <code>C-c C-r</code> (or simply <code>C-c C-l</code> again) to reload the current module
    2 KB (358 words) - 18:22, 11 April 2016
  • ChurchList { runList :: forall r. (a -> r -> r) -> r -> r }
    4 KB (693 words) - 13:33, 15 April 2024
  • f :: forall %r. () -> () -> Int %r Remember that the <hask>forall %r</hask> at the front of the type is supposed to indicate that the return val
    3 KB (472 words) - 04:20, 8 June 2023
  • instance ParseTree ('Down c ': 'Up ': r) ('Node c '[]) r instance ParseForest ('Down d ': is) (t ': ts) r
    7 KB (1,025 words) - 02:14, 23 July 2021
  • = do r <- getStdRandom (randomR (1,prob)) let curr' = if r == 1 then orig else (next:curr)
    6 KB (855 words) - 12:54, 26 June 2017

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