[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Map with &:method_name

Oliver Saunders

7/10/2008 9:11:00 PM

I see this a lot but it doesn't work for me in IRB. Is a gem required or
something?

>> [1,2,3].map(&:to_s)
TypeError: wrong argument type Symbol (expected Proc)
from (irb):2
--
Posted via http://www.ruby-....

15 Answers

ara.t.howard

7/10/2008 9:23:00 PM

0


On Jul 10, 2008, at 3:11 PM, Oliver Saunders wrote:

> I see this a lot but it doesn't work for me in IRB. Is a gem
> required or
> something?
>
>>> [1,2,3].map(&:to_s)
> TypeError: wrong argument type Symbol (expected Proc)
> from (irb):2


it's rails - basically


class Symbol
def to_proc
sym = self
lambda{|obj| obj.send sym}
end
end

a @ http://codeforp...
--
we can deny everything, except that we have the possibility of being
better. simply reflect on that.
h.h. the 14th dalai lama




Rick DeNatale

7/10/2008 10:37:00 PM

0

[Note: parts of this message were removed to make it a legal post.]

On Thu, Jul 10, 2008 at 5:22 PM, ara.t.howard <ara.t.howard@gmail.com>
wrote:

>
> On Jul 10, 2008, at 3:11 PM, Oliver Saunders wrote:
>
> I see this a lot but it doesn't work for me in IRB. Is a gem required or
>> something?
>>
>> [1,2,3].map(&:to_s)
>>>>
>>> TypeError: wrong argument type Symbol (expected Proc)
>> from (irb):2
>>
>
>
> it's rails - basically
>
>
> class Symbol
> def to_proc
> sym = self
> lambda{|obj| obj.send sym}
> end
> end
>

And it's been picked up in Ruby 1.9, and maybe 1.8.7 as well since the
current draft of the Pickaxe 3rd ed doesn't label it as 1.9 only.


--
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denh...

Oliver Saunders

7/11/2008 2:03:00 AM

0

ara.t.howard wrote:
> On Jul 10, 2008, at 3:11 PM, Oliver Saunders wrote:
>
>> I see this a lot but it doesn't work for me in IRB. Is a gem
>> required or
>> something?
>>
>>>> [1,2,3].map(&:to_s)
>> TypeError: wrong argument type Symbol (expected Proc)
>> from (irb):2
>
>
> it's rails - basically
>
>
> class Symbol
> def to_proc
> sym = self
> lambda{|obj| obj.send sym}
> end
> end
>
> a @ http://codeforp...

OK thanks guys. I found the actual definition:

class Symbol
def to_proc
Proc.new { |*args| args.shift.__send__(self, *args) }
end
end


--
Posted via http://www.ruby-....

Yoorghis

7/10/2012 4:02:00 PM

0

On Tue, 10 Jul 2012 00:03:27 -0400, Obama's Legion of Flash Mobs @
7/11.nig wrote:

>On Mon, 09 Jul 2012 20:17:44 -0600, Yoorghis@Jurgis.net wrote:
>
>>On Mon, 09 Jul 2012 16:04:26 -0700, MattB
>><trdell1234NOMORESPAM@gmail.com> wrote:
>>
>>>Gaza sniper fire shatters glass onto kid's car seat
>>
>>ALmost like Israelis did in the late 40's in order to steal palestine
>
>You're a f'ing liar
>
>CB




>=================================================================

Charley Barta---Racist (and friend of PAJAMAFOOL) states:



>To appose racial mixing is respecting race not putting it
>down. People are different, in skin color and belief. We are not mutts like some
>mono-culture. - CB

"Fuck you nigger" - CB

"To appose racial mixing is respecting race not putting it down. People are
different, in skin color and belief. We are not mutts like some mono-culture."
- white supremacist CB

What a hate , hate filled homo, bigot

Slackjaw

7/10/2012 4:57:00 PM

0

On Jul 10, 12:03 am, Obama's Legion of Flash Mobs @ 7/11.nig wrote:
> On Mon, 09 Jul 2012 20:17:44 -0600, Yoorg...@Jurgis.net wrote:
> >On Mon, 09 Jul 2012 16:04:26 -0700, MattB
> ><trdell1234NOMORES...@gmail.com> wrote:
>
> >>Gaza sniper fire shatters glass onto kid's car seat
>
> >ALmost like Israelis did in the late 40's in order to steal palestine

In the 1940's the Nazi's tried to exterminate all Jewish women and
children.

Today Arab Muslim Terrorists try to exterminate all Jewish women and
children.

So little has changed.

And Gary, being a modern-day Nazi, cheers them on.
>
> You're a f'ing liar
>
> CB
> Brother Ain’t Shooting No Blanks’: Farrakhan Tells Blacks — Breeding
> With Whites Is the ‘End of Your Racehttp://www.theblaze.com/stories/brother-aint-shooting-no-bl......

MattB

7/10/2012 6:06:00 PM

0

On Tue, 10 Jul 2012 09:57:26 -0700 (PDT), Salty Stan
<wsjames123@gmail.com> wrote:

>On Jul 10, 12:03?am, Obama's Legion of Flash Mobs @ 7/11.nig wrote:
>> On Mon, 09 Jul 2012 20:17:44 -0600, Yoorg...@Jurgis.net wrote:
>> >On Mon, 09 Jul 2012 16:04:26 -0700, MattB
>> ><trdell1234NOMORES...@gmail.com> wrote:
>>
>> >>Gaza sniper fire shatters glass onto kid's car seat
>>
>> >ALmost like Israelis did in the late 40's in order to steal palestine
>
>In the 1940's the Nazi's tried to exterminate all Jewish women and
>children.
>
>Today Arab Muslim Terrorists try to exterminate all Jewish women and
>children.
>
>So little has changed.
>
>And Gary, being a modern-day Nazi, cheers them on.

Gary also supports Murder on US soil.

Seems many on the Far Left support Murder of Children.

One even used the Crusades of 600 years ago, as a excuse for the
killing of Christian Children by Muslims.

>>
>> You're a f'ing liar
>>
>> CB
>> Brother Ain?t Shooting No Blanks?: Farrakhan Tells Blacks ? Breeding
>> With Whites Is the ?End of Your Racehttp://www.theblaze.com/stories/brother-aint-shooting-no-bl......

Yoorghis

7/10/2012 8:07:00 PM

0

On Tue, 10 Jul 2012 09:57:26 -0700 (PDT), Salty Stan
<wsjames123@gmail.com> wrote:

>On Jul 10, 12:03?am, Obama's Legion of Flash Mobs @ 7/11.nig wrote:
>> On Mon, 09 Jul 2012 20:17:44 -0600, Yoorg...@Jurgis.net wrote:
>> >On Mon, 09 Jul 2012 16:04:26 -0700, MattB
>> ><trdell1234NOMORES...@gmail.com> wrote:
>>
>> >>Gaza sniper fire shatters glass onto kid's car seat
>>
>> >ALmost like Israelis did in the late 40's in order to steal palestine
>
>In the 1940's the Nazi's tried to exterminate all Jewish women and
>children.

YEs, a conservative rightwing despot and totalitarian regime (having
adapted Southern state social policies) did that.

>Today Arab Muslim Terrorists try to exterminate all Jewish women and
>children.

Oops---you forgot the bombs, assassinations, ambushes and murder of
british in that region in the late 40's leading up to the stealing of
Arab land.

>So little has changed.

The excesses of conservative, right wing polcies do take a toll

>And Gary, being a modern-day Nazi, cheers them on.

Can't have it both ways, stupid.

You cry and whine about "libruls"---then claim we're "rightwing"

Ever think of the fact you have no fucking clue about anything?

>> You're a f'ing liar
>>
>> CB




>=================================================================

Charley Barta---Racist (and friend of PAJAMAFOOL) states:



>To appose racial mixing is respecting race not putting it
>down. People are different, in skin color and belief. We are not mutts like some
>mono-culture. - CB

"Fuck you nigger" - CB

"To appose racial mixing is respecting race not putting it down. People are
different, in skin color and belief. We are not mutts like some mono-culture."
- white supremacist CB

What a hate , hate filled homo, bigot

Yoorghis

7/10/2012 8:10:00 PM

0

On Tue, 10 Jul 2012 11:06:29 -0700, MattB
<trdell1234NOMORESPAM@gmail.com> wrote:

>Gary also supports Murder on US soil.

By advocating taking assault weapons out of nuts like your hands?

>Seems many on the Far Left support Murder of Children.

Not so much

Since WE didn't lie us into war, and have historically had to clean up
every fucking mess 'o war started by conservatives.

>One even used the Crusades of 600 years ago, as a excuse for the
>killing of Christian Children by Muslims.

See---that's why I demand you keep your murdering religious
justification out of government---yours parrots Hitler.



>================================================================


"I believe today that I am acting in the sense of the Almighty
Creator. By warding off the Jews I am fighting for the Lord's work."
[Adolph Hitler, Speech, Reichstag, 1936]

"I have followed [the Church] in giving our party program the
character of unalterable finality, like the Creed. The Church has
never allowed the Creed to be interfered with.
The faithful will swallow it whole, so long as logical reasoning is
never allowed to be brought to bear on it."
[Adolf Hitler, from Rauschning, _The Voice of Destruction_, pp.
239-40]

"My feelings as a Christian points me to my Lord and Savior as a
fighter. It points me to the man who once in loneliness, surrounded by
a few followers,...For as a Christian I have also a duty to my own
people. And when I look on my people I see them work and work and toil
and labor, and at the end of the week they have only for their wages
wretchedness and misery. When I go out in the morning and see these
men standing in their queues and look into their pinched faces, then I
believe I would be no Christian, but a very devil, if I felt no pity
for them, if I did not, as did our Lord two thousand years ago, turn
against those by whom today this poor people are plundered and
exposed."
[Adolf Hitler, speech in Munich on April 12, 1922, countering a
political opponent, Count Lerchenfeld, who opposed antisemitism on his
personal Christian feelings. Published in "My New Order", quoted in
Freethought Today April 1990]


"I believe today that my conduct is in accordance with the will of the
Almighty Creator."
[Adolph Hitler, _Mein Kampf_, pp. 46]


"What we have to fight for...is the freedom and independence of the
fatherland, so that our people may be enabled to fulfill the mission
assigned to it by the Creator."
[Adolph Hitler, _Mein Kampf_, pp. 125]


"This human world of ours would be inconceivable without the practical
existence of a religious belief."
[Adolph Hitler, _Mein Kampf_, pp.152]


"And the founder of Christianity made no secret indeed of his
estimation of the Jewish people. When He found it necessary, He drove
those enemies of the human race out of the Temple of God."
[Adolph Hitler, _Mein Kampf_, pp.174]

"Catholics and Protestants are fighting with one another... while the
enemy of Aryan humanity and all Christendom is laughing up his
sleeve."
[Adolph Hitler, _Mein Kampf_, pp.309]

"I am now as before a Catholic and will always remain so"
[Adolph Hitler, to Gen. Gerhard Engel, 1941]

"Any violence which does not spring from a spiritual base, will be
wavering and uncertain. It lacks the stability which can only rest in
a fanatical outlook."
[Adolph Hitler, _Mein Kampf_, p. 171]

"I had excellent opportunity to intoxicate myself with the solemn
splendor of the brilliant church festivals. As was only natural, the
abbot seemed to me, as the village priest had once seemed to my
father, the highest and most desirable ideal."
[Adolf Hitler, "Mein Kampf", Vol. 1, Chapter 1]

MattB

7/10/2012 8:30:00 PM

0

On Tue, 10 Jul 2012 14:09:49 -0600, Yoorghis@Jurgis.net wrote:

>On Tue, 10 Jul 2012 11:06:29 -0700, MattB
><trdell1234NOMORESPAM@gmail.com> wrote:
>
>>Gary also supports Murder on US soil.
>
>By advocating taking assault weapons out of nuts like your hands?

Sorry I am licensed for al the weapons I own. Totally legal and I
don't personally own a automatic assault rifle. Have used them from
time to time but don't own one personally.


>
>>Seems many on the Far Left support Murder of Children.
>
>Not so much

Ya right I forgot to you and the Far Left Jews are less than Human.
Some would say that of you.
>
>Since WE didn't lie us into war, and have historically had to clean up
>every fucking mess 'o war started by conservatives.
>
>>One even used the Crusades of 600 years ago, as a excuse for the
>>killing of Christian Children by Muslims.
>
>See---that's why I demand you keep your murdering religious
>justification out of government---yours parrots Hitler.

Strange was one of your Far Left buddies that used the Crusades to
excuse the murder of Christian Children.

You're a strange racist.


Snipped liberal teachings.


Yoorghis

7/11/2012 2:37:00 AM

0

On Tue, 10 Jul 2012 13:29:47 -0700, MattB
<trdell1234NOMORESPAM@gmail.com> wrote:

>On Tue, 10 Jul 2012 14:09:49 -0600, Yoorghis@Jurgis.net wrote:
>
>>On Tue, 10 Jul 2012 11:06:29 -0700, MattB
>><trdell1234NOMORESPAM@gmail.com> wrote:
>>
>>>Gary also supports Murder on US soil.
>>
>>By advocating taking assault weapons out of nuts like your hands?
>
>Sorry I am licensed for al the weapons I own. Totally legal and I
>don't personally own a automatic assault rifle. Have used them from
>time to time but don't own one personally.

Wouldn't it be easier to just say you're a fucking GunLoon?