From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id AD7EA24C8E for ; Sun, 14 Jan 2024 16:37:48 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1705246668; b=D8lzHLDoCF5RmT+JhfaXZt9Fr9wIZkN4Nz5IUjuZvzSIHA8Zq8UQT/HsbI2yDRyrztZ7U5nMON DmbJHGcrmFn/L4BC6rT8t7um8IaXbmzizmkOBit8QZjsAYF3aS3CrLwVJshoVdbMGIk6KHfLi3 Ts1logEax5lLRuVVkM662PzpMjKMI7I4ZPzMQfe0f4cmpQawapOXLWjLOdrH06hW8zBUPerOEQ 65X8WGs1b38ZmbyfnS8/hn5oXPdmc/LwTd/UXAQhZCZuVICH+cstqDto+qSNeTXM6w/sJVLOpC qNJjv0NEqhBErETsscNKVeX2cxjuMU/Xc9B/P0lix32jrQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mta04.eastlink.ca) smtp.remote-ip=24.224.136.10; dmarc=none header.from=eastlink.ca; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1705246668; bh=u1zES9R0azS13LFv1GLN9OWfKZOdPQXn3YdNqQ/+EPg=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:From:References:To:Subject:MIME-Version:Date: Message-ID:Content-Type:DKIM-Signature; b=qxmWLiXCElRvalfLDFIAVRA12NZ98mMovM31l+2aIeFA+Gn0bbZjy1bQp8qcbRWnFf+N5bn2+p r5zu2Xqog1jFlh8kYNjzkqOXLtrbjKO0dI1nV6lI/BMdHUKSdrYQRWz5I5KKUCdZYkGrqe3MEB ulMOPR+hrhvp5SHoP1Cddgl1iIWqfv9p1g0NRunLEQnrDgXfV5g8w7vqsms6gDsxhSz/vzGwSd 5leiPLYuUUhin/86d1IakUMSm78Prypv452sjx/KyiVp2nLrY+omXJsma0Hoq9K+p/GOGeAPwh usgAPMd/cm3mV0ZB85edG/P32xIHEdW8c7XVqEzywI3YQQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-reply-to:From:References:To: Subject:MIME-version:Date:Message-id:Content-type:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=cuX05G14B0QldyzAh7y5HmdZe4gN6hEKUSQAPLcSzds=; b=rImHXLvGsv+jCC+c4HkymVWPyP 3zj5oKSLRuxXJIq7+KTRBKyHTj6ZgzTblZSaNFqrIJO/VNiC26b7sWZoYcv/k353Fj6w2EkZCV97a bPr6Z4NWaMmX/fQeA5QhVZtLNPEa7tFsGx+ZWBYrKpGsW5JO3yTq8am/ggu7jLrtcouXQNNiuEd8u uz9IVT0h5l8Ci5Dsl+K3fKHvsKZembK9o8+zoG9BeKQcby10ukuazVJGHHbj2sukiG+Du6NFu1vwC i2gofkPUsVwXibhozQrVwRGF3Yh/xsTKLLZNRtE88iHgzARtQZf/GnDfveD3OO4aWa3UW4+F32o7s LRXGfuEw==; Received: by zero.zsh.org with local id 1rP2YU-0005rS-RA; Sun, 14 Jan 2024 15:37:46 +0000 Authentication-Results: zsh.org; iprev=pass (mta04.eastlink.ca) smtp.remote-ip=24.224.136.10; dmarc=none header.from=eastlink.ca; arc=none Received: from mta04.eastlink.ca ([24.224.136.10]:54839) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rP2Xf-0005B4-V7; Sun, 14 Jan 2024 15:36:56 +0000 Received: from csp01.eastlink.ca ([71.7.199.166]) by mta04.eastlink.ca ([24.224.136.10]) with ESMTPS id <0S79063L9CL4FSN0@mta04.eastlink.ca> for zsh-users@zsh.org; Sun, 14 Jan 2024 11:36:54 -0400 (AST) Received: from [192.168.0.11] (host-24-207-19-13.public.eastlink.ca [24.207.19.13]) by csp01.eastlink.ca ([71.7.199.166]) with ESMTPSA id P2XdrxoZPAItUP2XerELFQ (version=TLSv1_2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256); Sun, 14 Jan 2024 11:36:54 -0400 X-Authority-Analysis: v=2.4 cv=NJYTuW2g c=1 sm=1 tr=0 ts=65a3ff96 a=e7T7DzMKK1R988ZCg0wLyw==:117 a=e7T7DzMKK1R988ZCg0wLyw==:17 a=r77TgQKjGQsHNAKrUKIA:9 a=AZ4wXcR3obeIDNVcA84A:9 a=QEXdDO2ut3YA:10 a=eoWykwFi5cTKE7VNcKEA:9 a=etMfGjTwVzYH6wOo:21 a=_W_S_7VecoQA:10 X-Vade-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdeiledgjeekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecugfetuffvnffkpffmpdfqfgfvnecuuegrihhlohhuthemuceftddtnecunecujfgurheptgfkffggfgfuvfhfhfgjsegrtderredtvdejnecuhfhrohhmpeftrgihucetnhgurhgvfihsuceorhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrqeenucggtffrrghtthgvrhhnpefhteethfevgeeuvdelgefgvdevudefueduffdvgfelvddvgfdtieegueeuleeifeenucfkphepvdegrddvtdejrdduledrudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvdegrddvtdejrdduledrudefpdhhvghloheplgduledvrdduieekrddtrdduudgnpdhmrghilhhfrhhomheprhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrpdhnsggprhgtphhtthhopedvpdhrtghpthhtohepreerpdhrtghpthhtohepiihshhdquhhsvghrshesiihshhdrohhrghdpghgvthdqkghiphfrrghsshifugepthhruhgv X-Vade-Score: 0 X-Vade-State: 0 X-EL-AUTH: rayandrews@eastlink.ca Content-type: multipart/alternative; boundary="------------YXiRA9pJJu2ns9PMGTDbBMWX" Message-id: Date: Sun, 14 Jan 2024 07:36:53 -0800 MIME-version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Slurping a file Content-language: en-US To: zsh-users@zsh.org References: <205735b2-11e1-4b5e-baa2-7418753f591f@eastlink.ca> From: Ray Andrews In-reply-to: X-Seq: 29474 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: This is a multi-part message in MIME format. --------------YXiRA9pJJu2ns9PMGTDbBMWX Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2024-01-14 02:34, Roman Perepelitsa wrote: That's a master class.  I'm going to save that post and absorb it even if it takes a month. > Indeed, this would be faster but the code would still have quadratictime complexity. Here's a version with linear time complexity: Quadratic? In this kind of situation I'd understand linear, geometric and exponential. What's quadratic? Hmmm .... to guess ... well yeah, you must mean some combination -- an exponential vector + a geometric vector + a linear vector, yes? My math skills aren't up to it, but they say there's a way of throwing a progression like those into an engine that returns the quadratic that best fits. Great fun if one could find it. Actually I did that once in Geogebra. Please let me know when yourself and Bart have a final cut of slurp -- for a guy like me who thinks a copy should be a copy, not an edit, slurp seems an essential tool on principal. I can't understand how something so basic could not be built into the shell. Seems to me that at a first estimation one might want: 1) Full exact copy -- byte identical including blanks, newlines, trailing stuff and naughty chars. slurp. 2) Byte identical up to the last 'real' character -- yes, strip off any trailing garbage. This would be: > % copy=( "${(@f)original}" ) < , yes? Good enough 99% of the time. 3) As it is now -- no blanks. I myself have arrays in which blanks must be preserved ... Hey ... How does all that work with associative arrays? It's one thing to remove a blank/empty element in a normal array, but in an A array ... even when there's no value, the keyword is still there, no? I'm thinking that A arrays must be auto-immune to removal of blank values, yes? But ... main[currentE]=1 # Absolute index of the highlighted element (returned to calling fce on ENTER or mouse click). main[hilighted]=1 # RELATIVE index of the highlighted element relative to top of current page. main[hilighted]= # Don't even think about doing this! ... I've noticed that if initializing an A array, there *must* be a value otherwise the pairs go out of whack. So, really, there never is an empty value and the issue is moot. --------------YXiRA9pJJu2ns9PMGTDbBMWX Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit


On 2024-01-14 02:34, Roman Perepelitsa wrote:

That's a master class.  I'm going to save that post and absorb  it even if it takes a month.

> Indeed, this would be faster but the code would still have quadratic time complexity. Here's a version with linear time complexity:

Quadratic? In this kind of situation I'd understand linear, geometric and exponential. What's quadratic? Hmmm .... to guess ... well yeah, you must mean some combination -- an exponential vector + a geometric vector + a linear vector, yes? My math skills aren't up to it, but they say there's a way of throwing a progression like those into an engine that returns the quadratic that best fits. Great fun if one could find it. Actually I did that once in Geogebra.

Please let me know when yourself and Bart have a final cut of slurp -- for a guy like me who thinks a copy should be a copy, not an edit, slurp seems an essential tool on principal. I can't understand how something so basic could not be built into the shell. Seems to me that at a first estimation one might want:

1) Full exact copy -- byte identical including blanks, newlines, trailing stuff and naughty chars. slurp.

2) Byte identical up to the last 'real' character -- yes, strip off any trailing garbage. This would be: > % copy=( "${(@f)original}" ) < , yes? Good enough 99% of the time.

3) As it is now -- no blanks. I myself have arrays in which blanks must be preserved ...

Hey ... How does all that work with associative arrays? It's one thing to remove a blank/empty element in a normal array, but in an A array ... even when there's no value, the keyword is still there, no? I'm thinking that A arrays must be auto-immune to removal of blank values, yes? But ...

main[currentE]=1 # Absolute index of the highlighted element (returned to calling fce on ENTER or mouse click). main[hilighted]=1 # RELATIVE index of the highlighted element relative to top of current page.

main[hilighted]= # Don't even think about doing this!

... I've noticed that if initializing an A array, there *must* be a value otherwise the pairs go out of whack. So, really, there never is an empty value and the issue is moot.

--------------YXiRA9pJJu2ns9PMGTDbBMWX--