[racket-users] Re: Code critique request: data/fetch, proc for walking hashes/lists

2016-01-19 Thread David K. Storrs
I apologize for the long ping time on this -- for whatever reason I didn't get any of the replies sent to my email and I thought no one had responded. JCG, Jack, thank you very much for taking the time. Jack: I had to stare at your code for a while before I got it, but thank you for it.

[racket-users] Re: Code critique request: data/fetch, proc for walking hashes/lists

2016-01-11 Thread Jack Firth
I'd probably prefer using a fold over explicit recursion. This gets easier if you split your code into two steps - one that does just one level of lookup, and one that does nested lookups. Additionally, I'd prefer list indexes rather than pair lookup functions: (define (data/ref s key) (cond

[racket-users] Re: Code critique request: data/fetch, proc for walking hashes/lists

2016-01-11 Thread Jack Firth
I'd probably prefer using a fold over explicit recursion. This gets easier if you split your code into two steps - one that does just one level of lookup, and one that does nested lookups. Additionally, I'd prefer list indexes rather than pair lookup functions: (define (data/ref s key) (cond

[racket-users] Re: Code critique request: data/fetch, proc for walking hashes/lists

2016-01-10 Thread JCG
On Sunday, January 10, 2016 at 4:44:57 PM UTC-5, David K. Storrs wrote: > I feel like I'm starting to be somewhat functional with Racket, but I'd like > to get more idiomatic.  I'd appreciate it if people would critique the > following code: > > > (define (data/fetch s key-list) >   (if (or