ah, I see what you mean
how would I verify that a certain key of a hash table has a certain contract? namely, I want to see if the key 'function
of a hash table satisfies a function contract
since ->
doesn’t just give you a boolean function you can work with, apparently
maybe contract
would help a bit. (contract your-function-contract your-key ... ...)
right, but wouldn’t that signal a contract error (rather than just returning a boolean)?
I may be missing something, but I thought part of how function contracts work is you won’t know until you try and apply the contract?
I mean apply the function which checks the contract.
unfortunate
(with-handlers ([exn:fail:contract? (lambda _ #f) ]) (contract (-> any/c boolean?) (lambda () #t) #f #f))
I think you can write this with hash/dc
is there anything in the standard lib that splits a list into two lists on the first occurrence of an element?
something like memf but that returns 2 lists instead of one
splitf-at
there ye ar!