Re: Euphoria 2.5
- Posted by "Igor Kachan" <kinz at peterlink.ru> Jul 31, 2004
- 639 views
Hi CK again, You wrote: ---------- > From: cklester <guest at RapidEuphoria.com> > To: EUforum at topica.com > Subject: Re: Euphoria 2.5 > Sent: 28 jul 2004 y. 22:22 > > posted by: cklester <cklester at yahoo.com> > > Igor, your version of s[length(s)] doesn't > quite work perfectly... > > Run this: > -- start of code > include get.e > > sequence junk > > integer A_ > type sequence_with_length_A(sequence a) > A_= length(a) > return sequence(a) > end type > > sequence_with_length_A A_A, A_B, A_C > > A_A = "Hello" > A_B = "World" > A_C = "Goodbye!" > > ?A_A[A_] > ?A_B[A_] > ?A_C[A_] > > --end of code > > Sure, you could define B_ and C_, but > what happens when you have > a billion sequences? :) Try please new version of that hard game:
integer A, B, C, D, E -- to billion type sequences_with_lengths(sequence a) A=length(a[1]) B=length(a[2]) C=length(a[3]) D=length(a[4]) E=length(a[5]) -- to billion return 1 end type sequences_with_lengths S S={{1,2,3}, {4,5,6,7}, {7,8,9,8,9}, {1,3,5,7,9,0}, {0,2,4,6,8,1,1}} -- to billion ? A ? B ? C ? D ? E ? S[1][A] ? S[2][B] ? S[3][C] ? S[4][D] ? S[5][E] S[3] = {11,12} ? C ? S[3][C] -- and so on
This is old good Euphoria programming language, isn't it? Just now, works for me. Regards, Igor Kachan kinz at peterlink.ru