From: Yuri Khan <yuri.v.khan@gmail.com>
To: Heime <heimeborgia@protonmail.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 23:56:43 +0700 [thread overview]
Message-ID: <CAP_d_8Xx-KkZCT5VAUuRRtDp+o-2YNSGUGbmrWFH0ckmzSN2Xw@mail.gmail.com> (raw)
In-Reply-To: <U3dWaUoc-z3FHdtHAgkJu48Hpz4nTJWIK9KB41KcKsqePoaaXE1bp2e50xAJdBXYDCTvGhd6TeCT3acYoXj_Wh1lTpP552OQG32jrb0EncU=@protonmail.com>
On Sun, 22 Sept 2024 at 23:03, Heime <heimeborgia@protonmail.com> wrote:
> > > > > > (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
> > >
> I have made a check with (hash-table-p (xiakos-anctr flpn)) which returns
> false.
>
> What gets returned is the return from maphash, which is always nil.
Correct.
> > > > > 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?
>
> From what I could conclude, the hash table gets lost.
Also correct.
So what change do you need to fix your xiakos-anctr function?
next prev parent reply other threads:[~2024-09-22 16:56 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
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 [this message]
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=CAP_d_8Xx-KkZCT5VAUuRRtDp+o-2YNSGUGbmrWFH0ckmzSN2Xw@mail.gmail.com \
--to=yuri.v.khan@gmail.com \
--cc=heimeborgia@protonmail.com \
--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).