notjack
2021-5-13 17:37:28

ah, I see what you mean


hazel
2021-5-13 21:48:49

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


hazel
2021-5-13 21:49:01

since -> doesn’t just give you a boolean function you can work with, apparently


capfredf
2021-5-13 22:13:09

maybe contract would help a bit. (contract your-function-contract your-key ... ...)


hazel
2021-5-13 22:14:06

right, but wouldn’t that signal a contract error (rather than just returning a boolean)?


samdphillips
2021-5-13 23:00:58

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?


samdphillips
2021-5-13 23:01:49

I mean apply the function which checks the contract.


hazel
2021-5-13 23:02:07

unfortunate


capfredf
2021-5-14 00:57:05

(with-handlers ([exn:fail:contract? (lambda _ #f) ]) (contract (-> any/c boolean?) (lambda () #t) #f #f))


samth
2021-5-14 01:15:16

I think you can write this with hash/dc


jestarray
2021-5-14 03:11:50

is there anything in the standard lib that splits a list into two lists on the first occurrence of an element?


jestarray
2021-5-14 03:11:56

something like memf but that returns 2 lists instead of one


sorawee
2021-5-14 03:18:41

splitf-at


jestarray
2021-5-14 03:19:19

there ye ar!