libs: more cleanup

locals-and-roots
Doug Coleman 2016-06-20 15:38:40 -07:00
parent 0c170345af
commit 9bfdf92105
4 changed files with 11 additions and 11 deletions

View File

@ -110,11 +110,11 @@ defer: (read-json-string)
{
{ char: \" [ over read-json-string suffix! ] }
{ char: \[ [ json-open-array ] }
{ char: , [ v-over-push ] }
{ char: ] [ json-close-array ] }
{ char: \, [ v-over-push ] }
{ char: \] [ json-close-array ] }
{ char: \{ [ json-open-hash ] }
{ char: \: [ v-pick-push ] }
{ char: } [ json-close-hash ] }
{ char: \} [ json-close-hash ] }
{ char: \s [ ] }
{ char: \t [ ] }
{ char: \r [ ] }

View File

@ -114,7 +114,7 @@ M: sequence stream-json-print
char: \[ over stream-write1 swap
over '[ char: , _ stream-write1 ]
pick '[ _ stream-json-print ] interleave
char: ] swap stream-write1 ;
char: \] swap stream-write1 ;
PRIVATE<
@ -131,7 +131,7 @@ M: real json-coerce >float number>string ;
:: json-print-assoc ( obj stream -- )
char: \{ stream stream-write1 obj >alist
[ char: , stream stream-write1 ]
[ char: \, stream stream-write1 ]
json-friendly-keys? get
json-coerce-keys? get '[
first2 [
@ -144,7 +144,7 @@ M: real json-coerce >float number>string ;
stream stream-json-print
] bi*
] interleave
char: } stream stream-write1 ;
char: \} stream stream-write1 ;
PRIVATE>

View File

@ -74,11 +74,11 @@ in: math.extras.test
{ 17/160 } [ { 80 60 10 20 30 } normalized-herfindahl ] unit-test
{ { 0 5 1 2 2 } } [
{ -10 10 2 2.5 3 } { 1 2 3 4 5 } digitize]
{ -10 10 2 2.5 3 } { 1 2 3 4 5 } digitize-left
] unit-test
{ { 0 5 2 2 3 } } [
{ -10 10 2 2.5 3 } { 1 2 3 4 5 } digitize)
{ -10 10 2 2.5 3 } { 1 2 3 4 5 } digitize-right
] unit-test
{

View File

@ -204,10 +204,10 @@ PRIVATE>
: unique-indices ( seq -- unique indices )
[ members ] keep over dup length iota H{ } zip-as '[ _ at ] map ;
: digitize] ( seq bins -- seq' )
: digitize-left ( seq bins -- seq' )
'[ _ bisect-left ] map ;
: digitize) ( seq bins -- seq' )
: digitize-right ( seq bins -- seq' )
'[ _ bisect-right ] map ;
PRIVATE<
@ -218,7 +218,7 @@ PRIVATE<
PRIVATE>
: linspace[a,b) ( a b length -- seq )
steps ,b) <range> ;
steps (,b) <range> ;
: linspace[a,b] ( a b length -- seq )
{