バイナリクロック
Posted feedbacks - Smalltalk
Squeak Smalltalk で。
1 2 3 4 5 6 7 8 | {Time now print24. String streamContents: [:ss |
(Time now print24 subStrings: ':')
do: [:each | ss nextPutAll: (
((each asInteger radix: 2) forceTo: 7 paddingStartWith: $0)
translateWith: ({$0 asciiValue + 1 -> $□. $1 asciiValue + 1 -> $■} as: Dictionary))]
separatedBy: [ss space]]}
"=> #('22:50:58' '□□■□■■□ □■■□□■□ □■■■□■□') "
|


lunlumo #9282() [ Ruby ] Rating6/8=0.75
20:18の場合,例えば以下の様な出力をするイメージです。
出力例:
■□■□□
□■□□■□
see: Binary Clock Widget
Rating6/8=0.75-0+
[ reply ]