fizzbuzz = runKleisli (Kleisli (const [1..100])
   >>>arr(fizz>>>buzz+++buzz
   >>>((show|||const quot;Buzzquot;)
   |||(c...
fizzbuzz = runKleisli (Kleisli (const [1..100])
   >>>arr(fizz>>>buzz+++buzz
   >>>((show|||const quot;Buzzquot;)
   |||(c...
binary n
 | n == 0 = “0”
 | True = loop ((snd&&&fst>>>app)&&&f) n

f = snd>>>(func->cond(0==)
   >>>(const quot;quot;|||((...
binary n
 | n == 0 = quot;0quot;
 | True = loop ((snd&&&fst>>>app)&&&f) n

f (_,func) = proc x ->
  if x == 0 then returnA...
primes=loop
 ((snd&&&fst>>>app)&&&f) [2..]

f =snd>>>(func->
(head&&&(head&&&tail))
  >>>second(first(flip mod>>>(>>>(/=)0...
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Arrow
Upcoming SlideShare
Loading in …5
×

Arrow

1,725 views

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,725
On SlideShare
0
From Embeds
0
Number of Embeds
203
Actions
Shares
0
Downloads
17
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Arrow

  1. 1. fizzbuzz = runKleisli (Kleisli (const [1..100]) >>>arr(fizz>>>buzz+++buzz >>>((show|||const quot;Buzzquot;) |||(const quot;Fizzquot;|||const quot;FizzBuzzquot;)))) () fizz n = cond n 3 buzz n = cond n 5 cond n m = if n `mod` m == 0 then Right n else Left n
  2. 2. fizzbuzz = runKleisli (Kleisli (const [1..100]) >>>arr(fizz>>>buzz+++buzz >>>((show|||const quot;Buzzquot;) |||(const quot;Fizzquot;|||const quot;FizzBuzzquot;)))) () fizz n = cond n 3 buzz n = cond n 5 cond n m = if n `mod` m == 0 then Right n else Left n
  3. 3. binary n | n == 0 = “0” | True = loop ((snd&&&fst>>>app)&&&f) n f = snd>>>(func->cond(0==) >>>(const quot;quot;|||(((flip divMod 2) >>>((func>>>(++))***show))>>>app))) cond f = x -> if f x then Left x else Right x
  4. 4. binary n | n == 0 = quot;0quot; | True = loop ((snd&&&fst>>>app)&&&f) n f (_,func) = proc x -> if x == 0 then returnA -< quot;quot; else do let (y,z) = divMod x 2 returnA -< func y ++ show z
  5. 5. primes=loop ((snd&&&fst>>>app)&&&f) [2..] f =snd>>>(func-> (head&&&(head&&&tail)) >>>second(first(flip mod>>>(>>>(/=)0)) >>>uncurry filter>>>func)>>>uncurry (:))

×