Open imarko opened 7 years ago
Yep, totally agreed: it'd be a really nice feature, especially for predicate functions.
Do you have any opinions on what the UI should look like? I'm not sure what would work best.
I quite like the syntax we use in dash docs:
(sexp) ;; => result
You can easily split on the comment token, then read
the result as a regular sexp. It is pretty compact too. Maybe even get away with the comment and just use => token to separate input and output. After all, it is a valid lisp token so the parser wouldn't really complain about it.
It would be neat if I could specify multiple sets of inputs and outputs and get suggestions that satisfy all of them. For example if I am looking for an expression to check if a string starts with a substring I could specify:
"f" "foo" => t "f" "barf" => nil "b" "bar" => t