Fun with shifting bytes / Python translation

Thanks for your help! That fixed it. The rest of the math was
straight-forward to port. Now back to the QWK/REP import routine…

Mark

···

-----Original Message-----
From: angus@quovadis.com.ar [mailto:angus@quovadis.com.ar]
Sent: 08 August 2002 10:50
To: ruby-talk@ruby-lang.org
Subject: Re: Fun with shifting bytes / Python translation

[…]

I don’t understand how lamba or reduce work, for instance.
[…]
L=map(lambda x: ord(x), L[0:4])
L.reverse()
n=reduce(lambda x,y: x*256+y, L, 0L)

I don’t know about the math, but with regard to the lambdas, I suppose the
first creates an array containing the byte values of the string:

l = l.split(//).map{ |c| c[0] }
l.reverse!

and the second could be something like this:

n = 0
l.each {|i| n = n*256+i }

But I really don’t know Python.

Good luck.

NOTICE: This e-mail and any attachment(s) may contain confidential and
proprietary information of Goss International Corporation and/or its
subsidiaries and may be legally privileged. This e-mail is intended solely
for the addressee. If you are not the addressee, dissemination, copying or
other use of this e-mail or any of its content is strictly prohibited and
may be unlawful. If you are not the intended recipient please inform the
sender immediately and destroy the e-mail and any copies. All liability for
viruses is excluded to the fullest extent permitted by law. Any views
expressed in this message are those of the individual sender. No contract
may be construed by this e-mail.

Wow. Some people are actually still using QWK, or is that an effort in
retrocomputing? Have you also considered FTSC-1 NetMail? :wink: (my address
was 1:243/53 back then)

···

On Mon, 12 Aug 2002, Firestone, Mark - Technical Support wrote:

Thanks for your help! That fixed it. The rest of the math was
straight-forward to port. Now back to the QWK/REP import routine…


Mathieu Bouchard http://artengine.ca/matju