[racket-users] Re: table lookup shorthands?

2017-08-09 Thread Luis Sanjuán
On Monday, August 7, 2017 at 12:16:12 AM UTC+2, Jordan Johnson wrote: > Hi all, > > I’m writing some music-related code for which I find myself using a lot of > lookup tables, following the pattern of making an alist or hash table and > then writing a function that consults the table. I wound

Re: [racket-users] Re: table lookup shorthands?

2017-08-08 Thread Luis Sanjuán
Hi, phillip As far as I'm concerned, professional musician too, I wrote a little app, just a prototype, using a similar representation of pitch classes and intervals for basic chord analysis. Since actual chords can be seen as sequences of intervals, its analysis can be reduced to determine

Re: [racket-users] Re: table lookup shorthands?

2017-08-07 Thread Philip McGrath
Others have given good reasons to take alternate approaches, but if I were writing your define-lookup-function macro, I would avoid using a dictionary type and have the macro expand to `case`, like this: (define-syntax define-lookup-function (syntax-parser [(_ name:id [lhs:expr

[racket-users] Re: table lookup shorthands?

2017-08-07 Thread Luis Sanjuán
On Monday, August 7, 2017 at 6:39:58 PM UTC+2, Luis Sanjuán wrote: > EDIT. > > In the description of the 'Interval' data type, replace 'notes' with > 'pitch-classes' > > In the signature of the function `interval`, replace 'Nat' with 'Interval' Another one: In the signature of