hashtable-size(3scm)

πŸ“¦ version 0-unstable-2024-02, in nixpkgs unstable

✨ hashtable-size β€” it's giving "how many keys are in this thing" ✨

okay so bestie, this is the hashtable-size page from the Scheme Programmer's Manual (that's the (3scm) part, iykyk) πŸ’… and honestly it's a short one, so grab your boba and let's go πŸ§‹πŸ’–


🌸 LIBRARY 🌸

(import (rnrs))                     ;R6RS
(import (rnrs hashtables))          ;R6RS

two ways to get at her, both R6RS, both slay ✨


πŸŽ€ SYNOPSIS πŸŽ€

(hashtable-size hashtable)

one argument, one lil' call, that's the whole vibe 🫢


πŸ’œ DESCRIPTION πŸ’œ

Returns the number of keys contained in hashtable. that's it. that's the procedure. she's a counter, she's not dramatic, she just knows things 🌈


⭐ RETURN VALUES ⭐

Returns a single value β€” an exact non-negative integer object. literally cannot be negative, cannot be inexact, she's an exact non-negative integer and she's proud of it πŸ‘‘


πŸ¦‹ EXAMPLES πŸ¦‹

okay this one's a little nested-do moment but stay with me, it eats:

(map (lambda (n)
       (do ((ht (make-eqv-hashtable))
            (i 0 (+ i 1)))
           ((> i n)
            (hashtable-size ht))
         (do ((j 0 (+ j 1)))
             ((> j n))
           (hashtable-set! ht (* i j) #t))))
     '(0 1 2 3 4 5 6 7 8 9 10 11 12 13))
    => (1 2 4 7 10 15 19 26 31 37 43 54 60 73)

like, look at those numbers climbing, no cap, she's growing 🌱πŸ”₯


πŸ’€ COMPATIBILITY πŸ’€

This procedure is unique to R6RS. similar procedures exist in SRFI-69 and SRFI-125 (so like, cousins, not twins), so if you're porting code around, mind the name differences πŸ‘€


πŸ™ˆ ERRORS πŸ™ˆ

This procedure can raise exceptions with the following condition types:

  • &assertion (R6RS) β€” The wrong number of arguments was passed or an argument was outside its domain. In particular, hashtable should be a hashtable. like, she needs an actual hashtable, bestie, don't hand her a list and expect magic 😭

🌟 SEE ALSO 🌟

go read those next, they're the friend group 🫢✨


🧚 STANDARDS 🧚

R6RS πŸ’–


πŸ”₯ HISTORY πŸ”₯

This procedure first appeared in R6RS. An equivalent procedure already existed in SRFI-69 under the name hash-table-size β€” so she's got lore, she's got heritage, she's an icon πŸ’…πŸ‘‘


🌸 AUTHORS 🌸

This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://github.com/schemedoc/manpages/.


okay that's the whole page, short and sweet and honestly? she ate πŸ“πŸ’– this lil' cutie is dated 2023-01-22 and lives in the scheme-manpages collection β€” now go count some keys, bestie, mwah πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from