TopGit tracks Wilfred/suggest.el on GitHub. The project has 381 stars. discover elisp functions that do what you want
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
;; Inputs (one per line):
'(a b c)
;; Desired output:
'c
;; Suggestions:
(cadr (cdr '(a b c))) ;=> 'c
(car (last '(a b c))) ;=> 'c
(cl-third '(a b c)) ;=> 'c
It will also suggest additional arguments of basic values (0 in this
example):
;; Inputs (one per line):
'(a b c d)
;; Desired output:
'a
;; Suggestions:
(elt '(a b c d) 0) ;=> 'a
(nth 0 '(a b c d)) ;=> 'a
(car '(a b c d)) ;=> 'a
(cl-first '(a b c d)) ;=> 'a
(-first-item '(a b c d)) ;=> 'a
How it works
suggest.el uses enumerative program synthesis. It tries your inputs
(in any order) against every function in suggest-functions.
suggest-functions is a carefully chosen function list: they're all
pure functions with a small number of arguments using only simple data
types. We only include functions that users could 'stumble upon' with
the right set of inputs.
Contributing
To work on the code, clone the repo, then you can eval suggest.el in
your current Emacs instance.
To run the tests, you will
need Cask. Once you've installed Cask,
you can install the suggest.el dependencies and run the tests as
follows:
$ cask
$ cask exec ert-runner
License
GPLv3.
Related projects
Program synthesis or inductive programming is a computer science
research topic, with a range of tools taking very different approaches
to generate code.
Smalltalk: Finder
This project was inspired by the Finder in Smalltalk, which does
something similar. There's
a great demo video here.
You give a list of values (inputs followed by an output):
3. 4. 7.
The Finder iterates over all possible calls (with arguments in any
order) to a list of known safe messages, and returns suggestions:
Amusingly, it will sometimes find '(data1 shuffled)' from
'fo'. 'of'., which is a random sort.
Python: cant
There are some other niche tools that take other approaches. For
example, cant for Python tries
every function in scope (without a safety whitelist) to find
functionality.
Scheme: barliman
barliman takes this idea of synthesis much, much further for
Scheme. There's an
incredible demo video here.
C-like: sketch
sketch
allows the user to specify value placeholders in code
(examples).
harness void doubleSketch(int x){
int t = x * ??;
assert t == x + x;
}
Or you can specify a set of operators for sketch to explore. Each line
here is an assignment to x or tmp of an expression that may
contain !&+ with x, tmp or a constant as arguments.
Constraints are fed to a SAT solver, then sketch finds a solution. The
output can be converted to C.
Liquid Haskell: Synquid
Synquid (the first
half of
this Microsoft Research talk gives
a good overview) is a program synthesis tool leveraging refinement
types.
The user provides the type of the function they want to generate, and
a collection of 'components', the building blocks that Synquid tries
to combine.
Synquid then lazily generates ASTs and type checks them. This allows
it to prune the search tree by ignoring program structures that are
never valid types.
(This is the extent of my understanding: I have probably
oversimplified.)
Impressively, Synquid can generate recursive functions.
The most recent commit recorded on Wilfred/suggest.el was 11 months ago, based on the GitHub push timestamp. The repository has 15 forks — one of the better signals of community interest.
How many stars does Wilfred/suggest.el have?
Wilfred/suggest.el has 381 GitHub stars — refresh the page for the live number, or check github.com/Wilfred/suggest.el. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
What language is Wilfred/suggest.el written in?
Wilfred/suggest.el is written primarily in Emacs Lisp. GitHub's language field is based on the largest share of bytes in the default branch.
What topics is Wilfred/suggest.el associated with?
GitHub's repository topics for Wilfred/suggest.el: "emacs", "emacs-lisp", "program-synthesis". TopGit's editorial category is open-source.
Where do I read more about Wilfred/suggest.el?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/Wilfred/suggest.el is the definitive source.
Read full README in the tab above.
Is suggest.el worth your time?
ChatGPT, Claude and Perplexity can all read this page. Ask one of them what it makes of suggest.el.