LoginSignup
4
1

More than 5 years have passed since last update.

Emacs Lispで(a==1 && a==2 && a==3) を true にしてみたい

Last updated at Posted at 2018-01-27

元ネタ: javascript - Can (a ==1 && a== 2 && a==3) ever evaluate to true? - Stack Overflow

これに対する Qiita 記事のまとめが以下。

flet使えば良いですね。cl-fletを使うのが推奨されているようです。ちなみにfletとcl-fletの挙動は微妙に違うのですが(たしか)、今回に限っていうとどちらでも変わらず。

(require 'cl)

(cl-flet ((= (x y) t))
  (let ((a 10))
    (and (= a 1) (= a 2) (= a 3))))
; => t
4
1
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1