From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 4E9sNuB3VmMndQAAbAwnHQ (envelope-from ) for ; Mon, 24 Oct 2022 13:32:49 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 6MZXNeB3VmPJJAAAG6o9tA (envelope-from ) for ; Mon, 24 Oct 2022 13:32:48 +0200 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 8D5255AC4 for ; Mon, 24 Oct 2022 13:32:48 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1omvbl-0003Lh-S8; Mon, 24 Oct 2022 07:27:05 -0400 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 1omvbk-0003LI-2z for emacs-orgmode@gnu.org; Mon, 24 Oct 2022 07:27:04 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1omvbi-0002Ek-BV for emacs-orgmode@gnu.org; Mon, 24 Oct 2022 07:27:03 -0400 Received: by mail-wm1-x32e.google.com with SMTP id t4so6340759wmj.5 for ; Mon, 24 Oct 2022 04:27:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-language:references:to:subject:from:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=sl3yfkJt7dProkARrktvaQGafFxylwRaRGOoH9K4Ops=; b=LDeuOUxZvi+++9qALQs1o7HNLgZndUUdvjb3/SiaaRjNnW0+spjxiCGuPXPiW3fu29 VcV56/EglCYbxJRobZoF/1wkPxyIrES3fUJATjl/h/N8JxXU+opg3jE9IahNGPXf73uI XpIBjPm5l02/x5IRHh8KpE/Xb33+vvrJv3WkkT7yE+tmKqFeGr8lYvO+xX6I0Nex+swg XzQ/rikVAaBK34kYl5nbuBRCiuXf40oDSknr9liruGsEk9QqQ8kCfJuXCp5DG94gUy9V aMU6TDU9/nsKRUGZHgA4AnMj7gaC0YFGqxqnOPu4hhUHAmMWhA1aPoaZgp6zcFY+mYzK yetQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-language:references:to:subject:from:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=sl3yfkJt7dProkARrktvaQGafFxylwRaRGOoH9K4Ops=; b=tuX9rB/WKkQelfQIzl2wjzstAH11tMY7SIBkcRNKJ5QuupSwBGwtKoRFvQw4wvuR71 m5wbfpCMda7YoiVGiYx/l/Fwg32ju1ocyIHpBHCAsBI8/mzMQNCaT3VYRjMjof8l7VPg 8dbmeF95DokGbHi+QdcW+VMpzVq3PG4U33rt6yUPsR52oDuisPYIq76kaQ2PM5A6Z2HB ukNjmABFCJxM7rNmn00zfgx08vX89YsLinYuC2IAWV6tplNjaSG8/D3vX+yMx664WlPH eZx+Uc7kBQs4Y+EGJANvR1UYlvjQF1TdR4A5+d/Krk/TyMvYGEz/g7N4po5aoor5CZ8i 3bgQ== X-Gm-Message-State: ACrzQf0D3PJhKCcm1uV91xAsVUCqmNkordC4rFd70zPgC9aLXrZX7FZS ydzNnV7ISeelOEMTF7ewW7Yk6Hne3vE= X-Google-Smtp-Source: AMsMyM4li+FvZXPeZr+iKS9H0nZLo/j63ti9KwydiKHZeiyPJ11b8PvieaDGPznuBhlprDiEJZUA9A== X-Received: by 2002:a1c:e90b:0:b0:3b4:fb6c:7654 with SMTP id q11-20020a1ce90b000000b003b4fb6c7654mr21739117wmc.98.1666610820135; Mon, 24 Oct 2022 04:27:00 -0700 (PDT) Received: from [192.168.1.111] (59.82-130-209.dynamic.clientes.euskaltel.es. [82.130.209.59]) by smtp.gmail.com with ESMTPSA id p8-20020a05600c468800b003c452678025sm8239174wmo.4.2022.10.24.04.26.59 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 24 Oct 2022 04:26:59 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------0NFdrWSPptPg19CaOfiMdhGd" Message-ID: <9d1c1bae-1928-26c3-2c6e-add6e664f793@gmail.com> Date: Mon, 24 Oct 2022 13:26:58 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 From: Ypo Subject: Re: LIterate programming with calc (help) To: Org Mode List References: <87r0yxr6wm.fsf@ucl.ac.uk> Content-Language: en-GB In-Reply-To: <87r0yxr6wm.fsf@ucl.ac.uk> Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=ypuntot@gmail.com; helo=mail-wm1-x32e.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, NICE_REPLY_A=-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: , Sender: "Emacs-orgmode" Errors-To: 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=1666611168; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=sl3yfkJt7dProkARrktvaQGafFxylwRaRGOoH9K4Ops=; b=pdtAYNycpuWLyweQix+Pdw94XXxrHmmNVX/cqVQoNoEq/WGt4ArtS434UzaSnG1oz6FQJW HIQLDDzYjje5z3kj5ioYboEUD+Obh97jqGhk2fhnBR4TsttQoviB5maZng7GyyLSP4DNhU DbBZyzP+45pUAKTtIe5uT+HjoSHUYlze44IykU4GUTF5vmelxeaLaqnQsdn8Y92FD8c6V6 ZjCMzTzjvzQenmaUO5xJuzaicRIUUObIdDObXNsHlKO0RD8VQ71y+dZ9nWS67kMlhAPlJq exv9EPP26PRzeZiGmoyMXfkt9iyoYT7ueZGNUwuDYC/MBduOZD6K7p5U3qgOUQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1666611168; a=rsa-sha256; cv=none; b=iC/9RG3P4rXQ7N8K3Q9eG5fBo2UHiqsTHlxC/rZDEI6WaWRUuybLf9jZt4NJVCmxc3wWCR 4o1qUqGR8rZNDpY3CLhLz9m4u9iXw3JUUhPW29bxXpEJN7n/lSL7+ImLlITDq6HjB9kH9T A+svdyJECPieYoCyycgZpAMrz3qUyIjiMK859Ym9mjMHhtDx+Qlb57NLcq4DfqZOUIn2sv JNBzQVAEAmESDR9hDW1olmt4RF7iPbeiuTCYc3qzYmk5/6UdnVh9kNTWejTF0abBixpnLT 6drLKZ9lQhkBhB7rlNFl0SOEU/SSk8DDHOUQDrqe3wEEHfJrpzYrL9Ypk8jvTg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=LDeuOUxZ; 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.40 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=LDeuOUxZ; 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: 8D5255AC4 X-Spam-Score: -2.40 X-Migadu-Scanner: scn1.migadu.com X-TUID: 3MtnuWgq5eSN This is a multi-part message in MIME format. --------------0NFdrWSPptPg19CaOfiMdhGd Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Not bad, thanks!!! Why do you think it doesn't work something more human readable like this? #+begin_src calc                solve([                a = 300 m,                b = 300 m,                Area = a*b,                cost = 1 (USD/m^2),                z = Area*cost                ], [a, b, Area, cost, z]) #+end_src Best regards El 24/10/2022 a las 9:56, Fraga, Eric escribió: > On Sunday, 23 Oct 2022 at 14:15, Ypo wrote: >> Is it possible to express in a calc block some basic operations with >> variables and non-predefined units? >> Why A*c won't show an arithmetic result, but ~: A c ~? > I've never managed to get calc blocks define variables. The equations > you have typed in are "equations" in the mathematical sense, not > assignment statements. > >> Is it possible to work with the "$" unit? > $ means something specific in calc (cannot remember what). I use "USD" > instead, for instance, and it works fine. > > The following single line calc block does do what you want: > > #+begin_src calc > solve([a = 300 m, b = 300 m, Area = a*b, cost = 1 (USD/m^2), z = Area*cost], [a, b, Area, cost, z]) > #+end_src > > #+results: > : [a = 300 m, b = 300 m, Area = 90000 m^2, cost = USD / m^2, z = 90000 USD] > --------------0NFdrWSPptPg19CaOfiMdhGd Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Not bad, thanks!!!

Why do you think it doesn't work something more human readable like this?

#+begin_src calc
               solve([
               a = 300 m,
               b = 300 m,
               Area = a*b,
               cost = 1 (USD/m^2),
               z = Area*cost

               ], [a, b, Area, cost, z])
#+end_src


Best regards


El 24/10/2022 a las 9:56, Fraga, Eric escribió:
On Sunday, 23 Oct 2022 at 14:15, Ypo wrote:
Is it possible to express in a calc block some basic operations with
variables and non-predefined units?
Why A*c won't show an arithmetic result, but ~: A c ~?
I've never managed to get calc blocks define variables.  The equations
you have typed in are "equations" in the mathematical sense, not
assignment statements.

Is it possible to work with the "$" unit?
$ means something specific in calc (cannot remember what).  I use "USD"
instead, for instance, and it works fine.

The following single line calc block does do what you want:

#+begin_src calc
  solve([a = 300 m, b = 300 m, Area = a*b, cost = 1 (USD/m^2), z = Area*cost], [a, b, Area, cost, z])
#+end_src

#+results:
: [a = 300 m, b = 300 m, Area = 90000 m^2, cost = USD / m^2, z = 90000 USD]

--------------0NFdrWSPptPg19CaOfiMdhGd--