Column virtual sequence improvements
parent
6b14071f5f
commit
5faea12c89
|
|
@ -15,6 +15,7 @@
|
||||||
- growable data heap
|
- growable data heap
|
||||||
- more compact relocation info
|
- more compact relocation info
|
||||||
- update module system docs
|
- update module system docs
|
||||||
|
- flip may fail with >64kb string
|
||||||
|
|
||||||
+ ui:
|
+ ui:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ M: object like drop ;
|
||||||
: flip ( matrix -- newmatrix )
|
: flip ( matrix -- newmatrix )
|
||||||
dup empty? [
|
dup empty? [
|
||||||
dup first [ length ] keep like
|
dup first [ length ] keep like
|
||||||
[ swap [ nth ] map-with ] map-with
|
[ <column> dup like ] map-with
|
||||||
] unless ;
|
] unless ;
|
||||||
|
|
||||||
: unpair ( assoc -- keys values )
|
: unpair ( assoc -- keys values )
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
! Copyright (C) 2005 Slava Pestov.
|
! Copyright (C) 2005, 2006 Slava Pestov.
|
||||||
! See http://factor.sf.net/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
IN: sequences
|
IN: sequences
|
||||||
USING: errors generic kernel math sequences-internals vectors ;
|
USING: errors generic kernel math sequences-internals vectors ;
|
||||||
|
|
||||||
|
|
@ -66,21 +66,17 @@ M: slice like slice-seq like ;
|
||||||
|
|
||||||
M: slice thaw slice-seq thaw ;
|
M: slice thaw slice-seq thaw ;
|
||||||
|
|
||||||
TUPLE: column col seq ;
|
TUPLE: column seq col ;
|
||||||
|
|
||||||
: column@ ( m section -- n seq )
|
: column@ ( m column -- n seq )
|
||||||
dup column-col -rot column-seq nth ;
|
dup column-col -rot column-seq nth ;
|
||||||
|
|
||||||
M: column length column-seq length ;
|
M: column length column-seq length ;
|
||||||
|
|
||||||
M: column nth column@ nth ;
|
M: column nth column@ nth ;
|
||||||
|
|
||||||
M: column nth-unsafe column@ nth-unsafe ;
|
|
||||||
|
|
||||||
M: column set-nth column@ set-nth ;
|
M: column set-nth column@ set-nth ;
|
||||||
|
|
||||||
M: column set-nth-unsafe column@ set-nth-unsafe ;
|
|
||||||
|
|
||||||
M: column like column-seq like ;
|
M: column like column-seq like ;
|
||||||
|
|
||||||
M: column thaw column-seq thaw ;
|
M: column thaw column-seq thaw ;
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ SYMBOL: phantom-r
|
||||||
: (live-locs) ( seq -- seq )
|
: (live-locs) ( seq -- seq )
|
||||||
dup phantom-locs* [ 2array ] 2map
|
dup phantom-locs* [ 2array ] 2map
|
||||||
[ first2 over loc? >r = not r> and ] subset
|
[ first2 over loc? >r = not r> and ] subset
|
||||||
[ first ] map ;
|
0 <column> ;
|
||||||
|
|
||||||
: stack>new-vreg ( loc spec -- vreg )
|
: stack>new-vreg ( loc spec -- vreg )
|
||||||
spec>vreg [ swap %peek ] keep ;
|
spec>vreg [ swap %peek ] keep ;
|
||||||
|
|
@ -254,7 +254,7 @@ SYMBOL: +clobber
|
||||||
|
|
||||||
: guess-vregs ( -- int# float# )
|
: guess-vregs ( -- int# float# )
|
||||||
+input get { } additional-vregs ?fp-scratch +
|
+input get { } additional-vregs ?fp-scratch +
|
||||||
+scratch get [ first ] map requested-vregs >r + r> ;
|
+scratch get 0 <column> requested-vregs >r + r> ;
|
||||||
|
|
||||||
: alloc-scratch ( -- )
|
: alloc-scratch ( -- )
|
||||||
+scratch get [ first2 >r spec>vreg r> set ] each ;
|
+scratch get [ first2 >r spec>vreg r> set ] each ;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
|
! Copyright (C) 2006 Slava Pestov.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
IN: inference
|
IN: inference
|
||||||
USING: kernel generic errors sequences prettyprint io words ;
|
USING: kernel generic errors sequences prettyprint io words
|
||||||
|
arrays ;
|
||||||
|
|
||||||
M: inference-error error.
|
M: inference-error error.
|
||||||
dup inference-error-rstate [ first ] map
|
dup inference-error-rstate 0 <column> >array
|
||||||
dup empty? [ "Word: " write dup peek . ] unless
|
dup empty? [ "Word: " write dup peek . ] unless
|
||||||
swap delegate error. "Nesting: " write . ;
|
swap delegate error. "Nesting: " write . ;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -242,7 +242,7 @@ M: f print-element drop ;
|
||||||
drop
|
drop
|
||||||
"Throws an error if the I/O operation fails." $errors ;
|
"Throws an error if the I/O operation fails." $errors ;
|
||||||
|
|
||||||
: sort-articles ( seq -- assoc )
|
: sort-articles ( seq -- newseq )
|
||||||
[ [ article-title ] keep 2array ] map
|
[ [ article-title ] keep 2array ] map
|
||||||
[ [ first ] 2apply <=> ] sort
|
[ [ first ] 2apply <=> ] sort
|
||||||
[ second ] map ;
|
1 <column> ;
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ SYMBOL: term-index
|
||||||
count-occurrences hash>alist rank-completions ;
|
count-occurrences hash>alist rank-completions ;
|
||||||
|
|
||||||
: search-help. ( phrase -- )
|
: search-help. ( phrase -- )
|
||||||
search-help [ first ] map help-outliner ;
|
search-help 0 <column> help-outliner ;
|
||||||
|
|
||||||
: index-help ( -- )
|
: index-help ( -- )
|
||||||
term-index get [
|
term-index get [
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ C: module ( name files tests help -- module )
|
||||||
: process-files ( seq -- newseq )
|
: process-files ( seq -- newseq )
|
||||||
[ dup string? [ [ t ] 2array ] when ] map
|
[ dup string? [ [ t ] 2array ] when ] map
|
||||||
[ second call ] subset
|
[ second call ] subset
|
||||||
[ first ] map ;
|
0 <column> >array ;
|
||||||
|
|
||||||
: add-module ( module -- )
|
: add-module ( module -- )
|
||||||
dup module-name swap 2array modules get push ;
|
dup module-name swap 2array modules get push ;
|
||||||
|
|
@ -59,9 +59,9 @@ C: module ( name files tests help -- module )
|
||||||
|
|
||||||
: test-module ( name -- ) module module-tests run-tests ;
|
: test-module ( name -- ) module module-tests run-tests ;
|
||||||
|
|
||||||
: all-modules ( -- seq ) modules get [ second ] map ;
|
: all-modules ( -- seq ) modules get 1 <column> ;
|
||||||
|
|
||||||
: all-module-names ( -- seq ) modules get [ first ] map ;
|
: all-module-names ( -- seq ) modules get 0 <column> ;
|
||||||
|
|
||||||
: test-modules ( -- )
|
: test-modules ( -- )
|
||||||
all-modules [ module-tests ] map concat run-tests ;
|
all-modules [ module-tests ] map concat run-tests ;
|
||||||
|
|
@ -91,4 +91,4 @@ C: module ( name files tests help -- module )
|
||||||
] ?if ;
|
] ?if ;
|
||||||
|
|
||||||
: modules-help ( -- seq )
|
: modules-help ( -- seq )
|
||||||
modules get [ second module-help ] map [ ] subset ;
|
all-modules [ module-help ] map [ ] subset ;
|
||||||
|
|
|
||||||
|
|
@ -220,6 +220,6 @@ unit-test
|
||||||
! Columns
|
! Columns
|
||||||
{ { 1 2 3 } { 4 5 6 } { 7 8 9 } } [ clone ] map "seq" set
|
{ { 1 2 3 } { 4 5 6 } { 7 8 9 } } [ clone ] map "seq" set
|
||||||
|
|
||||||
[ { 1 4 7 } ] [ 0 "seq" get <column> >array ] unit-test
|
[ { 1 4 7 } ] [ "seq" get 0 <column> >array ] unit-test
|
||||||
[ ] [ 1 "seq" get <column> [ sq ] inject ] unit-test
|
[ ] [ "seq" get 1 <column> [ sq ] inject ] unit-test
|
||||||
[ { 4 25 64 } ] [ 1 "seq" get <column> >array ] unit-test
|
[ { 4 25 64 } ] [ "seq" get 1 <column> >array ] unit-test
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ generic completion ;
|
||||||
: method-usage ( word generic -- methods )
|
: method-usage ( word generic -- methods )
|
||||||
tuck methods
|
tuck methods
|
||||||
[ second flatten memq? ] subset-with
|
[ second flatten memq? ] subset-with
|
||||||
[ first ] map
|
0 <column>
|
||||||
[ swap 2array ] map-with ;
|
[ swap 2array ] map-with ;
|
||||||
|
|
||||||
: usage. ( word -- )
|
: usage. ( word -- )
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ M: track layout*
|
||||||
M: track pref-dim*
|
M: track pref-dim*
|
||||||
[
|
[
|
||||||
dup gadget-children
|
dup gadget-children
|
||||||
2 group [ first ] map pref-dims
|
2 group 0 <column> pref-dims
|
||||||
dup rot track-sizes track-pref-dims >r max-dim r>
|
dup rot track-sizes track-pref-dims >r max-dim r>
|
||||||
] keep gadget-orientation set-axis ;
|
] keep gadget-orientation set-axis ;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ SYMBOL: double-click-timeout
|
||||||
|
|
||||||
: modifier ( mod modifiers -- seq )
|
: modifier ( mod modifiers -- seq )
|
||||||
[ second swap bitand 0 > ] subset-with
|
[ second swap bitand 0 > ] subset-with
|
||||||
[ first ] map prune f like ;
|
0 <column> prune f like ;
|
||||||
|
|
||||||
: drag-loc ( -- loc )
|
: drag-loc ( -- loc )
|
||||||
hand-loc get-global hand-click-loc get-global v- ;
|
hand-loc get-global hand-click-loc get-global v- ;
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ tool "toolbar" {
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
C: workspace ( -- workspace )
|
C: workspace ( -- workspace )
|
||||||
workspace-tabs [ second execute <tool> ] map <book>
|
workspace-tabs 1 <column> [ execute <tool> ] map <book>
|
||||||
over set-gadget-delegate dup dup set-control-self ;
|
over set-gadget-delegate dup dup set-control-self ;
|
||||||
|
|
||||||
M: workspace pref-dim* delegate pref-dim* { 550 650 } vmax ;
|
M: workspace pref-dim* delegate pref-dim* { 550 650 } vmax ;
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ C: titled-gadget ( gadget title -- )
|
||||||
<model> <titled-gadget> <world> open-window ;
|
<model> <titled-gadget> <world> open-window ;
|
||||||
|
|
||||||
: find-window ( quot -- world )
|
: find-window ( quot -- world )
|
||||||
windows get [ second ] map
|
windows get 1 <column>
|
||||||
[ world-gadget swap call ] find-last-with nip ; inline
|
[ world-gadget swap call ] find-last-with nip ; inline
|
||||||
|
|
||||||
: start-world ( world -- )
|
: start-world ( world -- )
|
||||||
|
|
@ -112,7 +112,7 @@ C: titled-gadget ( gadget title -- )
|
||||||
reset-world ;
|
reset-world ;
|
||||||
|
|
||||||
: restore-windows ( -- )
|
: restore-windows ( -- )
|
||||||
windows get [ [ second ] map ] keep delete-all
|
windows get [ 1 <column> >array ] keep delete-all
|
||||||
[ dup reset-world open-window* ] each
|
[ dup reset-world open-window* ] each
|
||||||
forget-rollover ;
|
forget-rollover ;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue