Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9149915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:32:33+00:00 2026-06-17T11:32:33+00:00

I have a hash table in Chicken Scheme the hash table has keys with

  • 0

I have a hash table in Chicken Scheme the hash table has keys with values corresponding to those keys are hashes with corresponding values of hashes again. The keys of the “inner hashes” have corresponding values which are strings. (For Those familiar with, say, Ruby, setting the relevant portion of the hash might look like

the_hash[group_name][section_name][part_name] = some_text

or to read the string:

a_string = the_hash[group_name][section_name][part_name]

, for example.)

At the point where I read the string, I need to know what the group_name, section_name, and part_name are and I need to be able to perform certain actions based on the values of each of the strings and the for-each and map features of Scheme do not seem to be sufficient because only one of the three key/sub-key strings seems available at any given moment. I do not know what patterns the respective strings might hold. A web search turned up no work able solution. At the same time, I am relatively new to Scheme and may not be as familiar as I should. Can Anyone point Me in the direction of a solution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:32:33+00:00Added an answer on June 17, 2026 at 11:32 am

    Scheme doesn’t have built-in support for multidimensional hashes, but with the right abstractions you can build your own implementation:

    ; create a new multidimensional hash table
    (define (make-multi-hash)
      (make-hash-table))
    
    ; set a value given a non-empty sequence of keys
    (define (multi-hash-set! hash-table value . keys)
      (let loop ((hash hash-table)
                 (keys keys))
        (cond ((null? (cdr keys))
               (hash-table-set! hash (car keys) value))
              (else
               (if (not (hash-table-exists? hash (car keys)))
                 (hash-table-set! hash (car keys) (make-multi-hash)))
               (loop (hash-table-ref hash (car keys)) (cdr keys))))))
    
    ; retrieve a value given a non-empty sequence of keys
    (define (multi-hash-ref hash-table . keys)
      (foldl (lambda (k h) (hash-table-ref h k))
             hash-table
             keys))
    

    Use it like this:

    (define h (make-multi-hash))
    (multi-hash-set! h 42 'a 'b 'c)
    (multi-hash-ref h 'a 'b 'c)
    => 42
    

    Using the above procedures as a starting point surely you can implement the required functionality. Also notice that Chicken Scheme provides a lot of procedures for dealing with “normal” hash tables, some of them will be useful, as this implementation uses ordinary hash tables under the hood.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a hash table which stores IPs as strings for the key and
I have a Java code which searches for values in the hash table in
I have Vector of Hashtables and each hash table has two elements with keys
I have a hash table where the keys are rather complex lists, with sublists
What I can think of is: Algo: Have a hash table which will store
Does the DOM have a hash-table of elements whose keys are the elements' ids?
I have a hash table with multiple values being passed to a function I
I have some hash table that is losing its values at some point in
I have a hash table that contains values of a^j. j is the key
Suppose we have a hash table that maps strings to functions. In my example

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.