[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dennou-ruby:000236] Re: NumArray prototype in ruby



锟斤拷锟饺わ拷锟斤拷扦锟�

In message "[dennou-ruby:000233] Re: NumArray prototype in ruby"
    on 00/02/07, Takeshi Horinouchi <horinout@xxxxxx> writes:

>% ruby numarray.rb
>
>锟饺わ拷锟斤拷锟斤拷锟斤拷锟睫わ拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷胜锟剿匡拷锟节なプワ拷锟斤拷矢锟斤拷膜锟斤拷皮蓼锟斤拷锟�
>锟铰乖凤拷踏锟侥癸拷锟斤拷扦锟斤拷韦恰锟絣ess 锟剿でわ拷锟斤拷锟斤拷锟斤拷锟角诧拷锟斤拷锟斤拷锟斤拷

锟斤拷锟轿わ拷锟斤拷违妗硷拷匹锟斤拷锟狡ワ拷锟饺わ拷锟斤拷 xmp 锟饺わ拷锟斤拷锟轿わ拷锟斤拷锟斤拷蓼锟斤拷锟�
RAA 锟斤拷 devel 锟斤拷锟斤拷锟斤拷锟斤拷锟剿わ拷锟斤拷锟角わ拷锟筋し锟斤拷锟斤拷锟斤拷锟睫わ拷锟斤拷
http://www.ruby-lang.org/en/raa.html

-- gotoken

# 锟斤拷锟轿わ拷没锟斤拷锟轿でつわ拷锟饺わ拷锟睫わ拷

module Kernel
  XMP_VERSION = "2000-01-03"

  def xmp(arg, show = true) # prints expample code and result line by line
    if show
      __res__ = []
      eval arg.gsub(/^(.*)\n?/){ "__res__ << (#{$1}).inspect;" }
      arg.split(/\n/).each_with_index{|l,i|
        (puts "\n" ; next) if l =~ /^$/
        print "#{l}\n    #=> #{__res__[i]}\n"
      }
    else
      print arg; eval arg
    end
  end
  alias __xmp__ xmp
end