Print with no arguments?

I feel that the Ruby interpreter is poking fun at me with this error:

findcols.rb:84:in `print’: wrong number of arguments(1 for 0)
(ArgumentError)

The script does indeed run without errors as soon as I remove the
argument from print, but what sense should that make? The culprit line
with a little context:

(0…@peak).each do |n|
(0…@cumul.size-1).each {|i| print “*” if @cumul[i] > n}
puts
end

···


Oliver Cromm

perhaps you have another ‘def print…’ in scope somewhere which does NOT take
an argument? are you sure that your entire source file (or something you’ve
required) has not defined a print?

-a

···

On Wed, 25 Feb 2004, Oliver Cromm wrote:

I feel that the Ruby interpreter is poking fun at me with this error:

findcols.rb:84:in `print’: wrong number of arguments(1 for 0)
(ArgumentError)

The script does indeed run without errors as soon as I remove the
argument from print, but what sense should that make? The culprit line
with a little context:

(0…@peak).each do |n|
(0…@cumul.size-1).each {|i| print “*” if @cumul[i] > n}
puts
end

EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
PHONE :: 303.497.6469
ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
URL :: Solar-Terrestrial Physics Data | NCEI
TRY :: for l in ruby perl;do $l -e “print "\x3a\x2d\x29\x0a"”;done
===============================================================================

Have you perhaps overridden print somewhere in your code?

Nathaniel

<:((><

···

On Feb 25, 2004, at 13:44, Oliver Cromm wrote:

I feel that the Ruby interpreter is poking fun at me with this error:

findcols.rb:84:in `print’: wrong number of arguments(1 for 0)
(ArgumentError)

The script does indeed run without errors as soon as I remove the
argument from print, but what sense should that make? The culprit line
with a little context:

(0…@peak).each do |n|
(0…@cumul.size-1).each {|i| print “*” if @cumul[i] > n}
puts
end

Hey

Oliver Cromm c1205@er.uqam.ca writes:

I feel that the Ruby interpreter is poking fun at me with this
error:

findcols.rb:84:in `print’: wrong number of arguments(1 for 0)
(ArgumentError)

perhaps you have another ‘def print…’ in scope somewhere which
does NOT take an argument?

Indeed, that’s it. So I was poking fun at me myself. I’ll quickly
change the name of that “print” function!

even though you found an error it wouldn’t hurt if you put it like so

print(“*”) if …

so that the precedence is clear. The interpreter could have seen it as

print (“*” if …)

which would be runtime problem.

Cheers!
Archit

···

“Ara.T.Howard” ahoward@fattire.ngdc.noaa.gov wrote:

On Wed, 25 Feb 2004, Oliver Cromm wrote:

Thanks!

Oliver Cromm

[print “*” if @cumul[i] > n]

even though you found an error it wouldn’t hurt if you put it like
so

print(“*”) if …

so that the precedence is clear.

Indeed - that was my first suspicion as to the source of the error, so
I tried changing to

	"*".print

Strange how unfamiliar the print() version looks.

···

Archit Baweja bighead@users.sourceforge.net wrote:

Oliver Cromm