all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / 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 16:03:04 +0000	[thread overview]
Message-ID: <U3dWaUoc-z3FHdtHAgkJu48Hpz4nTJWIK9KB41KcKsqePoaaXE1bp2e50xAJdBXYDCTvGhd6TeCT3acYoXj_Wh1lTpP552OQG32jrb0EncU=@protonmail.com> (raw)
In-Reply-To: <j-3_vdwrSsmr_BSE__v75248l7nT_oAg2Ke6aGIYe0xKRvbNwxSn8D6RJNnMz-GfUqYYYrHI48t3LgkAO5our8_qBvjvg9jAx3G16SefnNg=@protonmail.com>






Sent with Proton Mail secure email.

On Monday, September 23rd, 2024 at 3:59 AM, Heime <heimeborgia@protonmail.com> wrote:

> 
> 
> 
> 
> 
> Sent with Proton Mail secure email.
> 
> 
> On Monday, September 23rd, 2024 at 3:54 AM, Yuri Khan yuri.v.khan@gmail.com wrote:
> 
> > On Sun, 22 Sept 2024 at 22:16, 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
> > 
> > You are not answering the question. I am asking it because by
> > answering it you will get closer to understanding the root of your
> > issue. So, what is it returning?
 
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.
 
> > > > 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)) )
> > 
> > This assumes xiakos-anctr returns the hash table. But, as you have
> > seen, it does not return it. So what happens to the hash table you
> > created in xiakos-anctr ?
 
From what I could conclude, the hash table gets lost.



  reply	other threads:[~2024-09-22 16:03 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 [this message]
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

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

  git send-email \
    --in-reply-to='U3dWaUoc-z3FHdtHAgkJu48Hpz4nTJWIK9KB41KcKsqePoaaXE1bp2e50xAJdBXYDCTvGhd6TeCT3acYoXj_Wh1lTpP552OQG32jrb0EncU=@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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.