From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.devel Subject: Re: list of elisp primitives ? Date: Sun, 22 Dec 2019 16:01:49 +0100 Message-ID: <87mubk8kv6.fsf@gmx.net> References: <627F3815-987E-4E82-8118-EE559CA7721F@traduction-libre.org> <5E53A27C-7C86-4275-AC12-9799C3CB1956@traduction-libre.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="165337"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Emacs developers To: Jean-Christophe Helary Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Dec 22 16:02:33 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ij2ka-000gtS-Lz for ged-emacs-devel@m.gmane.org; Sun, 22 Dec 2019 16:02:32 +0100 Original-Received: from localhost ([::1]:48268 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ij2kY-0007iW-KG for ged-emacs-devel@m.gmane.org; Sun, 22 Dec 2019 10:02:30 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59088) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ij2k3-0007i9-AO for emacs-devel@gnu.org; Sun, 22 Dec 2019 10:02:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ij2k2-0006eS-0W for emacs-devel@gnu.org; Sun, 22 Dec 2019 10:01:59 -0500 Original-Received: from mout.gmx.net ([212.227.17.21]:38899) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ij2k1-0006PK-Fq for emacs-devel@gnu.org; Sun, 22 Dec 2019 10:01:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1577026910; bh=3lHJkA4nz2o8oPDqBebfW1EKL7UnOA3sVIL//c3LwvA=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=l0Fbxx9srtunxokFXEqYRJIAMdEgvvYkUlJqNOKQBlFm64s3irCkmQAzJ0ZpEne7S k9BXgNxfL2akSd3Hc3M8F41/QOP7LHVRl9O6muntmEILCGd3tOZ+CL18MQmUH1KpKn 1xm9ipi30gSk5G0koskEvOvQnSKbEGp3+/dU/rPE= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from strobe-lfs84 ([188.109.200.113]) by mail.gmx.com (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MhD2Y-1i4mIm1Jx4-00eILb; Sun, 22 Dec 2019 16:01:50 +0100 In-Reply-To: <5E53A27C-7C86-4275-AC12-9799C3CB1956@traduction-libre.org> (Jean-Christophe Helary's message of "Sun, 22 Dec 2019 13:14:41 +0900") X-Provags-ID: V03:K1:otYl/mbiWq6E3rgyRzRQiAY25peQxhxyV0GitaNb4yvrkSvQFKn HKtOBAqcOAjqDO3AKeRRCzjAAkR0zTQP2P9DUQMcE/Mwm33GoCf3hr8drxI1AQj79756w5c Ksc673ZlMeq0Vs0A0AehYcg9+X23p7eNE6fOKTCzIjQlUbydhc9YEGiA8yhYbyFyeUVhJRi i8oKIDb9v3Q2AJa2hzKMg== X-UI-Out-Filterresults: notjunk:1;V03:K0:b8ImdkLEjfA=:b1fJpHawW8IRYrG9Ws60Ho GjVzXuT5epT49uZbKzzLfoMbSFk/Y+Sz+yATG4nzB4xmld1zhwAeJdDrYMdst/UsWtndvkXSM 34y6JLGnLl5jWWhzzKBIB7tgcwFohk2Pk86u/sPbNMK2v19cdNHSayJi86NDqkAFQ0sy4ULxe a6Szdr1T/Zu8I54f7rIf2Os1iA/9wncxLKRWk3pkO5C9Cbx82yktgChb3X78ETRiD1PR+aXfT 2uEhwmbMPhfbioI1yE+M/uKbb+ghCaNQBRd3aIqgRdbPemgaJA+6fqVvMaQh887WLPSwyhbwz LMoC7ipG4O6dRoEWvMtiUQWHPJz3YiY5D78wO9efKHdG14QpFn55mt10Oq1M+8D3+YDecQKp9 iQjv/F0F5BGF80f3umoqLFoEjnn0X5S6qnBARAvki0eXD5cJ0QxGqdBp+0D804fukfMSLdKbJ FQoFUbdB+Wp4VWE4Na4wDgQue8MdVPdzjld+xc5TqHXrSohI0ck7RT5Ta6mqj8xfjtqMwUuvf BqdrRIIuXbw2roMar0hFDOy3TiQAd6VK/0ppdBXoBZRdhFlOvWigRmPAExsDZUSDXCC4o0Zba 9mekV54ZU2H+MLNA+xa1SbcWECHFvp+/zSDHdb8H+/ArdL8HLoPwh11sHTa9nwah46eWjIBMe kqvkLgxdh1oPIYY0FzZRpS9RUmcxLa4ASsoVS+yS67+jRr4GILGZhl7+zfx5K1WnQ06EJwyLL 4XBsH7l1pavUZoCugFCDIiVhGrsKNzIRcC07FkZELmt6U+VgC6e9wGN96/PHvQim7VJ+Ck4f X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.21 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:243560 Archived-At: On Sun, 22 Dec 2019 13:14:41 +0900 Jean-Christophe Helary wrote: > What I'm trying to do is this: > >> I was thinking that because of the sheer amount of functions in the elisp >> reference, it might be much easier to start programming with the primitives >> to understand how elisp works at its core, and then climb the ladder when >> need arises... > > i.e. trying to find a limited subset of functions that one can use to program > in elisp and do non-trivial things but that do not involve searching the > reference at all times. > > I'm thinking like in standard learners dictionaries, there are clear > indications, like asterisks, that tell the learner whether the word is basic > (generally about 2000 words) or intermediate (about 4000 words). > > People who know the basic words can get by and express most of what they need > to express in daily life. > > For ex, it is estimated that there are about 140k words in French, but daily > use only requires 1k. Let's lower the number of passively known words to 40k, > that's 50 functions in Elisp... One way to come up with a list of "basic Elisp" functions is to compare the usage frequencies in individual Elisp libraries; the most frequently used functions in a reasonable number of libraries are likely to be the most basic. Here's a little hack to get a quick rough estimate for a single file or buffer of Lisp code (to get a really accurate count would take quite a bit more effort, which has probably already been done, but I'm not aware of it): (defun srb-count-lisp-funs (&optional buffer) "Display a frequency table of Lisp functions in BUFFER. Called interactively with a prefix argument, use the current buffer, otherwise, prompt for a file, visit it and use its buffer." (interactive "P") (let ((fnh (make-hash-table :test 'equal)) ;; FIXME: false positives with let, funargs, alists, ... (flh (lambda (h) (save-excursion (save-restriction (goto-char (point-min)) (while (search-forward "(" nil t) (let ((sym (symbol-at-point))) (when sym (puthash sym (1+ (gethash sym h 0)) h)))))))) (bname (buffer-name)) fnl) (if buffer (funcall flh fnh) (with-temp-buffer (let ((file (read-file-name "File: "))) (insert-file-contents file) (funcall flh fnh) (setq bname (file-name-nondirectory file))))) (maphash (lambda (key val) (setq fnl (append fnl (list (cons key val))))) fnh) (setq fnl (sort fnl (lambda (a b) (> (cdr a) (cdr b))))) (with-current-buffer (generate-new-buffer (concat "fn freqs (" bname ")")) (dolist (e fnl) (insert (symbol-name (car e)) ": " (number-to-string (cdr e)) "\n")) (view-buffer (current-buffer))))) Steve Berman