From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Douglas Lewan Newsgroups: gmane.emacs.help Subject: Re: Compiling a recursive macro Date: Thu, 11 Jun 2020 22:10:19 -0400 Message-ID: References: <22b55d6d-f719-98d9-f8c8-e72e7fc43497@gmail.com> <87lfkt47bl.fsf@web.de> <87ftb1469o.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="106194"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 12 04:11:14 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jjZA2-000RYE-A6 for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 12 Jun 2020 04:11:14 +0200 Original-Received: from localhost ([::1]:55230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjZA1-0005OU-DC for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 11 Jun 2020 22:11:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60062) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjZ9f-0005OC-SR for help-gnu-emacs@gnu.org; Thu, 11 Jun 2020 22:10:51 -0400 Original-Received: from mail-qt1-x82a.google.com ([2607:f8b0:4864:20::82a]:39431) by eggs.gnu.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jjZ9e-0006gY-3q for help-gnu-emacs@gnu.org; Thu, 11 Jun 2020 22:10:51 -0400 Original-Received: by mail-qt1-x82a.google.com with SMTP id k22so6081549qtm.6 for ; Thu, 11 Jun 2020 19:10:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=meBDGi4ZDcGT9h3TSjFscrqXy/6r/zGJFRNO5LbcqhY=; b=dZuhxEjVeXZKeITD2L6xiDeZCTrZ03fmjensBo5n0jaVyGd2qnApLG8GCVnneAabZM EXmX6sOOlTuzMz7PwXGVZmSM05mav5MAn5eqRB/YYdPG3Un1WjU+rxd+avjqVmKdoX6q MZXyVek7czHyCTMkLnMk+UlGbiUBqKTtuL+YVC40PVs0TNbhJRmDLa7Jj1wu6MfnDEyT R/87KJydFt4AoCeXL9QKQ2rnlA9Bb9Q5TcysSv5rCnWwljDOZdfnITyLDHRs0jBIVo/I i3HD5VRWCxhRCHT6Go9Yj5C7uLrxlcq50vzAOWRMie73ywdf5Y6vTntXcPFCl6s72YC/ TWlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=meBDGi4ZDcGT9h3TSjFscrqXy/6r/zGJFRNO5LbcqhY=; b=SDTZVMaMAnqFuPf1n0kEY9Ll9kTbOt/GtzkFIu0h1/PvqR+2VKFccNEtCPVFCPzsFu K9yh6cbdKqOh0cHRfW71qMoqIP6374XAtaxHw0PnqpTsi77E/wb6VNQm4kQ7LYATPwzi OmNE/pqXhKW8me0utmYJ7bv/hWivfw0ONly2R1WwB6/MwAwLfdFnokd3BnHgwa9ahuuO USKT2hAmYPVh0ci8ZElaZUvtq3i8e9vbSnzNNkq5fP3Fy0HRPg13NaRGUQIlKtX/j7ZP l4+NC/s3xFLjbISyYENXWzGNRrt7lHyJFCmnnoXqKKOBIEc80224OItlPy/mNnm+4ZxU BdAw== X-Gm-Message-State: AOAM532gJlWT8ZXs0d5brxskQyPdP/dxi4zymx93/rpH8CcKlIFiuSUv Q0AnlA8oPCVH0G+/dg0Rds8HdyrvAw== X-Google-Smtp-Source: ABdhPJwcz6mTE5KHhe9ZFfUfwtUYy5dv22Gpc1p7u/WXCRuPI9q7Ib7rZSU6w1JDuaAGv9Hq36JU5Q== X-Received: by 2002:ac8:45c9:: with SMTP id e9mr876436qto.153.1591927842739; Thu, 11 Jun 2020 19:10:42 -0700 (PDT) Original-Received: from [192.168.43.104] ([172.58.236.143]) by smtp.gmail.com with ESMTPSA id n63sm3441547qkn.104.2020.06.11.19.10.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jun 2020 19:10:42 -0700 (PDT) In-Reply-To: <87ftb1469o.fsf@web.de> Content-Language: en-US Received-SPF: pass client-ip=2607:f8b0:4864:20::82a; envelope-from=d.lewan2000@gmail.com; helo=mail-qt1-x82a.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:123351 Archived-At: I managed to lose the last response to my original question, the one with the case_ macro. Here it is for reference: (defmacro case_ (val &rest list) "(case value (() result1) (() result2) [else result3]) Macro for switch case statement. It test if value is any of the item. If item match the value it will return coresponding result expression value. If no value match and there is else it will return that result." (if (listp list) (let* ((item (car list)) (first (car item)) (result (cadr item)) (rest (cdr list)) (value (gensym))) `(let ((,value ,val)) (if (member ,value ',first) ,result ,(if (and (listp rest) (eq (caar rest) 'else)) 'xxx (if (not (null rest)) `(case_ ,value ,@rest)))))) nil)) I did, however, manage to save the macro and, indeed, it compiles without the max-depth-exceeded. There's an insightful difference from what I was attempting: Instead of invoking the macro directly, here the recursive call is inside a back-tick. Sorry to have lost the mail. My keyboard stutters on occasion and I'm guessing I wound up doing something distructive twice. The point is that I'd like to thank that author. -- ,Doug d.lewan2000@gmail.com (908) 720 7908 If this is what winning looks like, I'd hate to see what losing is.