Wilfred / suggest.el

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

nil and t #35

Closed nickdrozd closed 6 years ago

nickdrozd commented 6 years ago
;; Inputs (one per line):
nil

;; Desired output:
t

When I run that query, Emacs hangs without notice. Nothing happens, and even the cursor stops blinking, until I C-g quit. After that, things return to normal after about a second.

Similar queries don't have this problem (though the results aren't the most insightful):

;; Inputs (one per line):
t

;; Desired output:
nil

;; Suggestions:
(-zip t nil) ;=> nil
(remq t nil) ;=> nil
(last t -1) ;=> nil
(assoc t nil) ;=> nil
(-take -1 t) ;=> nil
;; Inputs (one per line):
t

;; Desired output:
t

;; Suggestions:
(last t) ;=> t
(-cons* t) ;=> t
(append t) ;=> t
(-concat t) ;=> t
(identity t) ;=> t
;; Inputs (one per line):
nil

;; Desired output:
nil

;; Suggestions:
(cdr nil) ;=> nil
(car nil) ;=> nil
(last nil) ;=> nil
(cdar nil) ;=> nil
(cadr nil) ;=> nil

The weird hang aside, support for booleans isn't great. I'm going to open a PR to add some boolean functions.

Wilfred commented 6 years ago

Aha, this is an issue with (-interleave) going into an infinite loop. I'll file a bug on dash.el and make suggest.el robust.

Wilfred commented 6 years ago

Filed https://github.com/magnars/dash.el/issues/241.