From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Zelphir Kaltstahl Newsgroups: gmane.lisp.guile.user Subject: Re: guile style Date: Sat, 19 Jun 2021 17:02:39 +0000 Message-ID: References: <7aeef132-6bd7-c178-5786-c0a3d6b3edc8@nycap.rr.com> <1e959322-f5f8-9bc3-ae08-a30165f9f409@nycap.rr.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38306"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-user To: jerry , Christopher Lam Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sat Jun 19 19:03:00 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 1lueN1-0009lf-O1 for guile-user@m.gmane-mx.org; Sat, 19 Jun 2021 19:02:59 +0200 Original-Received: from localhost ([::1]:50722 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lueN0-0003aN-Mc for guile-user@m.gmane-mx.org; Sat, 19 Jun 2021 13:02:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52412) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lueMq-0003aF-UW for guile-user@gnu.org; Sat, 19 Jun 2021 13:02:48 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:48273) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lueMo-0005F0-G4 for guile-user@gnu.org; Sat, 19 Jun 2021 13:02:48 -0400 Original-Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id BF7C82400FE for ; Sat, 19 Jun 2021 19:02:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1624122161; bh=/Q2fO4bW4rcLR5/tSCP3iUtOK+SmLgodV6enTj8CTas=; h=Subject:To:Cc:From:Date:From; b=rLw+wiBZLFtDQIAzQamaa6ufQdFeS0Mt+HGbp7gsxhVjzjLm34NPGqLGk8wB/aZjg yacjp3v82YE9b1y6VjIMErKNzpYhUI2Y7xgCtyafdtn6L0x/OOT8ibBfHD+TdbAb/H S7Et9xRzn4UfjMGuZs/UPDOGeoZFxtctsroP9tQ0Er+KheKLCe+LKPjOD6K9N36qI9 9GH1ZZfO79s0WbpkjIc70jyrghzDT/3wkG212/1Zryr/iX6KHoCXqRp+ODhurcT+xF ME6minY6qhAKV4TDsEWq8knCbnN3R/b2y8PENnS1bVsP1dfjiVeHJWaea+B4GzFk43 devmYleVwFsUA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4G6htS4gNwz6tmF; Sat, 19 Jun 2021 19:02:40 +0200 (CEST) In-Reply-To: <1e959322-f5f8-9bc3-ae08-a30165f9f409@nycap.rr.com> Content-Language: en-US Received-SPF: pass client-ip=185.67.36.66; envelope-from=zelphirkaltstahl@posteo.de; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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:17613 Archived-At: On 6/19/21 2:16 PM, jerry wrote: > 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. I'd be surprised, if Guile did such an optimization. I think you are supposed to write the optimized version of the algorithm. In my opinion, when you know a better version, you should not rely on an optimization by one particular compiler or language. I think it is fine to have small (really small, hopefully not changing time or space complexity class) performance trade-offs in order to achieve better readability. Usually however, I well readable version of the better algorithm is possible. -- repositories: https://notabug.org/ZelphirKaltstahl