From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: jerry Newsgroups: gmane.lisp.guile.user Subject: Re: guile style Date: Sat, 19 Jun 2021 08:16:39 -0400 Message-ID: <1e959322-f5f8-9bc3-ae08-a30165f9f409@nycap.rr.com> References: <7aeef132-6bd7-c178-5786-c0a3d6b3edc8@nycap.rr.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15560"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 Cc: guile-user To: Christopher Lam Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sat Jun 19 14:16:58 2021 Return-path: Envelope-to: guile-user@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 1luZuE-0003v7-Cc for guile-user@m.gmane-mx.org; Sat, 19 Jun 2021 14:16:58 +0200 Original-Received: from localhost ([::1]:52078 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1luZuD-0006lq-F7 for guile-user@m.gmane-mx.org; Sat, 19 Jun 2021 08:16:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59502) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1luZtz-0006hN-QO for guile-user@gnu.org; Sat, 19 Jun 2021 08:16:43 -0400 Original-Received: from impout004aa.msg.chrl.nc.charter.net ([47.43.20.28]:47736 helo=impout004.msg.chrl.nc.charter.net) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1luZty-0008Nw-7z for guile-user@gnu.org; Sat, 19 Jun 2021 08:16:43 -0400 Original-Received: from [192.168.1.8] ([67.241.26.17]) by cmsmtp with ESMTPA id uZtwlZBiXNcdsuZtwlO2wt; Sat, 19 Jun 2021 12:16:40 +0000 Authentication-Results: nycap.rr.com; none X-Authority-Analysis: v=2.4 cv=Pfg6Ogtd c=1 sm=1 tr=0 ts=60cde028 a=6kFUCgT7isY2CrseCyFLdg==:117 a=6kFUCgT7isY2CrseCyFLdg==:17 a=IkcTkHD0fZMA:10 a=SPtnZBpKczQpo7ZxwIAA:9 a=QEXdDO2ut3YA:10 In-Reply-To: Content-Language: en-US X-CMAE-Envelope: MS4xfL0EM2fvnEFYahvLO340LZ6mMiE/R4NFYlu0vlhtqOx21ImTV5XxSpcejUpTx1Vb8MF9I3308wOyPLUy6fR6r/luYzhq3HPa8Jve8WGYhTyj4wofWfZc tqBXN2K4ZjmdCQvdvH6pV21pX3S2ABCsUDzrLut0+r50+CK9EfmFzdZUe2CI0i7qm8qRi3WwR9blyeQrstns7LMqPqk9xfi4qGwnlHfHOqwm2Vj/Km3negJY Received-SPF: softfail client-ip=47.43.20.28; envelope-from=jdinardo@nycap.rr.com; helo=impout004.msg.chrl.nc.charter.net X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-0.202, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:17611 Archived-At: On 6/19/21 7:20 AM, Christopher Lam wrote: > Agree set! is not a desirable form. It is not consistently optimisable. > I cannot find the reference in the manual. > > Also consider the first form: you're building a list in 3 passes -- call > iota to generate a list, call filter to navigate the list again, then > fold to accumulate your answer. Therefore it's O(3N). > > The preferred form is definitely from the little schemer. > Haskell has something called stream fusion which can optimize the extra passes out in many cases. I wonder if Guile or any of the other scheme compilers can do that? As someone who has spent the majority of my life writing high performance C and Fortran code, the inefficiencies in a lot of functional programming is something I don't care for. On the other hand, writing functional code is fun.