ERROR: no-slots-named class seq ;
: check-columns ( class columns -- )
[ nip ] [
- [ [ first ] map ]
+ [ keys ]
[ all-slots [ name>> ] map ] bi* diff
] 2bi
[ drop ] [ no-slots-named ] if-empty ;
} ; inline
: x-bits>hid-bits ( bit-array -- bit-array )
- 256 iota [ 2array ] { } 2map-as [ first ] filter [ second ] map
+ 256 iota [ 2array ] { } 2map-as [ first ] filter values
x>hid-bit-order [ nth ] curry map
256 <bit-array> swap [ t swap pick set-nth ] each ;
"{ 1 2 3 4 } 2 clump ." "{ { 1 2 } { 2 3 } { 3 4 } }"
}
{ $unchecked-example
- "USING: grouping ;"
- "{ 1 2 3 4 } dup" "2 <clumps> unclip-last [ [ first ] map ] dip append sequence= ." "t"
+ "USING: grouping assocs sequences ;"
+ "{ 1 2 3 4 } dup" "2 <clumps> unclip-last [ keys ] dip append sequence= ." "t"
}
}
{ "With circular clumps, collecting the first element of each subsequence yields the original sequence. Collecting the " { $snippet "n" } "th element of each subsequence would rotate the original sequence " { $snippet "n" } " elements rightward:"
"{ 1 2 3 4 } 2 circular-clump ." "{ { 1 2 } { 2 3 } { 3 4 } { 4 1 } }"
}
{ $unchecked-example
- "USING: grouping ;"
- "{ 1 2 3 4 } dup" "2 <circular-clumps> [ first ] map sequence= ." "t"
+ "USING: grouping assocs sequences ;"
+ "{ 1 2 3 4 } dup" "2 <circular-clumps> keys sequence= ." "t"
}
{ $unchecked-example
"USING: grouping ;"
: extract-values ( element -- seq )
\ $values swap elements dup empty? [
- first rest [ first ] map
+ first rest keys
] unless ;
: extract-value-effects ( element -- seq )
utf8 file-lines { "" } split [
[ " " split ] map
[ first { "Name:" "Alias:" } member? ] filter
- [ second ] map { "None" } diff
+ values { "None" } diff
] map harvest ;
: make-aliases ( file -- n>e )
! Copyright (C) 2007-2009 Samuel Tardieu.
! See http://factorcode.org/license.txt for BSD license.
-USING: arrays combinators kernel make math math.functions
+USING: arrays assocs combinators kernel make math math.functions
math.primes math.ranges sequences sequences.product sorting
io math.parser ;
IN: math.primes.factors
: group-factors ( n -- seq )
dup prime? [ 1 2array 1array ] [ (group-factors) ] if ; flushable
-: unique-factors ( n -- seq ) group-factors [ first ] map ; flushable
+: unique-factors ( n -- seq ) group-factors keys ; flushable
: factors ( n -- seq )
group-factors [ first2 swap <array> ] map concat ; flushable
sort-keys <reversed>
[ 0 [ first max ] reduce 3 /f ] keep
[ first < ] with filter
- [ second ] map ;
+ values ;
: complete ( full short -- score )
[ dupd fuzzy score ] 2keep
} cleave
: postprocess-class ( -- )
- combine-map [ [ second ] map ] map concat
+ combine-map [ values ] map concat
[ combining-class not ] filter
[ 0 swap class-map set-at ] each ;
] 2map ;
: (make-callbacks) ( implementations -- sequence )
- dup [ first ] map (make-iunknown-methods)
+ dup keys (make-iunknown-methods)
[ [ first2 ] 2dip swap (make-interface-callbacks) ]
curry map-index ;
">" expect ;
: assure-no-extra ( seq -- )
- [ first ] map {
+ keys {
T{ name f "" "version" f }
T{ name f "" "encoding" f }
T{ name f "" "standalone" f }
ui.gadgets.scrollers ui.tools.listener accessors ;
IN: demos
-: demo-vocabs ( -- seq ) "demos" tagged [ second ] map concat [ name>> ] map ;
+: demo-vocabs ( -- seq ) "demos" tagged values concat [ name>> ] map ;
: <run-vocab-button> ( vocab-name -- button )
dup '[ drop [ _ run ] \ run call-listener ] <border-button> ;
segment [ p_offset>> dup ] [ p_filesz>> + ] bi [a,b) :> segment-interval
sections [ dup [ sh_offset>> dup ] [ sh_size>> + ] bi [a,b) 2array ] { } map-as :> section-intervals
section-intervals [ second segment-interval interval-intersect empty-interval = not ]
- filter [ first ] map ;
+ filter keys ;
TYPED:: virtual-address-segment ( elf: Elf32/64_Ehdr address -- program-header/f )
elf elf-program-headers elf-loadable-segments [
: filter-overlaps ( alist -- alist' )
2 clump
[ first2 [ first second ] [ first first ] bi* < ] filter
- [ first ] map ;
+ keys ;
MEMO: ip-intervals ( -- interval-map )
ip-db [ [ [ from>> ] [ to>> ] bi 2array ] keep ] { } map>assoc
[ [ length ] [ >int-array ] bi glDrawBuffers ] if ;
: bind-named-output-attachments ( program-instance framebuffer attachments -- )
- rot '[ first _ swap output-index ] sort-with [ second ] map
+ rot '[ first _ swap output-index ] sort-with values
bind-unnamed-output-attachments ;
: bind-output-attachments ( program-instance framebuffer attachments -- )
: bigraded-betti ( u-generators z-generators -- seq )
[ basis graded ] bi@ tensor bigraded-ker/im-d
- [ [ [ first ] map ] map ] keep
- [ [ second ] map 2 head* { 0 0 } prepend ] map
+ [ [ keys ] map ] keep
+ [ values 2 head* { 0 0 } prepend ] map
rest dup first length 0 <array> suffix
[ v- ] 2map ;
LLVMGetFirstFunction [ (functions) ] { } make [ <function> ] map ;
: function-effect ( function -- effect )
- [ params>> [ first ] map ] [ return>> void? 0 1 ? ] bi <effect> ;
+ [ params>> keys ] [ return>> void? 0 1 ? ] bi <effect> ;
: install-function ( function -- )
dup name>> "alien.llvm" create-vocab drop
[ normalize-path ] [ file-name ] bi
[ load-into-jit ] keep install-module ;
-<< "alien.llvm" create-vocab drop >>
\ No newline at end of file
+<< "alien.llvm" create-vocab drop >>
CONSTANT: hi 1389026570
: form-fitting? ( n -- ? )
- number>digits 2 group [ first ] map
+ number>digits 2 group keys
{ 1 2 3 4 5 6 7 8 9 0 } = ;
: candidates ( -- seq )