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.
2c7c807a1df0c76a8fc823c709b501a9?d=identicon&s=25 Victor Shepelev (Guest)
on 2006-05-12 06: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
58479f76374a3ba3c69b9804163f39f4?d=identicon&s=25 Eric Hodel (Guest)
on 2006-05-12 08:57
(Received via mailing list)
On May 11, 2006, at 9:08 PM, Victor Shepelev 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 Hodel - drbrain@segment7.net - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com
E20e89d58211a3631842daecc1245de2?d=identicon&s=25 Ilmari Heikkinen (Guest)
on 2006-05-12 21:02
(Received via mailing list)
Hi,

On 5/12/06, Victor Shepelev <vshepelev@imho.com.ua> 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?
58479f76374a3ba3c69b9804163f39f4?d=identicon&s=25 Eric Hodel (Guest)
on 2006-05-12 23:28
(Received via mailing list)
On May 12, 2006, at 11:59 AM, Ilmari Heikkinen 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 Hodel - drbrain@segment7.net - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com
E20e89d58211a3631842daecc1245de2?d=identicon&s=25 Ilmari Heikkinen (Guest)
on 2006-05-13 01:07
(Received via mailing list)
On 5/13/06, Eric Hodel <drbrain@segment7.net> 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.