factor/examples/lcd.factor

19 lines
457 B
Factor
Raw Normal View History

2005-07-22 23:39:28 -04:00
USING: sequences kernel math io ;
2005-02-18 19:09:24 -05:00
: lcd-digit ( digit row -- str )
{
" _ _ _ _ _ _ _ _ "
" | | | _| _| |_| |_ |_ | |_| |_| "
" |_| | |_ _| | _| |_| | |_| | "
2005-07-22 23:39:28 -04:00
} nth >r 4 * dup 4 + r> subseq ;
2005-02-18 19:09:24 -05:00
: lcd-row ( num row -- )
2005-07-22 23:39:28 -04:00
swap [ CHAR: 0 - swap lcd-digit write ] each-with ;
2005-02-18 19:09:24 -05:00
2005-07-22 23:39:28 -04:00
: lcd ( digit-str -- )
2005-02-18 19:09:24 -05:00
3 [ 2dup lcd-row terpri ] repeat drop ;
2005-10-31 20:39:38 -05:00
"31337" lcd
2006-09-06 17:19:41 -04:00
PROVIDE: examples/lcd ;