Arrow
Upcoming SlideShare
Loading in...5
×
 

Arrow

on

  • 2,030 views

 

Statistics

Views

Total Views
2,030
Views on SlideShare
1,838
Embed Views
192

Actions

Likes
1
Downloads
15
Comments
0

2 Embeds 192

http://d.hatena.ne.jp 191
http://www.slideshare.net 1

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Arrow Arrow Presentation Transcript

  • 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
  • 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
  • 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 View slide
  • 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 View slide
  • primes=loop ((snd&&&fst>>>app)&&&f) [2..] f =snd>>>(func-> (head&&&(head&&&tail)) >>>second(first(flip mod>>>(>>>(/=)0)) >>>uncurry filter>>>func)>>>uncurry (:))