]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/unicode/data/data.factor
Merge branch 'master' of git://factorcode.org/git/factor
[factor.git] / extra / unicode / data / data.factor
index b1e6fc5f8ba7a1831d7f9fb0f91ec5b51cb3f35b..85ce50acb9585c7c82d950d8d58a911f1e296027 100755 (executable)
@@ -1,6 +1,7 @@
 USING: assocs math kernel sequences io.files hashtables
-quotations splitting arrays math.parser hash2 unicode.syntax.backend
-byte-arrays words namespaces words compiler.units parser io.encodings.ascii  ;
+quotations splitting arrays math.parser hash2 math.order
+byte-arrays words namespaces words compiler.units parser
+io.encodings.ascii unicode.syntax.backend ;
 IN: unicode.data
 
 ! Convenience functions
@@ -17,7 +18,7 @@ IN: unicode.data
 
 : (process-data) ( index data -- newdata )
     [ [ nth ] keep first swap 2array ] with map
-    [ second empty? not ] subset
+    [ second empty? not ] filter
     [ >r hex> r> ] assoc-map ;
 
 : process-data ( index data -- hash )
@@ -40,9 +41,9 @@ IN: unicode.data
     [ " " split [ hex> ] map ] assoc-map ;
 
 : process-canonical ( data -- hash2 hash )
-    (process-decomposed) [ first* ] subset
+    (process-decomposed) [ first* ] filter
     [
-        [ second length 2 = ] subset
+        [ second length 2 = ] filter
         ! using 1009 as the size, the maximum load is 4
         [ first2 first2 rot 3array ] map 1009 alist>hash2
     ] keep
@@ -50,13 +51,13 @@ IN: unicode.data
 
 : process-compat ( data -- hash )
     (process-decomposed)
-    [ dup first* [ first2 1 tail 2array ] unless ] map
+    [ dup first* [ first2 rest 2array ] unless ] map
     >hashtable chain-decomposed ;
 
 : process-combining ( data -- hash )
     3 swap (process-data)
     [ string>number ] assoc-map
-    [ nip zero? not ] assoc-subset
+    [ nip zero? not ] assoc-filter
     >hashtable ;
 
 : categories ( -- names )
@@ -88,7 +89,7 @@ IN: unicode.data
     ] assoc-map >hashtable ;
 
 : multihex ( hexstring -- string )
-    " " split [ hex> ] map [ ] subset ;
+    " " split [ hex> ] map [ ] filter ;
 
 TUPLE: code-point lower title upper ;
 
@@ -120,7 +121,7 @@ VALUE: special-casing
 ! Special casing data
 : load-special-casing ( -- special-casing )
     "extra/unicode/SpecialCasing.txt" resource-path data
-    [ length 5 = ] subset
+    [ length 5 = ] filter
     [ [ set-code-point ] each ] H{ } make-assoc ;
 
 load-data