[#42643] メールのSMTP認証の方法(質問) — "Hisashi Yahata" <yahatah@...>

お世話になります。

34 messages 2006/08/09
[#42649] Re: メールのSMTP認証の方法(質問) — OHARA Shigeki <os@...> 2006/08/09

大原です。

[#42650] Re: メールのSMTP認証の方法(質問) — "Hisashi Yahata" <yahatah@...> 2006/08/09

大原様

[#42651] Re: メールのSMTP認証の方法(質問) — 植田裕之 <ueda@...> 2006/08/09

植田と申します。

[#42654] Re: メールのSMTP認証の方法(質問) — "Hisashi Yahata" <yahatah@...> 2006/08/09

植田 裕之様

[#42657] Re: メールのSMTP認証の方法(質問) — WATANABE Tetsuya <Tetsuya.WATANABE@...> 2006/08/09

渡辺哲也です。

[ruby-list:42669] Re: 組み合わせを作るrubyらしい方法

From: take_tk <ggb03124@...>
Date: 2006-08-10 16:25:35 UTC
List: ruby-list #42669
たけ(tk)です。

こんなのも思いついた。

class Array

@@combi_indicies_hash = {}
def combi_indicies(s,n)
#p [s,n,@@combi_indicies_hash[[s,n]]]
  return [] if (n < 1) || (n > s)
  case n
  when 1 ; return  Array.new(s){|i|[i]}
  when s ; return [Array.new(s){|i| i }]
  else
    return @@combi_indicies_hash[[s,n]] ||= (combi_indicies(s-1,n)+combi_indicies(s-1,n-1).collect{|a| a+[s-1]}).sort
  end
end

def combinationN(n)
  combi_indicies(self.size,n).collect{|a| self.values_at(*a)}
end
end

p [:r,:u,:b,:y].combinationN(0) #=> []
p [:r,:u,:b,:y].combinationN(1) #=> [[:r], [:u], [:b], [:y]]
p [:r,:u,:b,:y].combinationN(2) #=> [[:r, :u], [:r, :b], [:u, :b], [:r, :y], [:u, :y], [:b, :y]]
p [:r,:u,:b,:y].combinationN(3) #=> [[:r, :u, :b], [:r, :u, :y], [:r, :b, :y], [:u, :b, :y]]
p [:r,:u,:b,:y].combinationN(4) #=> [[:r, :u, :b, :y]]
p [:r,:u,:b,:y].combinationN(5) #=> []
p [:r,:u,:b,:y].combinationN(6) #=> []

p [11,22,33,44,55,66,77,88,99].combinationN(5) #=> []


take_tk = kumagai hidetake

In This Thread