Merge branch 'master' of git://projects.elasticdog.com/git/factor

db4
Slava Pestov 2008-12-15 22:55:59 -06:00
commit fea0c80542
2 changed files with 12 additions and 12 deletions

View File

@ -1,4 +1,5 @@
USING: definitions help help.markup help.syntax io io.files editors words ;
USING: definitions editors help help.markup help.syntax io io.files
io.pathnames words ;
IN: editors.vim
ARTICLE: { "vim" "vim" } "Vim support"

View File

@ -32,23 +32,22 @@ SYMBOL: and-needed?
0 < "Negative " "" ? ;
: 3digit-groups ( n -- seq )
number>string <reversed> 3 <groups>
[ reverse string>number ] map ;
[ dup 0 > ] [ 1000 /mod ] [ ] produce nip ;
: hundreds-place ( n -- str )
100 /mod swap dup zero? [
100 /mod over 0 = [
2drop ""
] [
small-numbers " Hundred" append
swap zero? [ " and " append ] unless
[ small-numbers " Hundred" append ] dip
0 = [ " and " append ] unless
] if ;
: tens-place ( n -- str )
100 mod dup 20 >= [
10 /mod [ tens ] dip
dup zero? [ drop ] [ "-" swap small-numbers 3append ] if
dup 0 = [ drop ] [ small-numbers "-" glue ] if
] [
dup zero? [ drop "" ] [ small-numbers ] if
dup 0 = [ drop "" ] [ small-numbers ] if
] if ;
: 3digits>text ( n -- str )
@ -59,15 +58,15 @@ SYMBOL: and-needed?
[ " " glue ] unless-empty ;
: append-with-conjunction ( str1 str2 -- newstr )
over length zero? [
over length 0 = [
nip
] [
and-needed? get " and " ", " ? rot 3append
and-needed? off
swap and-needed? get " and " ", " ?
glue and-needed? off
] if ;
: (recombine) ( str index seq -- newstr )
2dup nth zero? [
2dup nth 0 = [
2drop
] [
text-with-scale append-with-conjunction