+ ui:
+- menu should stay up if mouse button released
- completion is not ideal: eg, search for "buttons"
- some way of intercepting all gestures
- slider needs to be modelized
-rot (^mod)
] if ; foldable
-: powers ( n x -- { 1 x x^2 x^3 ... } )
- #! Output sequence has n elements.
+: powers ( n x -- seq )
+ #! Output sequence has n elements, { 1 x x^2 x^3 ... }
<array> 1 [ * ] accumulate ;
: ** ( u v -- u*v' ) conjugate * ; inline
: methods* ( dispatch# word -- assoc )
#! Make a class->method association, together with a
#! default delegating method at the end.
- dup methods -rot default-method add* ;
+ dup methods -rot empty-method object bootstrap-word
+ swap 2array add* ;
: method-alist>quot ( dispatch# word base-class -- quot )
bootstrap-word swap simplify-alist
: small-generic? ( word -- ? ) generic-tags length 3 <= ;
-: build-class-vtable ( vtable pair -- )
- dup first hashcode pick length rem rot nth push ;
-
-: <class-vtable> ( dispatch# word assoc -- table )
- >r dupd default-method r>
- [ length 3 + [ drop 1array >vector ] map-with ] keep
- [ dupd build-class-vtable ] each
- [ object method-alist>quot ] map-with ;
-
-: class-generic ( dispatch# word -- quot )
- dup methods dup empty? [
- drop default-method
- ] [
- [
- pick picker % [ class hashcode ] %
- <class-vtable> dup length , \ rem , , \ dispatch ,
- ] [ ] make
- ] if ;
-
: standard-combination ( word dispatch# -- quot )
swap {
{ [ dup tag-generic? ] [ num-tags \ tag type-generic ] }
dup parsing-file dup record-file\r
[ ?resource-path <file-reader> ] keep parse-stream\r
] [\r
- over parse-file-restarts <condition> rethrow drop\r
- parse-file\r
+ over parse-file-restarts condition drop parse-file\r
] recover ;\r
\r
: run-file ( file -- ) parse-file call ;\r