From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 122972 invoked by alias); 21 Mar 2017 15:47:57 -0000 Mailing-List: contact kawa-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: kawa-owner@sourceware.org Received: (qmail 122943 invoked by uid 89); 21 Mar 2017 15:47:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=PAT, work, work!, act X-HELO: aibo.runbox.com Received: from aibo.runbox.com (HELO aibo.runbox.com) (91.220.196.211) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 21 Mar 2017 15:47:54 +0000 Received: from [10.9.9.212] (helo=mailfront12.runbox.com) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1cqM0k-0002ae-PT; Tue, 21 Mar 2017 16:47:50 +0100 Received: from 70-36-239-163.dsl.dynamic.fusionbroadband.com ([70.36.239.163] helo=localhost.localdomain) by mailfront12.runbox.com with esmtpsa (uid:757155 ) (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) id 1cqM0k-0000jW-FH; Tue, 21 Mar 2017 16:47:50 +0100 Subject: Re: StackOverflowError in a specialized map To: Damien MATTEI , kawa@sourceware.org, Sudarshan S Chawathe References: <23077.1489759623@vereq.eip10.org> <201703211500.57497.Damien.Mattei@unice.fr> From: Per Bothner Message-ID: Date: Tue, 21 Mar 2017 15:47:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <201703211500.57497.Damien.Mattei@unice.fr> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-q1/txt/msg00090.txt.bz2 On 03/21/2017 07:00 AM, Damien MATTEI wrote: > perheaps some funfamental routines as map* should be written with set-cdr! and loops and never touch them again.... and build functional programming on top of those low level routines... Yes, I think that makes sense. Specifically, I think we should import at least 'filter' from SRFI-1 into the default Kawa environment, and optimize it like we already do for 'map' (which compiles into a loop). Some of the other SRFI-1 function might also be worth adding. The invoke branch has "scan patterns" which act like the ellipsis in syntax-rules patterns: (PAT ...) matches a list (or actually any sequence) assuming each item matches PAT. The following squares each element of a list: #|kawa:7|# (define (sq-list [x ...]) #|.....8|# [(* x x) ...]) #|kawa:9|# (sq-list [5 7 2 3]) #(25 49 4 9) Scan patterns don't support filtering, but I'm thinking an else-less 'if' might make sense: #|kawa:10|# (define (sq-list-pos [x ...]) #|.....11|# [(if (> x 0) (* x x)) ...]) ;; doesn't work! However this has not been implemented. -- --Per Bothner per@bothner.com http://per.bothner.com/