Forum: Ruby YARV vs. lambda

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Victor S. (Guest)
on 2006-05-12 08:11
(Received via mailing list)
Hi all.

Somebody knows why YARV do this:

l = lambda{|*arg| p arg}

l[1]   #prints 1 instead of [1]
l[2,3] #prints 2 instead of [2,3]
l[]    #prints 0 instead of []

Thanks.

Victor
Eric H. (Guest)
on 2006-05-12 10:57
(Received via mailing list)
On May 11, 2006, at 9:08 PM, Victor S. wrote:

> Hi all.
>
> Somebody knows why YARV do this:
>
> l = lambda{|*arg| p arg}
>
> l[1]   #prints 1 instead of [1]
> l[2,3] #prints 2 instead of [2,3]
> l[]    #prints 0 instead of []

YARV doesn't yet pass 'make test' so those aren't supported.

--
Eric H. - removed_email_address@domain.invalid - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com
Ilmari H. (Guest)
on 2006-05-12 23:02
(Received via mailing list)
Hi,

On 5/12/06, Victor S. <removed_email_address@domain.invalid> wrote:
> Hi all.
>
> Somebody knows why YARV do this:
>
> l = lambda{|*arg| p arg}
>
> l[1]   #prints 1 instead of [1]
> l[2,3] #prints 2 instead of [2,3]
> l[]    #prints 0 instead of []

Works here.. Try the SVN HEAD?
Eric H. (Guest)
on 2006-05-13 01:28
(Received via mailing list)
On May 12, 2006, at 11:59 AM, Ilmari H. wrote:

>
> Works here.. Try the SVN HEAD?

How did you compile it?

$ ruby-yarv -ve 'lambda { |*a| p a }[2,3]'
ruby 2.0.0 (Base: Ruby 1.9.0 2006-04-08) [powerpc-darwin8.6.0]
YARVCore 0.4.0 Rev: 497 (2006-05-07) [opts: ]
2

--
Eric H. - removed_email_address@domain.invalid - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com
Ilmari H. (Guest)
on 2006-05-13 03:07
(Received via mailing list)
On 5/13/06, Eric H. <removed_email_address@domain.invalid> wrote:
> >> l[2,3] #prints 2 instead of [2,3]
>
oh, looks like i was using an old revision

kig@bright:~/code/yarv> ./ruby-yarv -ve 'lambda{|*a| p a}[2,3]'
ruby 2.0.0 (Base: Ruby 1.9.0 2006-02-14) [i686-linux]
YARVCore 0.4.0 Rev: 482 (2006-03-08) [opts: ]
[2, 3]

kig@bright:~/code/yarv> ./ruby -ve 'lambda{|*a| p a}[2,3]'
ruby 2.0.0 (Base: Ruby 1.9.0 2006-04-08) [i686-linux]
YARVCore 0.4.0 Rev: 497 (2006-05-07) [opts: ]
2

sorry for the confusion
This topic is locked and can not be replied to.