Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the jp-numeral Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 04:54:52 2022 GMT+0.
Next: Systems, Previous: The jp-numeral Reference Manual, Up: The jp-numeral Reference Manual [Contents][Index]
Common Lisp で漢数字を出すというネタパッケージ。cl:format
との統合も可能。
This is a fun package for printing numbers as Japanese numerals. This
can be integrated with cl:format
.
The MIT License. See LICENSE file.
(ql:quickload "jp-numeral")
(asdf:load-asd "jp-numeral.asd")
(asdf:load-system :jp-numeral)
For running tests, do below additionally.
(asdf:load-asd "jp-numeral-test.asd")
(asdf:test-system :jp-numeral)
CL-USER> (format nil "~/jp-numeral:jp/" 12345687890)
"百二十三億四千五百六十八万七千八百九十"
CL-USER> (format nil "~/jp-numeral:jp/" 123/4567)
"四千五百六十七分の百二十三"
CL-USER> (format nil "~/jp-numeral:jp/" -0.0245)
"マイナス二厘四毛五糸"
割合として。
Puts as a rate (using 割).
CL-USER> (format nil "~/jp-numeral:wari/" 0.123)
"一割二分三厘"
円として。
Puts as yen (円).
CL-USER> (format nil "~/jp-numeral:yen/" 12000.67)
"一万二千円六十七銭"
:
修飾子を使用する。
Use :
modifier.
CL-USER> (format nil "~:/jp-numeral:jp/" 12345687890)
"壱百弐拾参億四千五百六拾八万七千八百九拾"
大字で割合として。
Puts as a formal rate.
CL-USER> (format nil "~:/jp-numeral:wari/" 0.123)
"壱割弐分参厘"
大字で円として。
Puts as a formal yen.
CL-USER> (format nil "~:/jp-numeral:yen/" 12000.67)
"壱万弐千円六拾七銭"
@
修飾子を使用する。
Use @
modifier.
CL-USER> (format nil "~@/jp-numeral:jp/" 12345687890)
"壹佰貳拾參億肆仟伍佰陸拾捌萬柒仟捌佰玖拾"
旧字体で割合として
Puts as a rate with old glyphs.
CL-USER> (format nil "~
Next: Modules, Previous: Introduction, Up: The jp-numeral Reference Manual [Contents][Index]
The main system appears first, followed by any subsystem dependency.
A printer for Japanese numerals.
YOKOTA Yuki <y2q.actionman@gmail.com>
MIT
src (module).
Next: Files, Previous: Systems, Up: The jp-numeral Reference Manual [Contents][Index]
Modules are listed depth-first from the system components tree.
jp-numeral (system).
Next: Packages, Previous: Modules, Up: The jp-numeral Reference Manual [Contents][Index]
Files are sorted by type and then listed depth-first from the systems components trees.
Next: jp-numeral/src/package.lisp, Previous: Lisp, Up: Lisp [Contents][Index]
jp-numeral (system).
Next: jp-numeral/src/jp-numeral-table.lisp, Previous: jp-numeral/jp-numeral.asd, Up: Lisp [Contents][Index]
src (module).
Next: jp-numeral/src/jp-numeral.lisp, Previous: jp-numeral/src/package.lisp, Up: Lisp [Contents][Index]
package.lisp (file).
src (module).
Previous: jp-numeral/src/jp-numeral-table.lisp, Up: Lisp [Contents][Index]
jp-numeral-table.lisp (file).
src (module).
Next: Definitions, Previous: Files, Up: The jp-numeral Reference Manual [Contents][Index]
Packages are listed by definition order.
common-lisp.
Next: Indexes, Previous: Packages, Up: The jp-numeral Reference Manual [Contents][Index]
Definitions are sorted by export status, category, package, and then by lexicographic order.
Next: Internals, Previous: Definitions, Up: Definitions [Contents][Index]
Previous: Public Interface, Up: Public Interface [Contents][Index]
This function works same as ‘jp’, but arranges the arguments for
convenience of calling from ordinary functions.
This writes OBJECT into STREAM as Japanese numerals with the style
specified by STYLE.
Arguments are same as ‘jp’, except below:
- STYLE
Specify the style of output. Pass one of these symbols:
- ‘:normal’ :: Use normal Japanese numerals.
- ‘:formal’ :: Use formal styles.
- ‘:old’ :: Use old glyphs.
- ‘:positional’ :: Use positional notations.
====
‘jp’ と同じことを行うが、普通の関数として呼び出すのに便利なように
引数を置きかえている。
STYLE で指定した形式で、 STREAM に OBJECT を書き出す。
以下の引数以外は、‘jp’ の引数と同様。
- STYLE
出力形式を指定する。以下のいずれかのシンボルを渡す。
- ‘:normal’ :: 一般的な漢数字を使用する。
- ‘:formal’ :: 大字を使用する。
- ‘:old’ :: 旧字体を使用する。
- ‘:positional’ :: 位取り記数法を使用する。
This function writes OBJECT into STREAM as Japanese numerals.
This can be called from ‘cl:format’ with ’~/’ directive.
Arguments are:
- STREAM
Output destination stream.
- OBJECT
The object to be outputted.
- COLON-P, AT-SIGN-P
COLON-P and AT-SIGN-P specify the style for printing.
The corresponding is below:
- (and (not colon-p) (not at-sign-p)) :: Use normal Japanese numerals.
- (and colon-p (not at-sign-p)) :: Use formal styles.
- (and (not colon-p) at-sign-p) :: Use Old glyphs.
- (and colon-p at-sign-p) :: Use positional Notation.
- DIGITS-AFTER-DOT
Specifies how many digits putted after the radix point when
printing a floating-point number.
When ‘nil’ is specified, uses an appropriate one.
- SCALE
When printing, uses a number mutiplied with (expt 10 scale).
- RADIX-POINT
Specifies a character or a string used as a radix point.
====
STREAM に OBJECT を漢数字として書き出す。
‘cl:format’ の ‘~/‘ での関数呼びだしでも使用できる。
引数:
- STREAM
出力先の stream
- OBJECT
出力する object
- COLON-P, AT-SIGN-P
二つの組み合わせで出力形式を指定する。対応は以下の通り:
- (and (not colon-p) (not at-sign-p)) :: 通常の漢数字
- (and colon-p (not at-sign-p)) :: 大字
- (and (not colon-p) at-sign-p) :: 旧字体
- (and colon-p at-sign-p) :: 位取り記数法
- DIGITS-AFTER-DOT
浮動小数点数を出力する時に、小数点の後に何桁目まで出力するか。
‘nil’ にすると、適当に十分な数で出す。
- SCALE
出力の時に、 (expt 10 scale) を掛けた値を出力する。
- RADIX-POINT
小数点に使用する、文字もしくは文字列。
This function works like ‘jp’, but puts as a rate.
The output value is multiplied with 10, and ’割’ is used for the radix point.
Arguments are same as ‘jp’.
====
‘jp’ と同様だが、 割合として表示する。
10倍され、小数点に ’割’ を使用した値が表示される。
引数は ‘jp’ と同様。
This function works like ‘jp’, but puts as a yen.
The output value is rounded on specified position, and printed until
‘1’ with ’円’, until ‘0.01’ with ’銭’, and until ‘0.001’ with ’厘’.
Arguments are same as ‘jp’, except below:
- DIGITS-AFTER-DOT
Specifies how many digits putted after a radix point. The default is 2.
Only one of ‘0‘, ‘2‘, or ‘3‘ is available.
====
‘jp’ と同様だが、 円として表示する。
指定した桁で丸め、 ‘1’ の桁までは ’円’ で、 ‘0.01’ の桁までは ’銭’ で、 ‘0.001’ の桁は ’厘’ で表示する。
以下の引数以外は、‘jp’ の引数と同様。
- DIGITS-AFTER-DOT
小数点以下のどの桁まで表示するか指定する。デフォルトは 2。
‘0‘ , ‘2‘ , ‘3‘ のいずれかが使用できる。
Previous: Public Interface, Up: Definitions [Contents][Index]
Next: Ordinary functions, Previous: Internals, Up: Internals [Contents][Index]
A vector of (<normal> <formal> <old> <positional>)
A vector of (<normal> <formal> <old> <positional>
A vector of (<normal> <formal> <old> <positional>
An alist of (<power> . (<normal> <formal> <old> <positional>))
A vector of (<normal> <formal> <old> <positional>
A vector of (<normal> <formal> <old> <positional>
A vector of (<normal> <formal> <old> <positional>
A vector of (<normal> <formal> <old> <positional>
Next: Generic functions, Previous: Constants, Up: Internals [Contents][Index]
Next: Conditions, Previous: Ordinary functions, Up: Internals [Contents][Index]
Previous: Definitions, Up: The jp-numeral Reference Manual [Contents][Index]
Jump to: | F G J M P S T W Y |
---|
Jump to: | F G J M P S T W Y |
---|
Next: Data types, Previous: Functions, Up: Indexes [Contents][Index]
Jump to: | +
C |
---|
Jump to: | +
C |
---|
Jump to: | C F J M N P S |
---|
Jump to: | C F J M N P S |
---|