From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id wPlJLnh1gmP6igAAbAwnHQ (envelope-from ) for ; Sat, 26 Nov 2022 21:22:16 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id eG9oLXh1gmMpcQAAG6o9tA (envelope-from ) for ; Sat, 26 Nov 2022 21:22:16 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 3FBF03858D for ; Sat, 26 Nov 2022 21:22:16 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oz1fw-0007fd-1F; Sat, 26 Nov 2022 15:21:24 -0500 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 1oz1fu-0007fN-EB for emacs-orgmode@gnu.org; Sat, 26 Nov 2022 15:21:22 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oz1fs-0004l4-E5 for emacs-orgmode@gnu.org; Sat, 26 Nov 2022 15:21:22 -0500 Received: by mail-wr1-x436.google.com with SMTP id b12so11230430wrn.2 for ; Sat, 26 Nov 2022 12:21:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:content-language:subject:to:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=8ttNqhFgNCCvCtgtmX8+vzlDcxaCJ+wslabeEp4jP+4=; b=G0HbKPMiKf4CYgieCjIbQzs06YrB1tZT84BziEtvFWXPVmgPZ+r3xqJwGnA4NNurrq 9j6dGf6FplJn9Dk88MijMTMtUUTKOXvuO2l4XDocqiQxq+7lMyW0bncixbMHarhrR2nm hRL/l3Ya+Rd/nPfqFBg1TCqYEbpyjmbcS/kQH4zqmlfEIPUQM9VZxscWjoTLa5h/nZiw EjrgtZGracFOrq92R5xqhcdG4eonNtFTnCYa1PVlGbqNOBiIfTsmeOsTq+agR7tofE7R nuhahVUPhaDOSYE0mGz29Bzwjy1ZTHqvnDt0DJCNfa2+7OgV/j4YmGVBecqL+DsADRcq JHPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=from:content-language:subject:to:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8ttNqhFgNCCvCtgtmX8+vzlDcxaCJ+wslabeEp4jP+4=; b=ma6WecLX5bPo0Bl/OUpy98Hg4e2DSRpY63KVM0aeqxVRB/EoBKPm8xiRUlyHpQxlaF gYmVKCvs3PzLWsk6iAThh4zhMSiVFmqZgUb5h7o9QD6ADLqxF00ihyd9OMxLfm8XkfN9 p63Y4S3jLMECf6FfgX5QQiw16HWeWQyKAE3cPvCJzYZaJiuFrMxSWw7ZjyvHcoK3NTAj EzhRWipl8v8WHd75JF2JViIBhT/KWE5iY3pwIRLzDyR5WJhdULU2BFqKJKJcZm9/43vD yRJN0qHhOfZXoV/VzlloEDYPz10BFrHrNKAXrfyKS3G/UCIHGAAjjON1Z0Fz1cVijgaS TgBQ== X-Gm-Message-State: ANoB5pnou13k1scW9lxascFvjPNh2RtEnbWmPKyiuWkwXGp3NWpdBoVP CLWX8Y1MFps51wowwyqQQGQ= X-Google-Smtp-Source: AA0mqf4f7QsdXOAS84X6zVjv7Xp13B8VCGj04qyjIRSh3aOm05R+kJcOa/C+p3ECr3w+pkRM2BYUpQ== X-Received: by 2002:a05:6000:1a41:b0:236:f365:b778 with SMTP id t1-20020a0560001a4100b00236f365b778mr27777707wry.515.1669494077508; Sat, 26 Nov 2022 12:21:17 -0800 (PST) Received: from [192.168.0.97] (static-236-73-225-77.ipcom.comunitel.net. [77.225.73.236]) by smtp.gmail.com with ESMTPSA id g3-20020adffc83000000b0024207ed4ce0sm3860224wrr.58.2022.11.26.12.21.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 26 Nov 2022 12:21:17 -0800 (PST) Content-Type: multipart/alternative; boundary="------------izljlextZ4UI4IqWUDrLqG0S" Message-ID: <00433561-9e8a-0b8a-fe2c-5954a3787b44@gmail.com> Date: Sat, 26 Nov 2022 21:16:47 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 To: yantar92@posteo.net, Org-mode Subject: Re: LIterate programming with calc (help) Content-Language: en-GB From: Ypo Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=ypuntot@gmail.com; helo=mail-wr1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1669494136; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=8ttNqhFgNCCvCtgtmX8+vzlDcxaCJ+wslabeEp4jP+4=; b=aIkKcvWT1wVWxevPSZnE3ZgYYXRvdRv6jm+djv/iSUmAOleL3uH3eoVhlDQk3SicWLfrxR 6+93vEPPDgzHb1uG6c5X6u5umZ20UjoKycol2jUdAQgu79PRE9TXYW8ADyzKRNXxcURsNO Fs07EF49VFjHVxmOLOETKy+hZY1622cN3zbqiX1D42TFoV20DgYFrsfvPRqwP4dqCxe1aG 5rFXS97kbNE587CWYLRrhJcIptGp7X1ctivBGgyXHdrSp04uyx47WQAswBeXRf/4rp2e/g CseVE6MSGlBMEp4iwgmUvwY/OT/WxvzKLqIawaUqZMCe9p78okxRbFbBWsimhw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1669494136; a=rsa-sha256; cv=none; b=U8owUmK/TuBwW5wYDJAub48R5cGzJxDtAFv3bwas6uJwhcjWX4f4dQDh9WxF4SwXzEdnvZ g1EwTaJooYbiW9VFIvwXo9Smgg0Fdl83JQpAU+QvgD7YnF5ceJnSLn7aFVm/E5jbu4ooL4 TBNNlpD1F413YJUE4sTCiVeMZHH5T0tWPk7/kzzD2T+mcE2Kuno+Yba0dx8uW9uwge5ONc pfrkKkDqhZOpO4PTcu1hGuQOdh9bSbMzuQUuo3uP9DFnokT6XqgdxFu+H2OSlcoj+3dI2s 2RKhB3JXa6QJEFpIrMRaWGT7YzRCYqVvmc+VTS6lxli/ih3x/wp6bxv8E0wGCg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=G0HbKPMi; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.97 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=G0HbKPMi; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 3FBF03858D X-Spam-Score: -2.97 X-Migadu-Scanner: scn1.migadu.com X-TUID: eU7J2oFf+0Ma This is a multi-part message in MIME format. --------------izljlextZ4UI4IqWUDrLqG0S Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Just in case you find this package interesting. Except some problems with units conversion, it's nice: https://github.com/sulami/literate-calc-mode.el > This is a literate calc file. > > Lines without "=" are ignored. > > All results starting with "=>" are an overlay generated by > literate-calc-mode. That means they are displayed in Emacs, but not > actually in the buffer/file contents. > > We can calculate a value like so: > > = 2 + 2 => 4 > > If there is any string on the left hand side, it becomes a bound > variable. > > Pi = 3.14159 => Pi: 3.14159 > > We can use this variable below the definiton. > > Tau = Pi * 2 => Tau: 6.28318 > > Results are calculated using Emacs' own calc, so you can use formulas > as well. > > = round(Pi, 2) => 3.14 > > Later bindings shadow earlier ones: > > Pi = 3 => Pi: 3 > > = Pi => 3 > > Variable names can have spaces as well: > > Monthly Expenses = 500 => Monthly Expenses: 500 > > Monthly Income = 1000 => Monthly Income: 1000 > > Annual Savings = 12 * (Monthly Income - Monthly Expenses) => Annual Savings: 6000 > > All values are recalculated on every update in a spreadsheet-like > fashion. > > Calc also has a lot of advanced features, like arrays: > > Numbers = [1 2 3] => Numbers: [1, 2, 3] > > = 3 Numbers => [3, 6, 9] > "Fraga, Eric" writes: > > >/> I guess that the main problem is that calc is tightly integrated with/ > >/> interactive commands. Maybe ob-calc could be extended to somehow/ > >/> indicate the commands to be executed in addition to inputting stack/ > >/> entries./ > >/>/ > >/> Not sure if there is much interest in such feature though./ > > > >/Thinking out loud, what would be better, but I have no idea how feasible/ > >/it would be, would be to have ob-calc make use of the embedded calc/ > >/functionality and syntax, so that you could write something like this:/ > > > >/#+begin_src calc/ > >/a := 300 m/ > >/b := 2 a =>/ > >/#+end_src/ > > > >/which would output the result of any line with => on it./ > > I am CCing Tom Gillespie, the maintainer of ob-calc. Maybe he has > something to say. --------------izljlextZ4UI4IqWUDrLqG0S Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Just in case you find this package interesting. Except some problems with units conversion, it's nice:

https://github.com/sulami/literate-calc-mode.el

This is a literate calc file.

Lines without "=" are ignored.

All results starting with "=>" are an overlay generated by
literate-calc-mode. That means they are displayed in Emacs, but not
actually in the buffer/file contents.

We can calculate a value like so:

= 2 + 2 => 4

If there is any string on the left hand side, it becomes a bound
variable.

Pi = 3.14159 => Pi: 3.14159

We can use this variable below the definiton.

Tau = Pi * 2 => Tau: 6.28318

Results are calculated using Emacs' own calc, so you can use formulas
as well.

= round(Pi, 2) => 3.14

Later bindings shadow earlier ones:

Pi = 3 => Pi: 3

= Pi => 3

Variable names can have spaces as well:

Monthly Expenses = 500 => Monthly Expenses: 500

Monthly Income = 1000 => Monthly Income: 1000

Annual Savings = 12 * (Monthly Income - Monthly Expenses) => Annual Savings: 6000

All values are recalculated on every update in a spreadsheet-like
fashion.

Calc also has a lot of advanced features, like arrays:

Numbers = [1 2 3] => Numbers: [1, 2, 3]

= 3 Numbers => [3, 6, 9]


"Fraga, Eric" <e.fraga@ucl.ac.uk> writes:

>> I guess that the main problem is that calc is tightly integrated with
>> interactive commands. Maybe ob-calc could be extended to somehow
>> indicate the commands to be executed in addition to inputting stack
>> entries.
>>
>> Not sure if there is much interest in such feature though.
>
> Thinking out loud, what would be better, but I have no idea how feasible
> it would be, would be to have ob-calc make use of the embedded calc
> functionality and syntax, so that you could write something like this:
>
> #+begin_src calc
> a := 300 m
> b := 2 a =>
> #+end_src
>
> which would output the result of any line with => on it.

I am CCing Tom Gillespie, the maintainer of ob-calc. Maybe he has
something to say.

--------------izljlextZ4UI4IqWUDrLqG0S--