Post 9tuFlS1cAg6ChCdZ5M by clacke@libranet.de
 (DIR) More posts by clacke@libranet.de
 (DIR) Post #9tuFlRXTyhzpBkXV7Q by m455b@tiny.tilde.website
       2020-04-10T16:11:14Z
       
       0 likes, 0 repeats
       
       anyone know the best way to handle #scheme vectors that contain dotted pairs like the ones in this pic?edit: this is what the json-read procedure from #chickenscheme 's json egg converted json to.i feel like abstracting using a bunch of `vector-ref`s and `car`s and `cdr`s probably isn't the right way, but i'm not sure.#advice
       
 (DIR) Post #9tuFlS1cAg6ChCdZ5M by clacke@libranet.de
       2020-04-10T16:35:19Z
       
       0 likes, 0 repeats
       
       @m455b If there isn't an assq for vectors, the first thing I'd do is write one.I'm surprised they went for associative vectors instead of hashes.
       
 (DIR) Post #9tv5NPGdy398oGWTQ0 by m455b@tiny.tilde.website
       2020-04-10T16:40:08Z
       
       0 likes, 0 repeats
       
       @clacke yeah i was hoping for hashes! i was able to use racket's json library because it just converts everything to hashes.thanks for the tip! i'll investigate assq :Di'm trying to retrieve values by the way
       
 (DIR) Post #9tv5NPq5qFVEaD6mfo by clacke@libranet.de
       2020-04-11T02:16:45Z
       
       0 likes, 0 repeats
       
       @m455b I should have said assoc, strings aren't `eq?` to each other.
       
 (DIR) Post #9tvHe7u4yiiNKThvtI by rain1@mastodon.social
       2020-04-10T18:26:22Z
       
       0 likes, 0 repeats
       
       @m455b that is the right way, make a bunch of accessor procedures for working with this data structure!
       
 (DIR) Post #9tvHe8jTtbpbttkz0i by m455b@tiny.tilde.website
       2020-04-10T18:35:44Z
       
       0 likes, 0 repeats
       
       @rain1 so in scheme it's idiomatic to adjust your procedures to different data structures?this isn't supposed to sound like i'm being a smartass, i genuinly want to know, because i'm a newbie at this stuff! <3
       
 (DIR) Post #9tvHe9Dy4GDZQS1KWu by clacke@libranet.de
       2020-04-11T04:34:03Z
       
       0 likes, 0 repeats
       
       @m455b @rain1 Yes, the idiomatic thing to do when you have a datatype or structure is to write a bunch of accessors around it. And because in standard Scheme you don't have polymorphism you generally prefix the names of the accessors.So you get things like (vector-ref), (hash-ref), etc. In your case you'd have things like (report-deaths), (report-closed-cases).
       
 (DIR) Post #9tvLMh8tcbPDE1a784 by m455b@tiny.tilde.website
       2020-04-11T03:39:13Z
       
       0 likes, 0 repeats
       
       @clacke thanks!!
       
 (DIR) Post #9tvLMhd1oZVajTgB60 by clacke@libranet.de
       2020-04-11T05:15:56Z
       
       0 likes, 0 repeats
       
       @m455b vector-assoc, link to source on tio.run:http://shorl.com/progronifrinymy
       
 (DIR) Post #9tw3IxlwFMR9cssFjk by m455b@tiny.tilde.website
       2020-04-11T13:11:39Z
       
       0 likes, 0 repeats
       
       @clacke @rain1 thank you so much! Naming conventions and dealing with nested data in scheme is exactly when I have been scratching my head over for months, like I knew how to do it messily, but for being idiomatic, I couldnt find anything!This is so valuable to me!