Wilfred / suggest.el

discover elisp functions that do what you want
367 stars 14 forks source link

accept multiple sets of inputs/output #29

Open imarko opened 7 years ago

imarko commented 7 years ago

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

Wilfred commented 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.

Fuco1 commented 6 years ago

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.