fix stack bug in presentations; minor tweak to menu code

cvs
Slava Pestov 2005-09-03 21:49:28 +00:00
parent c811c423c3
commit 55a4de3120
9 changed files with 22 additions and 23 deletions

View File

@ -41,6 +41,8 @@ make-string ==> "" make
make-rstring ==> "" make reverse make-rstring ==> "" make reverse
make-sbuf ==> SBUF" " make make-sbuf ==> SBUF" " make
</pre></li> </pre></li>
<li>The <code>every?</code> word has been replaced with <code>monotonic? ( seq quot -- ? )</code>. Its behavior is a superset of <code>every?</code> -- it now accepts any transitive relation, and checks if the sequence is monotonic under this relation. For example,
<code>[ = ] monotonic?</code> checks if all elements in a sequence are equal, and <code>[ < ] monotonic?</code> checks for a strictly increasing sequence of integers.</li>
</ul> </ul>
</li> </li>
@ -58,6 +60,18 @@ make-sbuf ==&gt; SBUF" " make
</li> </li>
<li>User interface:
<ul>
<li>Binary search is now used for spacial indexing where possible. This improves performance when there are a lot of lines of output in the listener.</li>
<li>Scroll bars now behave in a more intuitive manner, closer to conventional GUIs.</li>
<li>Menus now appear when the mouse button is pressed, not released, and dragging through the menu with the button held down behaves as one would expect.</li>
<li>The data stack and call stack are now shown. In the single-stepper, these two display the state of the program being stepped. In the inspector, the call stack display is replaced with an inspector history.</li>
<li>Pack layouts with gaps are now supported.</li>
<li>Many bug fixes.</li>
</ul>
</li>
<li>Everything else: <li>Everything else:
@ -67,7 +81,7 @@ make-sbuf ==&gt; SBUF" " make
<li>New <code>cond ( conditions -- )</code> combinator. It behaves like a set of nested <code>ifte</code>s, and compiles if each branch has the same stack effect. See its documentation comment for details.</li> <li>New <code>cond ( conditions -- )</code> combinator. It behaves like a set of nested <code>ifte</code>s, and compiles if each branch has the same stack effect. See its documentation comment for details.</li>
<li>Formally documented method combination (<code>G:</code> syntax) in handbook. <li>Formally documented method combination (<code>G:</code> syntax) in handbook.
<li>Erlang/Termite-style concurrency library in <code>contrib/concurrency</code> (Chris Double).</li> <li>Erlang/Termite-style concurrency library in <code>contrib/concurrency</code> (Chris Double).</li>
<li>Completely redid infix algebra in <code>conrib/algebra/</code>. Now, vector operations are possible <li>Completely redid infix algebra in <code>contrib/algebra/</code>. Now, vector operations are possible
and the syntax doesn't use so many spaces. New way to write the quadratic formula: and the syntax doesn't use so many spaces. New way to write the quadratic formula:
<pre>MATH: quadratic[a;b;c] = <pre>MATH: quadratic[a;b;c] =
plusmin[(-b)/2*a;(sqrt(b^2)-4*a*c)/2*a] ;</pre> plusmin[(-b)/2*a;(sqrt(b^2)-4*a*c)/2*a] ;</pre>

View File

@ -1,7 +1,6 @@
- fix up the min thumb size hack
+ ui: + ui:
- fix up the min thumb size hack
- long lines of text fail in draw-surface - long lines of text fail in draw-surface
- only redraw dirty gadgets - only redraw dirty gadgets
- faster mouse tracking - faster mouse tracking

View File

@ -2624,7 +2624,7 @@ Applies the quotation to each element of the sequence. If an element is found fo
Outputs \texttt{t} if the quotation yields true when applied to each element, otherwise outputs \texttt{f}. Given an empty sequence, vacuously outputs \texttt{t}. Outputs \texttt{t} if the quotation yields true when applied to each element, otherwise outputs \texttt{f}. Given an empty sequence, vacuously outputs \texttt{t}.
\wordtable{ \wordtable{
\vocabulary{sequences} \vocabulary{sequences}
\ordinaryword{every?}{every?~( seq quot -- ?~)} \ordinaryword{monotonic?}{monotonic?~( seq quot -- ?~)}
\texttt{quot:~element element -- ?}\\ \texttt{quot:~element element -- ?}\\
} }
Tests if all elements of the sequence are equivalent under the relation. The quotation should be an equality relation (see \ref{equality}), otherwise the result will not be useful. This is implemented by vacuously outputting \verb|t| if the sequence is empty, or otherwise, by applying the quotation to each element together with the first element in turn, and testing if it always yields a true value. Usually, this word is used to test if all elements of a sequence are equal, or the same element: Tests if all elements of the sequence are equivalent under the relation. The quotation should be an equality relation (see \ref{equality}), otherwise the result will not be useful. This is implemented by vacuously outputting \verb|t| if the sequence is empty, or otherwise, by applying the quotation to each element together with the first element in turn, and testing if it always yields a true value. Usually, this word is used to test if all elements of a sequence are equal, or the same element:

View File

@ -113,9 +113,6 @@ M: object empty? ( seq -- ? ) length 0 = ;
M: object >list ( seq -- list ) dup length 0 rot (>list) ; M: object >list ( seq -- list ) dup length 0 rot (>list) ;
: conjunction ( v -- ? ) [ ] all? ; flushable
: disjunction ( v -- ? ) [ ] contains? ; flushable
: index ( obj seq -- n ) [ = ] find-with drop ; flushable : index ( obj seq -- n ) [ = ] find-with drop ; flushable
: index* ( obj i seq -- n ) [ = ] find-with* drop ; flushable : index* ( obj i seq -- n ) [ = ] find-with* drop ; flushable
: member? ( obj seq -- ? ) [ = ] contains-with? ; flushable : member? ( obj seq -- ? ) [ = ] contains-with? ; flushable

View File

@ -62,7 +62,7 @@ SYMBOL: @
: literals-match? ( values template -- ? ) : literals-match? ( values template -- ? )
[ [
over literal? [ >r literal-value r> ] [ nip @ ] ifte = over literal? [ >r literal-value r> ] [ nip @ ] ifte =
] 2map conjunction ; ] 2map [ ] all? ;
: values-match? ( values template -- ? ) : values-match? ( values template -- ? )
[ @ = [ drop f ] unless ] 2map [ ] subset [ eq? ] monotonic? ; [ @ = [ drop f ] unless ] 2map [ ] subset [ eq? ] monotonic? ;

View File

@ -77,7 +77,7 @@ M: #call can-kill? ( literal node -- ? )
[ swap memq? ] map-with ; [ swap memq? ] map-with ;
: lookup-mask ( mask word -- word ) : lookup-mask ( mask word -- word )
over disjunction [ (kill-shuffle) hash ] [ nip ] ifte ; over [ ] contains? [ (kill-shuffle) hash ] [ nip ] ifte ;
: kill-shuffle ( literals node -- ) : kill-shuffle ( literals node -- )
#! If certain values passing through a stack op are being #! If certain values passing through a stack op are being

View File

@ -81,16 +81,6 @@ M: #values optimize-node* ( node -- node/t )
M: #return optimize-node* ( node -- node/t ) M: #return optimize-node* ( node -- node/t )
optimize-fold ; optimize-fold ;
! #label
GENERIC: calls-label* ( label node -- ? )
M: node calls-label* 2drop f ;
M: #call-label calls-label* node-param eq? ;
: calls-label? ( label node -- ? )
[ calls-label? not ] all-nodes-with? not ;
! M: #label optimize-node* ( node -- node/t ) ! M: #label optimize-node* ( node -- node/t )
! dup node-param over node-children first calls-label? [ ! dup node-param over node-children first calls-label? [
! drop t ! drop t

View File

@ -7,10 +7,8 @@ gadgets-labels generic kernel lists math namespaces sequences ;
: retarget-drag ( -- ) : retarget-drag ( -- )
hand [ rect-loc world get pick-up ] keep hand [ rect-loc world get pick-up ] keep
2dup hand-clicked eq? [ 2dup hand-clicked eq? [
2drop 2dup set-hand-clicked dup update-hand
] [ ] unless 2drop ;
[ set-hand-clicked ] keep update-hand
] ifte ;
: menu-actions ( glass -- ) : menu-actions ( glass -- )
dup [ drop retarget-drag ] [ drag 1 ] set-action dup [ drop retarget-drag ] [ drag 1 ] set-action

View File

@ -18,6 +18,7 @@ SYMBOL: commands
: command-quot ( presented quot -- quot ) : command-quot ( presented quot -- quot )
[ [
\ drop ,
[ swap literalize , % ] [ ] make , [ swap literalize , % ] [ ] make ,
[ pane get pane-call ] % [ pane get pane-call ] %
] [ ] make ; ] [ ] make ;