- Proposal: SE-NNNN
- Authors: Vincent Esche
- Review Manager: TBD
- Status: Awaiting review
Replace the Hashable protocol by two new procotols (Hasher and HashVisitable) to improve safety, versatility and learnability.
| #import <Foundation/Foundation.h> | |
| int main(int argc, const char * argv[]) { | |
| @autoreleasepool { | |
| NSArray *dates = @[ | |
| [[NSCalendar currentCalendar] dateFromComponents:({ | |
| NSDateComponents *c = [[NSDateComponents alloc] init]; | |
| c.year = 2010; | |
| c.month = 12; |
| // | |
| // NSArray+FuntionalTools.h | |
| // arraytools | |
| // | |
| // Created by vikingosegundo on 28.08.11. | |
| // Copyright (c) 2011 vikingosegundo. All rights reserved. | |
| // | |
| #import <Foundation/Foundation.h> |
| // | |
| // ABController.h | |
| // ABTestPrototype | |
| // | |
| // Created by Manuel Meyer on 12.05.15. | |
| // Copyright (c) 2015 Manuel Meyer. All rights reserved. | |
| // | |
| #import <Foundation/Foundation.h> |
Replace the Hashable protocol by two new procotols (Hasher and HashVisitable) to improve safety, versatility and learnability.
| import Foundation | |
| extension Date { | |
| func add(years: Int = 0, months: Int = 0, days: Int = 0, hours: Int = 0, minutes: Int = 0, seconds: Int = 0) -> Date? { | |
| let comp = DateComponents(year: years, month: months, day: days, hour: hours, minute: minutes, second: seconds) | |
| return Calendar.current.date(byAdding: comp, to: self) | |
| } | |
| func subtract(years: Int = 0, months: Int = 0, days: Int = 0, hours: Int = 0, minutes: Int = 0, seconds: Int = 0) -> Date? { |
| indirect enum Note { | |
| case note (Pitch, Duration) | |
| case triplet((Pitch, Pitch, Pitch), Duration) | |
| case chord([Pitch], Duration) | |
| case rest(Duration) | |
| case hold(Note) | |
| indirect enum Pitch { | |
| case a | |
| case b | |
| case c |
| [ ♪(.c,.¼), ♪(.d,.¼), ♪(.e,.¼), ♪(.f,.¼), ♪(.g,.¼), ♪(.a,.¼), ♪(.b,.¼) ] |
| [ ♪(.c,.¼), ♪(.d,.¼), ♪(♭.e,.¼), ♪(.f,.¼), ♪(♭.g,.¼), ♪(.a,.¼), ♪(♭.b,.¼) ] |
| [ ♪(.e,.¼), ♪(♯.f,.¼), ♪(♯.g,.¼), ♪(.a,.¼), ♪(.b,.¼), ♪(♯.c,.¼), ♪(♯.d,.¼) ] |
| prefix operator ♪; prefix func ♪(n: (Note.Pitch, Note.Duration) ) -> Note { .note(n.0, n.1) } | |
| prefix operator ▿; prefix func ▿(x: (Note.Duration, (Note.Pitch,Note.Pitch,Note.Pitch))) -> Note { .triplet(x.1, x.0) } | |
| prefix operator ▬; prefix func ▬(d: Note.Duration ) -> Note { .rest(d) } | |
| prefix operator ♯; prefix func ♯(note: Note.Pitch ) -> Note.Pitch { .sharp(note) } | |
| prefix operator ♭; prefix func ♭(note: Note.Pitch ) -> Note.Pitch { .flat (note) } | |
| prefix operator ⩀; prefix func ⩀(note: Note ) -> Note { .hold (note) } |