[[OCamlテクニック/let-poly]] let多相には色々と種類があるので、ちと注意が必要です。 *値制限のlet多相 [#qf856368] 参照型と型安全を両立させるため、let多相を値に制限する方法。 TAPLでも紹介されています。値制限は、かなーり厳しい。 # let fst (x, _) = x;; val fst : 'a * 'b -> 'a = <fun> # let v = fst ([], ());; val v : '_a list = [] # ''fst ([], ()) は値ではなく、関数適用なので、多相にはならない。'' *OCamlのlet多相 [#cc879e11] OCamlのlet多相には基本的に値制限が付いています。 ただし、型変数がcovariantな位置に現れる場合は、subtype関係から多相が回復します。 [[garrigue先生の論文:http://www.math.nagoya-u.ac.jp/~garrigue/papers/morepoly-long.pdf]] # let fst (x, _) = x;; val fst : 'a * 'b -> 'a = <fun> # let v = fst ([], ());; val v : 'a list = [] # covariantな位置というのは、(不正確ですが)関数の型を表す→の右側と思ってください。 つまり例えば、関数の戻り値に型変数があるなら、それはcovariantな位置の型変数です。 正確には圏論的に言うと(以下略 *rank-1多相 [#o6360e2c] 大堀先生が考案され、SML# に実装されている方法です。 [[SML#のrank-1多相:http://www.pllab.riec.tohoku.ac.jp/smlsharp/ja/?FeatureRank1Polymorphism]] -[注意] Haskellのrank-n多相とかの話は、let多相の話ではなく、Universal Quantifiers (System Fとか)の話なので混同しないように。私はおもいっきり勘違いしていました(泣 - covariantというのは、サブタイプという「関係」について、→という型構築子の右手側について関係を保存するという意味では(TAPLより) -- [[けいご]] &new{2006-12-23 (土) 14:50:48}; - S<:Tのとき、T→U<:S→U、つまり→は左手についてサブタイプ関係を"逆"に保存するので"contra"variant, 一方V→S<:V→Tと、右手については"そのまま"なので"co"variant、という説明だったと思います(うろ覚え,しかも逆だった)。 -- [[けいご]] &new{2006-12-23 (土) 14:59:07}; - つまり→は右手(戻り型)についてcovariant, 左手(引数)についてcontravariantという風。 -- [[けいご]] &new{2006-12-23 (土) 15:11:52}; - サブタイプは配列・リストやi/o向き付けのチャネル型についても面白い話があるのですがそれはまた。 -- [[けいご]] &new{2006-12-23 (土) 15:14:38}; - covariant,contravariantの解説ありがとうございます。[[wikipediaの解説:http://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science)]]もありますので、さらに詳しく知りたい人はどうぞ。 -- [[ogasawara]] &new{2006-12-23 (土) 15:45:30}; - おおおー。ありがとうございます。 -- [[けいご]] &new{2006-12-25 (月) 09:50:18}; - Thanks funny site <a href=" http://groups.google.us/group/ii-freeringtones ">free download ringtones aerosmith</a> =))) -- [[Evvqkobh]] &new{2008-05-17 (土) 07:07:03}; - good site dude <a href=" http://www6.kinghost.com/teen/piski/animal-hentai.html ">animal hentai</a> :-] <a href=" http://www6.kinghost.com/teen/piski/animal-sex.html ">animal sex</a> 43865 <a href=" http://www6.kinghost.com/teen/piski/xxxdessert.html ">xxxdessert</a> =-(( <a href=" http://www6.kinghost.com/teen/piski/bigpussy.html ">bigpussy</a> 616365 <a href=" http://www6.kinghost.com/teen/piski/blow-job.html ">blow job</a> 57755 <a href=" http://www6.kinghost.com/teen/piski/blowjobs.html ">blowjobs</a> hwanw <a href=" http://www6.kinghost.com/teen/piski/xnxx.html ">xnxx</a> goz <a href=" http://www6.kinghost.com/teen/piski/black-woman-pussy.html ">black woman pussy</a> =-(( <a href=" http://www6.kinghost.com/teen/piski/boobtube.html ">boobtube</a> ujej <a href=" http://www6.kinghost.com/teen/piski/youngporn.html ">youngporn</a> 01599 -- [[Jjfodfdo]] &new{2008-05-18 (日) 00:45:13}; - interesting post thx <a href=" http://www6.kinghost.com/teen/piski/yourporntube.html ">yourporntube</a> okwegh <a href=" http://www6.kinghost.com/teen/piski/great-lolita-bbs.html ">great lolita bbs</a> rmdja <a href=" http://www6.kinghost.com/teen/piski/hot-ebony-hoes.html ">hot ebony hoes</a> =(( <a href=" http://www6.kinghost.com/teen/piski/preteen-pics.html ">preteen pics</a> 04810 <a href=" http://www6.kinghost.com/teen/piski/young-teen-girls.html ">young teen girls</a> :O <a href=" http://www6.kinghost.com/teen/piski/xxxvideos.html ">xxxvideos</a> jamoi <a href=" http://www6.kinghost.com/teen/piski/fuckk.html ">fuckk</a> hcjfm <a href=" http://www6.kinghost.com/teen/piski/xxxporn.html ">xxxporn</a> :-] <a href=" http://www6.kinghost.com/teen/piski/charity-hodges-nude.html ">charity hodges nude</a> 087 <a href=" http://www6.kinghost.com/teen/piski/familysex.html ">familysex</a> 8-))) -- [[Ugadelcy]] &new{2008-05-18 (日) 10:52:53}; - nice work man 10x <a href=" http://www6.kinghost.com/teen/piski/kinxxx.html ">kinxxx</a> 11632 <a href=" http://www6.kinghost.com/teen/piski/moms-fucking-sons.html ">moms fucking sons</a> 9766 <a href=" http://www6.kinghost.com/teen/piski/models-nude-preteen.html ">models nude preteen</a> 818210 <a href=" http://www6.kinghost.com/teen/piski/midget-sex.html ">midget sex</a> %[[ <a href=" http://www6.kinghost.com/teen/piski/homemadeporn.html ">homemadeporn</a> =) <a href=" http://www6.kinghost.com/teen/piski/lestai.html ">lestai</a> mfxfe <a href=" http://www6.kinghost.com/teen/piski/moms-fucking.html ">moms fucking</a> 115520 <a href=" http://www6.kinghost.com/teen/piski/mother-fucking-girls.html ">mother fucking girls</a> blltil <a href=" http://www6.kinghost.com/teen/piski/men-sucking-big-cock.html ">men sucking big cock</a> =DDD <a href=" http://www6.kinghost.com/teen/piski/inthecrack.html ">inthecrack</a> mwl -- [[Ortccndp]] &new{2008-05-18 (日) 11:32:04}; - good material thanks <a href=" http://groups.google.us/group/zzz-freeringtones ">nec phone</a> 89306 -- [[Qbcejrfn]] &new{2008-05-19 (月) 07:49:39}; - sweet site thanks <a href=" http://groups.google.com/group/ticketssz ">ticket jackets</a> -- [[razorback tickets]] &new{2008-05-22 (木) 15:10:26}; #comment