From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eduardo Ochs Newsgroups: gmane.emacs.help Subject: Re: Elisp function that performs numeric computations Date: Wed, 19 Jan 2022 14:31:12 -0300 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26694"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Help Gnu Emacs To: fatiparty@tutanota.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 19 18:44:07 2022 Return-path: Envelope-to: geh-help-gnu-emacs@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 1nAF0A-0006kz-WA for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 19 Jan 2022 18:44:07 +0100 Original-Received: from localhost ([::1]:59174 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nAF09-0001Gh-To for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 19 Jan 2022 12:44:05 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:47146) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nAEnz-00049o-1O for help-gnu-emacs@gnu.org; Wed, 19 Jan 2022 12:31:31 -0500 Original-Received: from [2607:f8b0:4864:20::433] (port=41949 helo=mail-pf1-x433.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nAEnv-0002LC-2r for help-gnu-emacs@gnu.org; Wed, 19 Jan 2022 12:31:30 -0500 Original-Received: by mail-pf1-x433.google.com with SMTP id q25so2921106pfl.8 for ; Wed, 19 Jan 2022 09:31:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0pCcxpqJOCbOMXAYoRSzIUzkMt9t8sdtTn5tBoVfD+s=; b=oIrbGYC38gTlDzZvIOM3Cadwhno553+ydDztqZuOE88AfupQpcLWlfBpdQls5f1RGp VB4V5MZorcfopQZ66wJ29dl8QQ25dqyRAxPPnrRYyrOsr6h9uBaEvsPnloOV3ePzT+ry SWmd2zkDGGVvZP0nbmg1LupgwnBoKaxmIYuWhnKzzua+izNPbOFiBmmomhB4azGnI7pN 698iSXYF6QYRc0dhDFXz1DIkAPpoMB+eYei6Nz+qLf4SxwAipOoZiwJFmdVnwLwU05L2 CGvYMu6GyuM6DkwT5IrrpwitotxBgwrPNkHyVxzn4qaeH0soqFjmaBqWii5dHPjjGG4U I13w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0pCcxpqJOCbOMXAYoRSzIUzkMt9t8sdtTn5tBoVfD+s=; b=Fg3Z0ETWO5XNLVwUfQVOslCTzi53w+kcP0mNfWnOXMvo0S7QuJqnWicW6oWnxCxRI2 R5TyPKEWpiKcBbPLo1gc1b/P8rhhfcpBNvh8EQ/7f5HWsWaFN6tRtyLzBISIFaMSENrM MiFrPg2aZe/1GXzsKI4umRc3P0GT83L5sbTQ+6u7XgIpEFFJqBd6v7bBbHI5PdopP7/H CCCuGaHkccL4mZDPfYXpf6NqcmNWE0/r5fy7NReZqQWpxN8zrxGsCrvVxTNd8Z5TqGH4 bB/O94nuTJgRAP4xW8lIyP3NDRRvfbPWmnNlZ4mkh/CRtlJN+I5Tt4Gs6BKbM8BB1IH0 IMNw== X-Gm-Message-State: AOAM533w86vqpId1uEOklC8TUkuvmrXdZJy1NSqoJ/2hqdxc78p4JV6L YAVv+BRuqlLej6fic2TXXJ9Xn6+9FCDtg3Z+hc0w3Ze0OomCHg== X-Google-Smtp-Source: ABdhPJxcE7GLQ0ad3ygzMQCulJePxjwgViSuj24Vj7kDocjJbivB0WAaQGOiZ/FJewLQdoz8hRCtb33BU1Eg+p/3Wpo= X-Received: by 2002:a63:d414:: with SMTP id a20mr10980789pgh.131.1642613483948; Wed, 19 Jan 2022 09:31:23 -0800 (PST) In-Reply-To: X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::433 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=eduardoochs@gmail.com; helo=mail-pf1-x433.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:135449 Archived-At: On Wed, 19 Jan 2022 at 06:18, fatiparty--- via Users list for the GNU Emacs text editor wrote: > I have done as follows. But one problem is: How do I use the output in > another elisp function? > > Hi Fatiparty, the easiest way to test small elisp snippets is to run them by typing C-e C-x C-e on the last line of the snippet... the C-e will move to the end of the line, and the C-x C-e will then execute the "sexp before point" and show the result in the echo area. This is explained here: (info "(emacs)Lisp Eval") http://www.gnu.org/software/emacs/manual/html_node/emacs/Lisp-Eval.html Try this on these sexps: (* 2 3) (* 4 5) (+ (* 2 3) (* 4 5)) (progn (* 2 3) (* 4 5) (* 6 7)) (prog1 (* 2 3) (* 4 5) (* 6 7)) (prog2 (* 2 3) (* 4 5) (* 6 7)) If you like this way of running sexps then you should take a look at this tutorial, that is all written in this style - "run each of these sexps with `C-e C-x C-e' and try to understand what they do"... http://angg.twu.net/eev-intros/find-elisp-intro.html Note that the introduction of that tutorial says: Different people prefer different kinds of tutorials. Many people love the eintr, but I don't: (find-node "(eintr)Top") This tutorial here is what I would have liked to have had access to when I started learning Emacs Lisp. Cheers, Eduardo Ochs http://angg.twu.net/#eev