unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Passing hash-table or alist to a function
@ 2024-09-14 13:06 Heime
  2024-09-14 13:18 ` Eduardo Ochs
  2024-09-14 16:06 ` tomas
  0 siblings, 2 replies; 3+ messages in thread
From: Heime @ 2024-09-14 13:06 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor

Have mode the following function

(defvar xiakos-fpln (make-hash-table :test 'equal)
  "Hash table storing paths for different xiakos components.")

Can one distinguish passing a hash-table or an alist to a 
function, how ?





Sent with Proton Mail secure email.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Passing hash-table or alist to a function
  2024-09-14 13:06 Passing hash-table or alist to a function Heime
@ 2024-09-14 13:18 ` Eduardo Ochs
  2024-09-14 16:06 ` tomas
  1 sibling, 0 replies; 3+ messages in thread
From: Eduardo Ochs @ 2024-09-14 13:18 UTC (permalink / raw)
  To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor

On Sat, 14 Sept 2024 at 10:07, Heime <heimeborgia@protonmail.com> wrote:
>
> Have mode the following function
>
> (defvar xiakos-fpln (make-hash-table :test 'equal)
>   "Hash table storing paths for different xiakos components.")
>
> Can one distinguish passing a hash-table or an alist to a
> function, how ?

Try:

(setq ht (make-hash-table))
(puthash :key1 :val1 ht)
(puthash :key2 :val2 ht)
ht

(setq al '((:key1 . :val1) (:key2 . :val2)))
al

(hash-table-p ht)
(hash-table-p al)

  Cheers,
    Eduardo



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Passing hash-table or alist to a function
  2024-09-14 13:06 Passing hash-table or alist to a function Heime
  2024-09-14 13:18 ` Eduardo Ochs
@ 2024-09-14 16:06 ` tomas
  1 sibling, 0 replies; 3+ messages in thread
From: tomas @ 2024-09-14 16:06 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 400 bytes --]

On Sat, Sep 14, 2024 at 01:06:19PM +0000, Heime wrote:
> Have mode the following function
> 
> (defvar xiakos-fpln (make-hash-table :test 'equal)
>   "Hash table storing paths for different xiakos components.")
> 
> Can one distinguish passing a hash-table or an alist to a 
> function, how ?

Read the elisp hash table docs. There is one function made exactly
for that.

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-14 16:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-14 13:06 Passing hash-table or alist to a function Heime
2024-09-14 13:18 ` Eduardo Ochs
2024-09-14 16:06 ` tomas

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).