Upcoming SlideShare
×

# TDDBC お題

5,850

Published on

TDDBC のお題です

10 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total Views
5,850
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
49
0
Likes
10
Embeds 0
No embeds

No notes for slide

### TDDBC お題

1. 1. Write a program that prints the numbers from 1 to 100. But formultiples of three print “Fizz” instead of the number and for themultiples of ﬁve print “Buzz”. For numbers which are multiples ofboth three and ﬁve print “FizzBuzz”.1 1003 Fizz 5 Buzz 3 5 FizzBuzz http://tickletux.wordpress.com/2007/01/24/using-ﬁzzbuzz-to-ﬁnd-developers-who-grok-coding/ http://www.aoky.net/articles/jeff_atwood/why_cant_programmers_program.htm
2. 2. http://www.cs.is.saga-u.ac.jp/~nakayama07/sotsuken.html
3. 3. Map Last Recently Used (LRU) Cache Map
4. 4. #lru.put(“a”, “dataA”);lru.put(“b”, “dataB”);lru.put(“c”, “dataC”);lru.get(“a”); #=> null# getlru.put(“a”, “dataA”);lru.put(“b”, “dataB”);lru.get(“a”); #=> “dataA”lru.put(“c”, “dataC”);lru.get(“b”); #=> null
5. 5. LRU Cache ?( …)
6. 6. LRU Cache ?( …)
7. 7. LRU Cache( …)
8. 8. s = FileStore.news.set(“foo”, “hoge”)s.get(“foo”) #=> “hoge”s.dump #=> “foo:hoge¥n”s.set(“bar”, “fuga”)s.dump #=> “foo:hoge¥nbar:fuga¥n”s.get(“toto”) #=> nils.set(nil, “momo”) # nils.set(“”, “gogo”) #s.dump #=> “foo:hoge¥nbar:fuga¥n”s.set(“foo”, “piyo”)s.dump #=> “bar:fuga¥nfoo:piyo¥n”
9. 9. FileStore ? ( …)void : set_multi(Map)Map : get_multi(Array)s.set_multi({‘foo’ => ‘hoge’, ‘bar’ => ‘fuga’})s.get_multi([‘foo’, ‘bar’, ‘baz’]) #=> {‘foo’ => ‘hoge’, ‘bar’ => ‘fuga’}
10. 10. FileStore ? ( …)s.set(“foo”, “\${now}”) #=> \${now}s.get(“foo”) #=> “2010-07-10 14:19:12”
11. 11. FileStore ( …)set(key, val, second) ( )set(key, val, Time) ( )
12. 12. # 1s.set_multi({‘foo’ => ‘hoge’, ‘bar’ => ‘fuga’})s.get_multi([‘foo’, ‘bar’, ‘baz’]) #=> {‘foo’ => ‘hoge’, ‘bar’ => ‘fuga’}# 2s.set(“foo”, “\${now}”) #=> \${now}s.get(“foo”) #=> “2010-07-10 14:19:12” #=> dump ?# 3set(key, val, second=nil) ( )set(key, val, Time=nil) ( )
13. 13. FileStore( …)
14. 14. #“ : ”ﬁlter = WordFilter.new(‘Arsenal’)# detect #=> true/falseﬁlter.detect(“t_wada: Arsenal vs Chelsea !”) #=> true;ﬁlter.detect(“t_wada: ManU vs Liverpool ”) #=> false;# censor #=> Stringﬁlter.censor(“t_wada: Arsenal vs Chelsea !”) #=> “t_wada: <censored> vs Chelsea !”
15. 15. WordFilter ?( …) NG
16. 16. WordFilter ? … ( …) <censored>…
17. 17. WordFilter ? … ( …) <censored>…
18. 18. WordFilter ?( …) ( )
19. 19. WordFilter( …)