From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.help Subject: Re: Surprising behaviour of 'append' with string Date: Sun, 06 Nov 2022 18:22:06 +0100 Message-ID: <8735aw577l.fsf@gmx.net> References: <17b9a480-cff1-212e-7d8a-894285d03646.ref@yahoo.de> <17b9a480-cff1-212e-7d8a-894285d03646@yahoo.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15930"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: help-gnu-emacs@gnu.org To: "R. Diez" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 06 18:22:55 2022 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 1orjMF-0003uf-8a for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 06 Nov 2022 18:22:55 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1orjLZ-0006gY-BV; Sun, 06 Nov 2022 12:22:13 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1orjLX-0006g1-4k for help-gnu-emacs@gnu.org; Sun, 06 Nov 2022 12:22:11 -0500 Original-Received: from mout.gmx.net ([212.227.15.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1orjLV-0006um-9P for help-gnu-emacs@gnu.org; Sun, 06 Nov 2022 12:22:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417; t=1667755326; bh=hSqlmO8u73dTNkrWqWw/yGmZdx/kAE8TTFhCEWp6DAY=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=mBj3CcNk4P4Mo80rTPoOycW9eImezBLHSKLJZH98SMmTZkFP6Pqtr7HKPNeqMh7rr M8VzAu80wok5Sw/GNgQlPf+XuNVQcbl/tFfaSUfyPsonOwTUv+p/+BiS2Ak43klz2L Teb9Kqr6KXn5A+IQpGtws2asF+6uhSLAJhs7+MDysGEr6CLj8jWlppJ6fdUZ67zSXM Ahwn7vK2e9kX5wVRjdfavO0pWPD7pZASTHwb6lbt3+lGNIrMAFZx584qOrQ5eyOdkp APQHbB6dBoKS0BzhGavO1xV/NgcFHpMTIN4ptgnI105pmWTsAdCDnjPobu0bSZ4pz3 wP0TT6jKtsUEA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from strobelfs ([89.246.38.100]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MlNpH-1pIlgh2V13-00ljjh; Sun, 06 Nov 2022 18:22:06 +0100 In-Reply-To: <17b9a480-cff1-212e-7d8a-894285d03646@yahoo.de> (R. Diez's message of "Sun, 6 Nov 2022 17:02:48 +0100") X-Provags-ID: V03:K1:keGT2lkFve9dm/Yxq6ILNkQ+1czDMsMnEDuh9V/vjXnLE3iZgX3 juLBuf8idT5IdRZ4KsDS6CkIIWw7VtIqzwqVVOPGI1Pg4ZtfsKRg2fTqIPl72AsBDVpkjsF ux+z9rVTkSzu2uNazDcahyTqZS0n0TFWOEV7fag83akLCnp5CN7Y72aHkl6exCpc3jKx2kX s/IKmkGT8PcystuMkErrg== UI-OutboundReport: notjunk:1;M01:P0:m7LoQmfLFC8=;1H846/x1f8qwv1EdTw1FXvl4qcB 1iC3IgkR5i61WlGLp7Lh0ph7yh9QrCrGW0+WzVCuKAhpuvPAKASgUJSozzogzoYCM32eVzmaH DQAVLMahbDnecElkTldOdzcHRxe1I/lQTyhFtbM0vadJK/7ajn4Qmq35bTsejgM/Fe9PG6t41 zV1m9iLk/dxcsqlD6WYgFLH+bQpZ3NrbXEkczaapzvyxmys66i4CVUa1b/nz2PuUA+c96R943 wwPq0Nv1DAx9jk5oYrVhyQpU3WkZkH3sGGhjWadz+AnvsGK0bERG5f/REoiXc65556KowAmZ6 GRmXsUmUgxCL6rX1ivwuPGvKCWkxE/a1oUdtjGtCFaXGX/4ZtKi1S82XNW1zlaz1uvNdFp8X9 K7jXdfRCN6Y1R3Tjf/nrVadfflYlHSMiVVSSX/oTUWnm+H2QVNkxaJWM3htfh5DVITcSrE4zZ jECZkfX54EBCZ5zqFl2GYN82mDPCOOWpxXvkb0lAYy3vQvEGKzDZpGYaQJk4eqAPuC3o3EgTk kXvyWC1tOWFvBsQGyL9AeKN7lh1vJCiJz2LZHT5bPFC0hiGDompVuQKLDMkUhCgDYlE1duk6f Se4eoTi7FTvktTYEtbbHdrEwX5y1rDUk76hkEwg7j9NnJRyHbYEZowfgAAG0aisFINRBRl0Dw FgwvkPFbKytld3QhP3pVm9igfnGMKiI6sdFcguCkbi1ZmOZ1KKLu9fnnRm/Xm7YE0hRnLhSQ1 O8LSZdz82WensxVzGjE7TOEfGcuiet2OfIDHcUfe3HjKST1mmiHkuI5pYTH3kYa/2HuZcX2N Received-SPF: pass client-ip=212.227.15.15; envelope-from=stephen.berman@gmx.net; helo=mout.gmx.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 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-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:140741 Archived-At: On Sun, 6 Nov 2022 17:02:48 +0100 "R. Diez" wrote: >> then flatten-tree should do the job. To also check that the elements >> are either a string or a list of strings, you could use this: >> [...] > > Thanks for your help. Your routine fits the bill perfectly. Glad it helped. > Don't you think that 'append' and its documentation are not really > user friendly? Its behaviour is not what you would normally expect. It > doesn't make sense to join list elements with the first characters of > strings. `append' operates not just on lists but also vectors and strings. And with the latter it's not just the first characters that are appended: (append "this" "is" "a" "test") => (116 104 105 115 105 115 97 . "test") t h i s i s a Each element of each sequence -- in this case each character of each string -- is appended -- except for the last string, which, as the doc string says "is just used as the tail of the new list". > At least some example and/or warning about it would prevent unwary > users like me from wasting time and feeding the general sentiment that > Emacs and Lisp are not user friendly. I'm only saying this as a hint > to improve the situation for other users (to improve Emacs). I am now > fine myself with regards to 'append', thanks to your code. There are examples in the Emacs Lisp manual. Perhaps you are familiar with an append function and string data type in another programming language and assumed they work the same way in Emacs Lisp. Consulting the manual may help further. Steve Berman