MikkelFJ | 1 Dec 01:00 2002
Picon

Re: Numerical Ruby


"Olivier Saut" <Olivier.Saut <at> gmm.insa-tlse.fr> wrote in message
news:20021201001712.48f6cb67.Olivier.Saut <at> gmm.insa-tlse.fr...
> Hi all,
>
> I am now using Ruby to test my numerical schemes. Using Ruby for this
> task was a real pleasure (I usually code in F90). The computations run
> just fine but I would like to have a result a little faster.
>
> My code uses lots of loops as in the following example.

Is there any way you could use Ruby to implement a symbolic evaluation
instead of an explicit evaluation? Ruby is stronger in this aspect. Given a
symbolic definition you could generate code on the fly - for example using
inline C - but I guess that would add complexity rather than remove
complexity from you implementation which may be beside the point of using
Ruby.

In the end it depends on whether you use Ruby because it is easier as an
implementation language, or becuase you want the end users to be able to
access the library from Ruby. The latter approach is good, the former is
bound to be slow.

There is also the NML language by dmcclaim which generates compiled ocaml
code on the fly resulting in (claimed) rather fast evaluation of numerical
applications even compared to C libraries because of the dynamic compilation
of expressions. It might be a backend for a Ruby solution.

http://home.mindspring.com/~dmcclain1/nmlpromo.htm
the source is not online although listed:
(Continue reading)

Rudolf Polzer | 1 Dec 01:00 2002
Picon

Re: Ruby ++, the one element and generators

Scripsit ille aut illa MikkelFJ <mikkelfj-anti-spam <at> bigfoot.com>:
> "Rudolf Polzer" <AntiATField_adsgohere <at> durchnull.de> wrote:
> > Scripsit ille aut illa MikkelFJ <mikkelfj-anti-spam <at> bigfoot.com>:
> > [...]
> > > In algebraic terms, there is no 'one' element for Real numbers, while
> > > natural numbers (integers) do have a one element. Furthermore it is not
> > > within the realms of Ruby to redefine the natural numbers, thus no next!
> > > method.
> > [...]
> >
> > You are referring to an algebraic 'group' (is it called like that in
> > English?).
> It's called so in the direct Danish translation. I'm not sure this is the
> correct Englis term.
> 
>  A 'group' doesn't necessarily have a one element. But a
> > N and Z_p do have a 'next' operation.
> 
> I don't recall the exact criterias anymore, but it's clear the Z can't be
> generated by adding one, as you'd have to start at negative infinity.

That's why I named Z_p. Even Z_n would work (addition modulo n, eg if n
= 6, 4 + 5 = 9, 9 MOD 6 is 3, therefore 4 + 5 _=_ 3 (mod 6)), but if
you are using the normal operations modulo a prime number, you can even
divide:

  5/4 _=_  x (mod 7)
  5   _=_ 4x (mod 7)
  5    =  4x + 7q

(Continue reading)

MikkelFJ | 1 Dec 01:01 2002
Picon

Re: Numerical Ruby


"MikkelFJ" <mikkelfj-anti-spam <at> bigfoot.com> wrote in message
news:3de94bd0$0$47406$edfadb0f <at> dtext01.news.tele.dk...

> Is there any way you could use Ruby to implement a symbolic evaluation
> instead of an explicit evaluation?

In my long tradition of replying to myself,
one could imagine something like the following:

class SymScalar
  attr_reader :var
  def initialize name
     <at> var = name
  end
  def + a
    puts "#{ <at> var} + #{a.var};"
  end
end

sx = SymScalar.new "x"
sy = SymScalar.new "y"

sx + sy ==> x + y;

Mikkel

Shannon Fang | 1 Dec 01:05 2002
Picon

httpmail

Hi

I'm trying httpmail-0.3 to connect to hotmail. I tried it with 1.66 when
I first knew ruby. Interestingly, this package is my introducer to the
ruby world. At that time I'm looking for a programmatic way to retrieve
hotmail. I found httpmail in sourceforge, and learned that hotmail used
webDAV. After download it, I found there are a ruby subdirectory. Then I
searched google, and start to know ruby :)

Now I encountered a lot of problems to use httpmail in ruby version 1.67,
then I upgrated to v1.73. Still some problem:

1. it reported that mswin32-ruby17.dll could not be found in the
specified path. In fact this file doesn't even exist on my hard disk!

2. 
c:/ruby/lib/ruby/1.7/xmltree.rb:949: warning: parenthesize argument(s)
for future version
c:/ruby/lib/ruby/1.7/i386-mswin32/xmlparser.so: 126: The specified module could
not be found.   - c:/ruby/lib/ruby/1.7/i386-mswin32/xmlparser.so (LoadError)

I don't know if httpmail is still an active project or not?

Shannon

Florian Frank | 1 Dec 01:10 2002
Picon
Picon

Re: Scalars

On Sun, 2002-12-01 at 00:28, Daniel Carrera wrote:
> > Apart from syntax, there's nothing special about Array or Hash objects in
> > Ruby, so there's no special word for them.
> Yes there is.  You just called them "array" and "hash".  How do you call
> something that is neither?

Ruby's objects usually know how they liked to be called. If you have a
variable "ref" that holds a reference to an object call "ref.class.name"
and it will tell you its name.

Shannon Fang | 1 Dec 01:26 2002
Picon

Cipher book for ruby

Hi all ruby gurus there,

I suggest if some one can initiate a documentation project for ruby? I
would call it The Ruby Cipher Book, or Ruby Demystified. In this
document, all ruby symobs, prefixes suffixes are explained, with
reference to the chapter in the online manual...

I encountered a symbol I don't understand, may be simply I didn't read
the manual careful enough -- sorry. 

 <at>  <at> var={ } ??

I knew that [ ] is for array, but what is { }?

There are a lot such cryptic things, some I know some I don't, such as 

%w, << === < ! ~ $_ ...

I do hope there are a quick reference of these horrible things. :-p

Shannon

why the lucky stiff | 1 Dec 01:40 2002
Picon

Re: Fast Ruby web server

MikkelFJ (mikkelfj-anti-spam <at> bigfoot.com) wrote:
> I was just looking at Tiki which recommended esehttpd in the documentation.
> 
> http://ghost.math.sci.hokudai.ac.jp/esehttpd/sources/
> 

Thanks a lot for the link.  I've been playing with this web server for
the past few days.  This is a fun little web server.  Its configuration
has a bit to be desired and I had to hack cgiruby.c to get it to cache
libraries like mod_ruby, but it is a SWIFT little creature.

For personal websites that don't need the bulkiness of Apache, ESE is
great.  And it would be a great centerpiece for a Zope-like product for
Ruby.  Just need to get it working on non-Linux platforms.

_why

Useko Netsumi | 1 Dec 01:41 2002
Picon

mod_ruby for Windows XP

Do they exist? If not, is anyone working on it? Thanks

Lyle Johnson | 1 Dec 01:41 2002
Picon
Picon

Re: use of FXSwitcher ? --correct! (sorry)

Ludo wrote:

> I don't understand why this don't construct correctly the GUI :
> 
> class Switcher < FXSwitcher
>   def initialise(p)
>     super(p, FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0)
>     FXLabel.new(self, "area 1", nil, LAYOUT_FILL_X|LAYOUT_FILL_Y)
>     FXLabel.new(self, "area 2", nil, LAYOUT_FILL_X|LAYOUT_FILL_Y)
>   end
> end
> Switcher.new

Guy has already pointed out the misspelling of "initialize", which is a 
big problem. But it's also going to be a problem if you are truly 
constructing the switcher with the statement:

	Switcher.new

since you're not passing in the parent widget (i.e. the "p" argument to 
Switcher#initialize).

Bill Kelly | 1 Dec 01:53 2002
Picon

Re: Ruby Document

Hi Shannon,

> If :a is independent to any other variable, it can only be a
> "immutable" or very economic string, what's the big deal?

Yes, exactly.  :a is not any kind of variable at all, nor is it
bound to any kind of variable.  It, indeed, is an immutable,
economic, singleton construction of the string "a".

What's the big deal?  Well, ... does something have to be a Big
Deal to be useful? :)

I like symbols in Ruby a lot.  Smalltalk has them (but my 
Smalltalk is rusty so I don't remember it there's a special
syntax for them); and Java has them 
( http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html#intern() )
but what I think is so fantastic in Ruby is the ability to
specify a symbol syntactically without cluttering up the
code.  :name is so much nicer and easier to read than
"name".intern...  So with Ruby we can utilize symbols for
certain kinds of constants, and, I think make the code very
readable.

     <at> state = :login

  # . . . . .

    case  <at> state
      when :login  then session_handle_login(line)
      when :passwd then session_handle_passwd(line)
(Continue reading)


Gmane