Created
January 16, 2023 11:06
-
-
Save elderica/f305c8c172e8599bee447d6b55f17c79 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #lang racket | |
| (struct plan | |
| (type | |
| data-amount | |
| price) | |
| #:transparent) | |
| (define plans-voice | |
| (vector | |
| (plan 'voice 2 850) | |
| (plan 'voice 4 990) | |
| (plan 'voice 8 1500) | |
| (plan 'voice 15 1800) | |
| (plan 'voice 20 2000))) | |
| (define plans-esim | |
| (vector | |
| (plan 'esim 2 440) | |
| (plan 'esim 4 660) | |
| (plan 'esim 8 1100) | |
| (plan 'esim 15 1430) | |
| (plan 'esim 20 1650))) | |
| (define plans (vector-append plans-voice plans-esim)) | |
| (vector-sort plans < | |
| #:key (lambda (p) (/ (plan-data-amount p) (plan-price p)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment