unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg <incal@dataswamp.org>
To: help-gnu-emacs@gnu.org
Subject: cl-loop and collect (was: Re: A more specific/targeted version of macroexpand-all?)
Date: Thu, 09 Jun 2022 03:40:32 +0200	[thread overview]
Message-ID: <87o7z2zka7.fsf@dataswamp.org> (raw)
In-Reply-To: 2515e8cf-c3cd-2322-2acd-f7e8144b95c2@protonmail.com

Okamsn wrote:

> (cl-loop for i being the symbols
>          when (eq 'macro (car-safe (symbol-function i)))
>          collect i)

;;; -*- lexical-binding: t -*-
;;
;; this file:
;;   https://dataswamp.org/~incal/emacs-init/negative-subtraction.el

(require 'cl-lib)

(defun number-to-list (n)
  (cl-loop
    for d across (prin1-to-string n)
    collect (cl-digit-char-p d) ))
;; (number-to-list 1234) ; (1 2 3 4)

(defun negative-subtract (a b)
  (let*((a-nums (number-to-list a))
        (b-nums (number-to-list b)) )
    (cl-loop
      for i in a-nums
      for j in b-nums
      collect (- i j) )))
;; (negative-subtract 8888 7777) ; (1 1 1 1)

-- 
underground experts united
https://dataswamp.org/~incal




  parent reply	other threads:[~2022-06-09  1:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09  1:31 A more specific/targeted version of macroexpand-all? Okamsn
2022-06-09  1:36 ` Emanuel Berg
2022-06-09  1:40 ` Emanuel Berg [this message]
2022-06-09  1:48   ` cl-loop and collect (was: Re: A more specific/targeted version of macroexpand-all?) Emanuel Berg
2022-06-09 10:47 ` A more specific/targeted version of macroexpand-all? Michael Heerdegen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o7z2zka7.fsf@dataswamp.org \
    --to=incal@dataswamp.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).