unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Heime <heimeborgia@protonmail.com>
To: Yuri Khan <yuri.v.khan@gmail.com>
Cc: Heime via Users list for the GNU Emacs text editor
	<help-gnu-emacs@gnu.org>
Subject: Re: Output hash-table from a function
Date: Sun, 22 Sep 2024 15:16:38 +0000	[thread overview]
Message-ID: <CoZDJbapGtYd1m8cRVDCXC9nKYRL10KKDymY6GH_oGgg0wI4BECOLNwHuTWG1lv1qyo4Qt0jk9y--owVUZ_BeJ3QlD2P-al5BJWJsJLEfrU=@protonmail.com> (raw)
In-Reply-To: <CAP_d_8XNmGxs0W6xVGdkMMJ_qb04Ua7BxN0=5v3wzT+80H984A@mail.gmail.com>






Sent with Proton Mail secure email.

On Monday, September 23rd, 2024 at 2:46 AM, Yuri Khan <yuri.v.khan@gmail.com> wrote:

> On Sun, 22 Sept 2024 at 18:48, Heime heimeborgia@protonmail.com wrote:
> 
> > I want to write a function xiakos-anctr that taking the hash table xiakos,
> 
> 
> You should really start naming your functions, arguments and variables
> using words rather than random sequences.

They are not random sequences as you say, but that's fine.
 
> > produces another hash-table, with the same keys but the associated value
> > would be 1 (if directory path does not exist) or 0 (if the directory path exists).
> > 
> > (defun xiakos-anctr (fpln)
> > 
> > (if (hash-table-p fpln)
> > 
> > (let ( (anctr (make-hash-table :test 'equal)) )
> > (maphash (lambda (waypt dirpath)
> > (puthash
> > waypt (not (file-directory-p dirpath))
> > anctr))
> > fpln)) ))
> 
> 
> Hint 1: What does your function to return right now?

xiakos-anctr is certainly not returning a hash table, as I wanted
 
> Hint 2: You’ve created a hash table, bound it to a local variable,
> then did a bunch of mutations to that hash table, and then what?

I want to call the function and store the hash table result in a let statement

(let ( (anctr (xiakos-anctr flpn)) )
  (do-this flpn anctr)
  (do-that flpn anctr))



  reply	other threads:[~2024-09-22 15:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-21 22:34 Output hash-table from a function Heime
2024-09-22 11:47 ` Heime
2024-09-22 14:46   ` Yuri Khan
2024-09-22 15:16     ` Heime [this message]
2024-09-22 15:54       ` Yuri Khan
2024-09-22 15:59         ` Heime
2024-09-22 16:03           ` Heime
2024-09-22 16:56             ` Yuri Khan
2024-09-22 17:02               ` Heime
2024-09-23  5:57           ` tomas

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='CoZDJbapGtYd1m8cRVDCXC9nKYRL10KKDymY6GH_oGgg0wI4BECOLNwHuTWG1lv1qyo4Qt0jk9y--owVUZ_BeJ3QlD2P-al5BJWJsJLEfrU=@protonmail.com' \
    --to=heimeborgia@protonmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=yuri.v.khan@gmail.com \
    /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).