From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.help Subject: Using let-bound var inside pcase conditions Date: Mon, 17 Apr 2017 18:07:42 +0000 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: blaine.gmane.org 1492452567 10096 195.159.176.226 (17 Apr 2017 18:09:27 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 17 Apr 2017 18:09:27 +0000 (UTC) To: Help Gnu Emacs mailing list Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Apr 17 20:09:23 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d0B5V-0002UI-CS for geh-help-gnu-emacs@m.gmane.org; Mon, 17 Apr 2017 20:09:21 +0200 Original-Received: from localhost ([::1]:38152 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d0B5b-0007GY-A5 for geh-help-gnu-emacs@m.gmane.org; Mon, 17 Apr 2017 14:09:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50785) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d0B48-0006lp-P1 for help-gnu-emacs@gnu.org; Mon, 17 Apr 2017 14:07:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d0B47-0000QA-Tl for help-gnu-emacs@gnu.org; Mon, 17 Apr 2017 14:07:56 -0400 Original-Received: from mail-lf0-x233.google.com ([2a00:1450:4010:c07::233]:34793) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d0B47-0000Pf-Mm for help-gnu-emacs@gnu.org; Mon, 17 Apr 2017 14:07:55 -0400 Original-Received: by mail-lf0-x233.google.com with SMTP id t144so69129909lff.1 for ; Mon, 17 Apr 2017 11:07:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=obbVVGbAvii1XEZtcfTPtI8SvpYSrh7FGhKcKnOfF4g=; b=fFuIb4npR3O/BfgIOvI6mGhJ190FJEpX+AGab/h1+qOrfu41jMFcsLzWU5SqRBcLQ2 ImiR9pOUZwdtj4nOFRWtn9LMh4EP0baczDLeuPuyXu+j5CinRzEh3+l4km8O+qAp0ecZ RRPtbToiZVDRm97QSjl+d8e8wRhL/yC/ruMKs76Kv06EeQviB0M+ibVPpDayxpcIQevc QPEHRAXalSGtTDISYD9C/yNpJkdkSsvmEU/tX2CiIbOeCS1rDjzuVNxOm7/fAXTMKA/Q 986GKcBTPRA+Au2UazfZhkom526HhLZ8J+IYQYM05kwaR0xDUhUAa2UKY+Fk+alznaWu e7zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=obbVVGbAvii1XEZtcfTPtI8SvpYSrh7FGhKcKnOfF4g=; b=l6zRH1FE5GkO19zZu9qZbIAtMvpgepdNF0glZLldzuf8xO0u5LD85X35L9gXuS9HJN hWR0s6KwDEJtCemuI7rcSXhcR3pPpSZMxGyffr9yeh9Do2yINde3ForZuiUsfN6FoGfd duABNOIT9mIfm0K0ZT2WMjAQNNezDmD+ll8ISDNtNXO8QVSJB73R14Mg1QC6dNd+h7wS YzF9zlhos2lpioadKuz4zeZgo/RiPXPmauoSYq8NP+vpGyq6fO7/JsJ8BpngVW9gKEpK mKsTCp9yfRF7ORv4HeoGzLgLUJmOw0q+fMo6ZdgoPc6Fm0ZytoByLg/PKluJg39Zqino Qq9A== X-Gm-Message-State: AN3rC/5l1RxdA51NpBLnTAyO1NTVFyNyDPSatodPt2F2p69GPNJpzT27 xad7Y7tLRlQjVPz3tLciPompo77/dg== X-Received: by 10.46.6.17 with SMTP id 17mr630977ljg.125.1492452473874; Mon, 17 Apr 2017 11:07:53 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::233 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:112794 Archived-At: Hi, I am trying to set the conditions in a pcase to variables, but cannot get it working (See below dummy code). Can you help fix the second message form below? ;; -*- lexical-binding: t; -*- (defun pcase-test (var) (let ((one 1) (two 2)) (message "(good) Value is %s." (pcase var (`nil "nil") (1 "one") (2 "two") (_ "none of the expected"))) (message "(bad) Value is %s." (pcase var (`nil "nil") (`,one "one") (`,two "two") (_ "none of the expected"))))) (pcase-test nil) (pcase-test 1) (pcase-test 2) (pcase-test 3) -- Kaushal Modi