Merge branch 'master' of git://factorcode.org/git/factor
commit
8d8f539660
|
@ -3,7 +3,7 @@
|
|||
USING: kernel sequences words fry generic accessors
|
||||
classes.tuple classes classes.algebra definitions
|
||||
stack-checker.state quotations classes.tuple.private math
|
||||
math.partial-dispatch math.private math.intervals
|
||||
math.partial-dispatch math.private math.intervals sets.private
|
||||
math.floats.private math.integers.private layouts math.order
|
||||
vectors hashtables combinators effects generalizations assocs
|
||||
sets combinators.short-circuit sequences.private locals
|
||||
|
@ -290,3 +290,13 @@ CONSTANT: lookup-table-at-max 256
|
|||
] [ drop f ] if ;
|
||||
|
||||
\ at* [ at-quot ] 1 define-partial-eval
|
||||
|
||||
: diff-quot ( seq -- quot: ( seq' -- seq'' ) )
|
||||
tester '[ [ @ not ] filter ] ;
|
||||
|
||||
\ diff [ diff-quot ] 1 define-partial-eval
|
||||
|
||||
: intersect-quot ( seq -- quot: ( seq' -- seq'' ) )
|
||||
tester '[ _ filter ] ;
|
||||
|
||||
\ intersect [ intersect-quot ] 1 define-partial-eval
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2009 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors arrays combinators grouping kernel locals math
|
||||
math.matrices math.order multiline sequence-parser sequences
|
||||
math.matrices math.order multiline sequences.parser sequences
|
||||
tools.continuations ;
|
||||
IN: compression.run-length
|
||||
|
||||
|
|
|
@ -98,6 +98,19 @@ HELP: histogram*
|
|||
}
|
||||
{ $description "Takes an existing hashtable and uses " { $link histogram } " to continue counting the number of occurences of each element." } ;
|
||||
|
||||
HELP: sorted-histogram
|
||||
{ $values
|
||||
{ "seq" sequence }
|
||||
{ "alist" "an array of key/value pairs" }
|
||||
}
|
||||
{ $description "Outputs a " { $link histogram } " of a sequence sorted by number of occurences from lowest to highest." }
|
||||
{ $examples
|
||||
{ $example "USING: prettyprint math.statistics ;"
|
||||
""""abababbbbbbc" sorted-histogram ."""
|
||||
"{ { 99 1 } { 97 3 } { 98 8 } }"
|
||||
}
|
||||
} ;
|
||||
|
||||
HELP: sequence>assoc
|
||||
{ $values
|
||||
{ "seq" sequence } { "quot" quotation } { "exemplar" "an exemplar assoc" }
|
||||
|
@ -145,6 +158,7 @@ ARTICLE: "histogram" "Computing histograms"
|
|||
{ $subsections
|
||||
histogram
|
||||
histogram*
|
||||
sorted-histogram
|
||||
}
|
||||
"Combinators for implementing histogram:"
|
||||
{ $subsections
|
||||
|
|
|
@ -79,6 +79,9 @@ PRIVATE>
|
|||
: histogram ( seq -- hashtable )
|
||||
[ inc-at ] sequence>hashtable ;
|
||||
|
||||
: sorted-histogram ( seq -- alist )
|
||||
histogram >alist sort-values ;
|
||||
|
||||
: collect-values ( seq quot: ( obj hashtable -- ) -- hash )
|
||||
'[ [ dup @ ] dip push-at ] sequence>hashtable ; inline
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
Daniel Ehrenberg
|
||||
Doug Coleman
|
|
@ -1,6 +1,6 @@
|
|||
USING: tools.test sequence-parser unicode.categories kernel
|
||||
accessors ;
|
||||
IN: sequence-parser.tests
|
||||
IN: sequences.parser.tests
|
||||
|
||||
[ "hello" ]
|
||||
[ "hello" [ take-rest ] parse-sequence ] unit-test
|
|
@ -3,7 +3,7 @@
|
|||
USING: accessors circular combinators.short-circuit fry io
|
||||
kernel locals math math.order sequences sorting.functor
|
||||
sorting.slots unicode.categories ;
|
||||
IN: sequence-parser
|
||||
IN: sequences.parser
|
||||
|
||||
TUPLE: sequence-parser sequence n ;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2009 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors c.lexer kernel sequence-parser tools.test ;
|
||||
USING: accessors c.lexer kernel sequences.parser tools.test ;
|
||||
IN: c.lexer.tests
|
||||
|
||||
[ 36 ]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors combinators combinators.short-circuit
|
||||
generalizations kernel locals math.order math.ranges
|
||||
sequence-parser sequences sorting.functor sorting.slots
|
||||
sequences.parser sequences sorting.functor sorting.slots
|
||||
unicode.categories ;
|
||||
IN: c.lexer
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2009 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: sequence-parser io io.encodings.utf8 io.files
|
||||
USING: sequences.parser io io.encodings.utf8 io.files
|
||||
io.streams.string kernel combinators accessors io.pathnames
|
||||
fry sequences arrays locals namespaces io.directories
|
||||
assocs math splitting make unicode.categories
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2008 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors arrays hashtables sequence-parser
|
||||
USING: accessors arrays hashtables sequences.parser
|
||||
html.parser.utils kernel namespaces sequences math
|
||||
unicode.case unicode.categories combinators.short-circuit
|
||||
quoting fry ;
|
||||
|
|
Loading…
Reference in New Issue