From d43a1eef0bd379abdfbe1e4b1e12e2c0a515623b Mon Sep 17 00:00:00 2001 From: John Kerl Date: Thu, 7 May 2015 19:22:23 -0700 Subject: [PATCH] to-do's and style neatens --- c/mapping/mapper_sort.c | 13 ++++ c/todo.txt | 16 +++-- c/tools/gen-squares.c | 35 ++++++++++ doc/build.html | 16 ++++- doc/contact.html | 16 ++++- doc/content-for-file-formats.html | 3 +- doc/css/miller.css | 10 ++- doc/data-examples.html | 25 ++++++-- doc/etymology.html | 16 ++++- doc/feature-comparison.html | 25 ++++++-- doc/file-formats.html | 32 ++++++++-- doc/index.html | 16 ++++- doc/originality.html | 16 ++++- doc/performance.html | 31 +++++++-- doc/record-heterogeneity.html | 28 ++++++-- doc/reference.html | 103 +++++++++++++++++++++--------- doc/template.html | 16 ++++- doc/to-do.html | 16 ++++- doc/whyc.html | 37 ++++++++--- 19 files changed, 391 insertions(+), 79 deletions(-) diff --git a/c/mapping/mapper_sort.c b/c/mapping/mapper_sort.c index 368b7ea58..710f2c3ec 100644 --- a/c/mapping/mapper_sort.c +++ b/c/mapping/mapper_sort.c @@ -31,6 +31,19 @@ sllv_t* mapper_sort_func(lrec_t* pinrec, context_t* pctx, void* pvstate) { plist = sllv_alloc(); sllv_add(plist, pinrec); lhmslv_put(pstate->precords_by_key_field_names, slls_copy(pkey_field_values), plist); + // need num/lex & +/- flags for the sort -- static context for the non-reentrant qsort + // 'v' payload should be a pair of: + // * union of double & char*: here do the sscanf of the double if doing numeric sort on that field || abend + // * record-list as now + // at the end make an array of the pairs and qsort them on the union part + // then emit the record-lists as now + // + // before doing that, do the num/lex & the +/- at the CLI interface & handle (inefficiently) + // via repeated sscanf in the comparator: + // -rn a,b -fn c,d,e -r f,g -f h,i,j,k -- OR-- + // -nr a,b -nf c,d,e -r f,g -f h,i,j,k + // + // data structure down there: sllv of sort info which is triple of char* field_name, char do_num, char do_rev. } else { sllv_add(plist, pinrec); } diff --git a/c/todo.txt b/c/todo.txt index df745b64c..4662a8ac2 100644 --- a/c/todo.txt +++ b/c/todo.txt @@ -1,15 +1,20 @@ +================================================================ +! BUGFIX ! + +--ofmt ignored in put. perhaps best to reglobalize. + ================================================================ FEATURES !! sort -nr !! !! quantiles !! +!! reminder pgr legend is broken !! http://en.wikipedia.org/wiki/Order_statistic_tree -* stats1 mode +* stats1 mode: lhmsi & then sort. what about "1"=="1.0"? ! mod op!! (c-like, or sane) and put into wikidoc if so. * sub function. e.g. "300ms" -> "300" -* online help: have a categorized function lister -- by string/math or arity, or some such ... -* nidx feature: bulk rename cols 1,2,3,4,5 this,that,something,foo,bar -* feature: ordered cut (a la reorder) -* impl mlr check: no output +* bulk rename cols 1,2,3,4,5 this,that,something,foo,bar +* ordered cut (a la reorder). either a new command (yeck) or cut option (e.g. cut -o) +* impl/doc mlr check: no output * linreq-quality 2nd pass -- code it up in stats2 w/ -m {m} -b {b} -- ? ================================================================ @@ -30,6 +35,7 @@ NEATEN ONLINE HELP * then-chaining note into mlr online help * jko mlrdoc & gh/jk/mlr urls into mlr online help +* put/filter: have a categorized function lister -- by string/math or arity, or some such ... ================================================================ IMPROVEMENTS diff --git a/c/tools/gen-squares.c b/c/tools/gen-squares.c index 38eba8a3f..b1c440f37 100755 --- a/c/tools/gen-squares.c +++ b/c/tools/gen-squares.c @@ -47,6 +47,8 @@ static void usage(char* argv0) { int main(int argc, char** argv) { double chomp = 0.5; int n = 100000; + int mash_x = 0; + int mash_y = 0; if (argc == 2) { if (sscanf(argv[1], "%lf", &chomp) != 1) usage(argv[0]); @@ -55,6 +57,15 @@ int main(int argc, char** argv) { usage(argv[0]); if (sscanf(argv[2], "%d", &n) != 1) usage(argv[0]); + } else if (argc == 5) { + if (sscanf(argv[1], "%lf", &chomp) != 1) + usage(argv[0]); + if (sscanf(argv[2], "%d", &n) != 1) + usage(argv[0]); + if (sscanf(argv[3], "%d", &mash_x) != 1) + usage(argv[0]); + if (sscanf(argv[4], "%d", &mash_y) != 1) + usage(argv[0]); } else { usage(argv[0]); } @@ -67,6 +78,18 @@ int main(int argc, char** argv) { double x = (double)rand() / (double)RAND_MAX; double y = (double)rand() / (double)RAND_MAX; if ((x < lo && y < lo) || (x > hi && y > hi)) { + if (mash_x) { + if (x < lo) + x = 0.0; + else + x = 1.0; + } + if (mash_y) { + if (y < lo) + y = 0.0; + else + y = 1.0; + } i++; printf("x=%.18lf,y=%.18lf\n", x, y); } @@ -78,6 +101,18 @@ int main(int argc, char** argv) { double x = (double)rand() / (double)RAND_MAX; double y = (double)rand() / (double)RAND_MAX; if ((x < lo && y > hi) || (x > hi && y < lo)) { + if (mash_x) { + if (x < lo) + x = 0.0; + else + x = 1.0; + } + if (mash_y) { + if (y < lo) + y = 0.0; + else + y = 1.0; + } i++; printf("x=%.18lf,y=%.18lf\n", x, y); } diff --git a/doc/build.html b/doc/build.html index 3fd11fc7d..790efe5e3 100644 --- a/doc/build.html +++ b/doc/build.html @@ -21,7 +21,21 @@ document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga. try { var pageTracker = _gat._getTracker("UA-15651652-1"); pageTracker._trackPageview(); -} catch(err) {} +} catch(err) {} + + + -

I/O options

+

I/O options

+ -

Formats

+

Formats

+

Options:

@@ -306,7 +325,8 @@ wye pan 5  0.5732889198020006  0.8636244699032729
 
 
 
-

Record/field/pair separators

+

Record/field/pair separators

+

Miller has record separators IRS and ORS, field separators IFS and OFS, and pair separators IPS and OPS. For example, in the DKVP line a=1,b=2,c=3, the record @@ -345,7 +365,8 @@ may use the symbolic names newline, space, tab, -

Number formatting

+

Number formatting

+ Options:
   --ofmt {format string}
@@ -370,9 +391,11 @@ embedded whitespace, which may not be what you want if you pipe the output to
 something else.
 
 
-

Data transformations

+

Data transformations

+ -

cat

+

cat

+

Most useful for format conversions (see File formats), and concatenating multiple same-schema CSV files to have the same header: @@ -432,7 +455,8 @@ c 9 -

count-distinct

+

count-distinct

+

@@ -479,7 +503,8 @@ a=zee,b=wye,count=455
 

-

cut

+

cut

+

@@ -526,7 +551,8 @@ i x                   y
 
 

-

filter

+

filter

+

@@ -610,7 +636,8 @@ x_y_corr
 
 
 
-

group-by

+

group-by

+

@@ -670,7 +697,8 @@ they were encountered in the data stream, which in some cases may be more intere
 to you.
 
 
-

group-like

+

group-like

+

@@ -717,7 +745,8 @@ record_count resource
 
 
 
-

having-fields

+

having-fields

+

@@ -772,7 +801,8 @@ resource=/some/other/path,loadsec=0.97,ok=false
 
 
 
-

head

+

head

+

@@ -818,7 +848,8 @@ wye hat 24 0.7286126830627567  0.19441962592638418
 
 
 
-

histogram

+

histogram

+

@@ -859,7 +890,8 @@ bin_lo   bin_hi   x_count x2_count x3_count
 

-

put

+

put

+

@@ -917,7 +949,8 @@ pan zee 10003 0.272054845593895200 0.425789896597056627 5  10 5   2       data/s
 

-

rename

+

rename

+

@@ -992,7 +1025,8 @@ a=wye,b=pan,i=5,x=0.5732889198020006,COLUMN5=0.8636244699032729
 
 
 
-

reorder

+

reorder

+

@@ -1055,7 +1089,8 @@ wye 0.5732889198020006  0.8636244699032729  5 pan
 
 
 
-

sort

+

sort

+

@@ -1068,7 +1103,8 @@ Usage: mlr sort {comma-separated field names}
 

xxx write up after -n/-r. -

stats1

+

stats1

+

@@ -1116,7 +1152,8 @@ zee 0.504242 0.502997
 
 
 
-

stats2

+

stats2

+

@@ -1202,7 +1239,8 @@ plotting; here’s a screenshot.
 

(Thanks Drew Kunas for a good conversation about PCA!) -

step

+

step

+

@@ -1270,7 +1308,8 @@ eks zee 14    0.5207382318405251     0.34141681118811673    0.029221  2.764119
 
 
 
-

tac

+

tac

+

@@ -1333,7 +1372,8 @@ a b c filename
 
 
 
-

tail

+

tail

+

@@ -1375,7 +1415,8 @@ yellow triangle 1    99999  0.5369350176939407 0.5197619334387739 0.506446844647
 
 
 
-

top

+

top

+

@@ -1430,7 +1471,8 @@ zee 2       0.999438
 
 
 
-

uniq

+

uniq

+

@@ -1507,7 +1549,8 @@ yellow triangle 4667
 
 
 
-

Functions for filter and put

+

Functions for filter and put

+ Miller’s
filter and put support the following operators and functions: diff --git a/doc/template.html b/doc/template.html index d495df677..9c1be009d 100644 --- a/doc/template.html +++ b/doc/template.html @@ -19,7 +19,21 @@ document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga. try { var pageTracker = _gat._getTracker("UA-15651652-1"); pageTracker._trackPageview(); -} catch(err) {} +} catch(err) {} + + +