ということでobjc用のコンテナっぽいもの書いてみました。
https://gist.github.com/783682
単に眠れなかっただけですが。
NSLog(@"%@",CONS( nil, nil )); NSLog(@"%@",CONS( @"hoge", nil )); NSLog(@"%@",CONS( @"hoge", @"hogehoge" )); NSLog(@"%@",CONS( @"hoge", CONS( @"hogehoge", nil ) ) ); JNCons *cons = CONS(nil,nil); for (int i = 0; i < 10; ++i) { [cons addObject:@"hoge"]; NSLog(@"%@",cons); } NSLog(@"%@",[JNCons arrayWithArray:[NSArray arrayWithObjects:@"0",@"1",@"2",@"3",nil]]);
<JNCons: 0x10014fe20> () <JNCons: 0x100651a70> (hoge) <JNCons: 0x10063fb40> (hoge. hogehoge) <JNCons: 0x100635340> (hoge hogehoge) <JNCons: 0x100635360> (hoge) <JNCons: 0x100635360> (hoge hoge) <JNCons: 0x100635360> (hoge hoge hoge) <JNCons: 0x100635360> (hoge hoge hoge hoge) <JNCons: 0x100635360> (hoge hoge hoge hoge hoge) <JNCons: 0x100635360> (hoge hoge hoge hoge hoge hoge) <JNCons: 0x100635360> (hoge hoge hoge hoge hoge hoge hoge) <JNCons: 0x100635360> (hoge hoge hoge hoge hoge hoge hoge hoge) <JNCons: 0x100635360> (hoge hoge hoge hoge hoge hoge hoge hoge hoge) <JNCons: 0x100635360> (hoge hoge hoge hoge hoge hoge hoge hoge hoge hoge) <JNCons: 0x100150340> (0 1 2 3)
クラス名書き換えるだけでこないだのなんちゃって処理系で使えないかなぁと思って半端にNSArrayっぽくなってます。