thegeekinside has quit [Ping timeout: 245 seconds]
thegeekinside has joined #racket
libertyprime has joined #racket
thegeekinside has quit [Ping timeout: 246 seconds]
munksgaard has joined #racket
linj has joined #racket
skapata has quit [Remote host closed the connection]
libertyprime has quit [Quit: leaving]
wwalker has quit [Ping timeout: 250 seconds]
wwalker has joined #racket
lucasta has joined #racket
<Putonlalla>
I have a style question. Suppose I implement a procedure for a data structure, which combines its contract and eliminator. Let us call it `break-ds?`. The intent is that, given some motive `prc` and some value `obj`, the procedure `break-ds?` either returns `#f` if `obj` is not an instance of `ds`, or calls `prc` on the fields of `obj` otherwise.
skeemer__ has quit [Remote host closed the connection]
<Putonlalla>
The problem arises when the motive is boolean. If I want to be able to distinguish failure from a false result, I must either (1) write the contract of `break-ds?` to prohibit returning `#f`, forcing the user to sometimes box their motives, or (2) always box the result, forcing the user to always unbox successful results.
<Putonlalla>
Which approach would you prefer?
jsoo has quit [Server closed connection]
<Putonlalla>
Thinking outside the box (and, hence, `box`) by not writing these procedures in the first place is not possible, because they are derived from the corresponding inductive types.
jsoo has joined #racket
lucasta has quit [Quit: Leaving]
thegeekinside has joined #racket
mwnaylor has joined #racket
thegeekinside has quit [Ping timeout: 245 seconds]
<Putonlalla>
As an example, for lists, these options would result in the contracts (1) `(let ((a (not/c #f))) (-> (-> a) (-> any/c list? a a) any/c (or/c #f a)))` and (2) `(let ((a any/c)) (-> (-> a) (-> any/c list? a a) any/c (or/c #f (box/c a))))`.
thegeekinside has joined #racket
morte_ has joined #racket
szkl has joined #racket
thegeekinside has quit [Ping timeout: 244 seconds]
mwnaylor has left #racket [ERC 5.4.1 (IRC client for GNU Emacs 30.0.50)]
skapata has joined #racket
szkl has quit [Quit: Connection closed for inactivity]
gcd has quit [Quit: leaving]
gcd has joined #racket
thegeekinside has joined #racket
skapata has quit [Remote host closed the connection]
codaraxis has joined #racket
skapata has joined #racket
Psybur has quit [Read error: Connection reset by peer]
codaraxis has quit [Quit: Leaving]
Tuplanolla has joined #racket
liberalartist has joined #racket
FreeFull has joined #racket
FreeFull has quit [Client Quit]
FreeFull has joined #racket
liberalartist has quit [Ping timeout: 240 seconds]