unofficial mirror of emacs-tangents@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg <incal@dataswamp.org>
To: emacs-tangents@gnu.org
Subject: Re: Request for review of my Emacs project elosort
Date: Tue, 03 Sep 2024 16:55:58 +0200	[thread overview]
Message-ID: <87jzfsg51d.fsf@dataswamp.org> (raw)
In-Reply-To: CAMxMNtVrOuhWHuXZg2O-Kob-NkzTZVYmx0+KiyF-zWMYQtVX8g@mail.gmail.com

Sergey Lilo wrote:

> https://github.com/lilo/elosort
> (my savannah.gnu.org account is in approval stage)
>
> Elosort is a small for fun project I've been working on
> while studying Emacs Lisp.

Is the algorithm you setup explicitely what is on top for any
two items, and you score points every time you are are
prefered to something else?

And then you sort by total score? That simple?

> What should I improve there?

Instead of your 'swap', see if you like `cl-rotatef'.

Below is a one-liner to shuffle a list - the function is
called 'scramble-string' but as you see it works for lists
as well.

;;; -*- lexical-binding: t -*-
;;
;; this file:
;;   https://dataswamp.org/~incal/emacs-init/comic-book-insult.el

(require 'seq)

(defun scramble-string (str)
  (seq-sort (lambda (_ __) (zerop (random 2))) str))

;; (scramble-string '(1 2 3))

(defun comic-book-insult ()
  (interactive)
  (insert (format "%s!" (scramble-string "@#$%&"))))

;; (comic-book-insult) ; #$%&@!
;; (comic-book-insult) ; $&#@%!

(provide 'comic-book-insult)

> Any advice and comments are appreciated!

You can always do:

(elint-current-buffer)
(checkdoc-current-buffer t)

And this:

  (package-lint-current-buffer)

If you get it to work; it is in MELPA and in the Debian repos
(as elpa-package-lint). It used to work for me but now gets
into too-far nesting.

GLHF!

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


---
via emacs-tangents mailing list (https://lists.gnu.org/mailman/listinfo/emacs-tangents)

  reply	other threads:[~2024-09-03 14:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-03  7:25 Request for review of my Emacs project elosort Sergey Lilo
2024-09-03 14:55 ` Emanuel Berg [this message]
2024-09-03 19:43   ` Sergey Lilo

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=87jzfsg51d.fsf@dataswamp.org \
    --to=incal@dataswamp.org \
    --cc=emacs-tangents@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).