] [ infer-known* ] if ;
IDENTITY-MEMO: inputs/outputs ( quot -- in out )
- infer [ in>> ] [ out>> ] bi 2length ;
+ infer in-out 2length ;
: inputs ( quot -- n ) inputs/outputs drop ; inline
peek-d
infer-known [
[ pop-d 1array #drop, ]
- [ [ in>> ] [ out>> ] bi [ length apply-object ] bi@ ] bi*
+ [ in-out [ length apply-object ] bi@ ] bi*
] [
\ inputs/outputs dup required-stack-effect apply-word/effect
pop-d pop-d swap
MATCH-VARS: ?a ?b ?c ;
: pretty-shuffle ( effect -- word/f )
- [ in>> ] [ out>> ] bi 2array {
+ in-out 2array {
{ { { } { } } [ ] }
{ { { ?a } { ?a } } [ ] }
{ { { ?a ?b } { ?a ?b } } [ ] }
: inputs-and-outputs ( content word -- content' word )
over [ dup array? [ { $values } head? ] [ drop f ] if ] find drop [
'[ _ cut unclip rest ] dip [
- stack-effect [ in>> ] [ out>> ] bi
+ stack-effect in-out
[ [ dup pair? [ first ] when ] map ] bi@
[ '[ ?first _ member? ] filter ] bi-curry@
\ $inputs \ $outputs
inputs-and-outputs fix-shuffle drop ;
: effect-help ( effect -- content )
- [ in>> ] [ out>> ] bi [
+ in-out [
[
dup pair? [
first2 dup effect? [ \ $quotation swap 2array ] when
: effect-values ( word -- seq )
stack-effect
- [ in>> ] [ out>> ] bi append
+ in-out append
[ dup pair? [ first ] when effect>string ] map members ;
: effect-effects ( word -- seq )
request [
<request-socket> [
[
- [ in>> ] [ out>> ] bi
+ in-out
[ ?https-tunnel ] with-streams*
]
[
! Copyright (C) 2005, 2009 Slava Pestov.
! See https://factorcode.org/license.txt for BSD license.
-USING: kernel continuations destructors io io.encodings
-io.encodings.private io.timeouts io.ports io.styles summary
-accessors delegate delegate.protocols ;
+USING: accessors delegate delegate.protocols destructors effects
+io io.encodings io.ports io.styles io.timeouts kernel ;
IN: io.streams.duplex
TUPLE: duplex-stream in out ;
INSTANCE: duplex-stream input-stream
INSTANCE: duplex-stream output-stream
-: >duplex-stream< ( stream -- in out ) [ in>> ] [ out>> ] bi ; inline
+: >duplex-stream< ( stream -- in out ) in-out ; inline
M: duplex-stream stream-element-type
>duplex-stream<
! Copyright (C) 2009 Daniel Ehrenberg.
! See https://factorcode.org/license.txt for BSD license.
-USING: accessors arrays assocs kernel math math.bits regexp.ast
-regexp.classes regexp.transition-tables sequences sets ;
+USING: accessors arrays assocs effects kernel math math.bits
+regexp.ast regexp.classes regexp.transition-tables sequences
+sets ;
IN: regexp.disambiguate
TUPLE: parts in out ;
[ nip in>> ] [ out>> append ] 2bi parts boa ;
: meaningful-integers ( partition table -- integers )
- [ [ in>> ] [ out>> ] bi ] dip
+ [ in-out ] dip
'[ [ _ at ] map intersect-all ] bi@ diff ;
: class-integers ( classes integers -- table )
[ check-call-height ] [ check-call-site-stack ] bi ;
: adjust-stack-effect ( effect -- effect' )
- [ in>> ] [ out>> ] bi
+ in-out
meta-d length pick length [-]
object <repetition> '[ _ prepend ] bi@
<effect> ;
! See https://factorcode.org/license.txt for BSD license.
USING: accessors alien arrays assocs byte-arrays calendar
classes classes.error combinators combinators.short-circuit
-continuations eval hashtables help.markup interpolate io
+continuations effects eval hashtables help.markup interpolate io
io.directories io.encodings.utf8 io.files io.pathnames
io.streams.string kernel math math.parser namespaces prettyprint
quotations sequences sets sorting splitting strings system
: $values. ( word -- )
"declared-effect" word-prop [
- [ in>> ] [ out>> ] bi
+ in-out
2dup [ empty? ] both? [
2drop
] [
: ?remove-$values ( word spec -- spec )
\ $values over member? [
swap "declared-effect" word-prop [
- [ in>> ] [ out>> ] bi append [
+ in-out append [
\ $values swap remove
] [ drop ] if-empty
] when* ] [ nip ] if ;
: set-dual-help ( dword word -- )
[
[
- stack-effect [ in>> ] [ out>> ] bi append
+ stack-effect in-out append
[ dual ] { } map>assoc { $values } prepend
] [
[
] with-compilation-unit ;
: test-inference ( ast -- in# out# )
- test-compilation infer [ in>> ] [ out>> ] bi 2length ;
+ test-compilation infer in-out 2length ;
{ 2 1 } [
T{ ast-block f