<williewillus>
curiousity question: are multiple values implemented any differently internally than just lists or vectors?
<williewillus>
I know theoretically they are presented as a dual to explicit positional arguments, but inputs can be optimized because we know how many there are going to be ahead of time (rest args notwithstanding). For outputs I can randomly return two or three things using `values` whenever I like.
badkins has quit [Remote host closed the connection]
badkins has joined #racket
codingquark has quit [Ping timeout: 246 seconds]
badkins has quit [Remote host closed the connection]
codingquark has joined #racket
codingquark has quit [Ping timeout: 246 seconds]
sunarch has quit [Ping timeout: 248 seconds]
codingquark has joined #racket
henderson has quit [Ping timeout: 248 seconds]
henderson has joined #racket
sunarch has joined #racket
sunarch has quit [Max SendQ exceeded]
sunarch has joined #racket
<samth>
williewillus: yes, multiple values are implemented somewhat differently
sunarch has quit [Max SendQ exceeded]
<samth>
in some cases they end up reified in the heap, but less often than for a vector or a lit
<williewillus>
interesting, so the compiler can specialize if it can detect that for example, a function always returns 2 values at once and never 1 or 3+?
<samth>
yes
sunarch has joined #racket
<samth>
see, for example, procedure-result-arity
jao has quit [Ping timeout: 246 seconds]
sunarch has quit [Max SendQ exceeded]
sunarch has joined #racket
badkins has joined #racket
badkins has quit [Ping timeout: 256 seconds]
GreaseMonkey has quit [Ping timeout: 255 seconds]
<williewillus>
seems like procedure-result-arity is kinda dumb though :P
<kengruven>
how do you test if a value passes a contract? i was sure i saw a function for that but i can't find it today.
lagash has joined #racket
<samth>
kengruven: for flat contracts, you can just call them like functions
<samth>
kengruven: for higher-order contracts, you can't test them
<kengruven>
huh. that seems unfortunate.
<samth>
kengruven: it's in principle impossible -- you can't check if a function always returns a number
ur5us has joined #racket
Algernon69 has joined #racket
twosuns has joined #racket
<kengruven>
i think i'm missing something. don't contracts on function args test the contract against the passed args?
winny has quit [Remote host closed the connection]
ur5us has quit [Ping timeout: 248 seconds]
<samth>
kengruven: yes. You can _apply_ a contract to a function (see the `contract` form) but that doesn't _check_ that the function will pass the contract right then. It produces a new function that does the checking.
<kengruven>
right, it checks one value against one contract. that's all i'm looking for.
<samph>
You could test a contract applied to a function by calling it with "bad" input or having it produce a "bad" output.
<samph>
it == contracted function
<samth>
kengruven: if you have a function f, and a contract like `(-> integer? integer?)` you can apply the contract to the function, which gives you a new function. is that what you want?
winny has joined #racket
<kengruven>
no, i think i'm doing a bad job of explaining.
twosuns has quit [Quit: Leaving]
twosuns has joined #racket
twosuns has quit [Remote host closed the connection]
winny has quit [Remote host closed the connection]
winny has joined #racket
<kengruven>
oh, maybe flat-contract-predicate is what i was thinking of.
ur5us has joined #racket
winny has quit [Remote host closed the connection]
winny has joined #racket
winny has quit [Remote host closed the connection]
ur5us has quit [Quit: Leaving]
winny has joined #racket
Algernon69 has quit [Ping timeout: 260 seconds]
ur5us has joined #racket
rito_ has quit [Ping timeout: 256 seconds]
lowak has quit [Ping timeout: 268 seconds]
lowak has joined #racket
gproto23 has quit [Remote host closed the connection]