Re: [racket-users] table lookup shorthands?

2017-08-16 Thread Luis Sanjuán
On Wednesday, August 16, 2017 at 3:42:38 PM UTC+2, Alex Knauth wrote: > > On Aug 8, 2017, at 10:42 AM, Luis Sanjuán wrote: > > > > On Tuesday, August 8, 2017 at 3:16:46 PM UTC+2, Alex Knauth wrote: > > >> I've been basing it on the chord-labeling algorithm in a paper I found, > >> "Algorithms f

Re: [racket-users] table lookup shorthands?

2017-08-16 Thread Alex Knauth
> On Aug 8, 2017, at 10:42 AM, Luis Sanjuán wrote: > > On Tuesday, August 8, 2017 at 3:16:46 PM UTC+2, Alex Knauth wrote: >> I've been basing it on the chord-labeling algorithm in a paper I found, >> "Algorithms for Chordal Analysis" by Bryan Pardo and William P. Birmingham, >> but there are

Re: [racket-users] table lookup shorthands?

2017-08-08 Thread Luis Sanjuán
On Tuesday, August 8, 2017 at 3:16:46 PM UTC+2, Alex Knauth wrote: > > On Aug 8, 2017, at 8:15 AM, Luis Sanjuán wrote: > > > > 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

Re: [racket-users] table lookup shorthands?

2017-08-08 Thread Luis Sanjuán
On Tuesday, August 8, 2017 at 3:16:46 PM UTC+2, Alex Knauth wrote: > > On Aug 8, 2017, at 8:15 AM, Luis Sanjuán wrote: > > > > 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

Re: [racket-users] table lookup shorthands?

2017-08-08 Thread Luis Sanjuán
On Tuesday, August 8, 2017 at 3:16:46 PM UTC+2, Alex Knauth wrote: > > On Aug 8, 2017, at 8:15 AM, Luis Sanjuán wrote: > > > > 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

Re: [racket-users] table lookup shorthands?

2017-08-08 Thread Alex Knauth
> On Aug 8, 2017, at 8:15 AM, Luis Sanjuán wrote: > > 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 > s

[racket-users] table lookup shorthands?

2017-08-07 Thread Luis Sanjuán
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' -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this gr

[racket-users] table lookup shorthands?

2017-08-07 Thread Luis Sanjuán
I forgot to mention that, of course, you can rely on structs as Alex recommends, I used just naturals to simplify the code. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send a

[racket-users] table lookup shorthands?

2017-08-07 Thread Luis Sanjuán
Expanding on what Alex has already point out, you can do something like this: ;; PitchClass is one of (define C 0) (define C# 1) (define D 2) (define D# 3) (define E 4) (define F 5) (define F# 6) (define G 7) (define G# 8) (define A 9) (define A# 10) (define B 11) ;; Interval is Natural ;; number

Re: [racket-users] table lookup shorthands?

2017-08-06 Thread Alex Knauth
> On Aug 6, 2017, at 6:16 PM, 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 up writing a ma

[racket-users] table lookup shorthands?

2017-08-06 Thread Jordan Johnson
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 up writing a macro for this pattern; one example of its use is: ;; key->fifths :