Re: Euphoria 2.5
- Posted by "Juergen Luethje" <j.lue at gmx.de> Jul 29, 2004
- 630 views
Igor Kachan wrote: >> From: Juergen Luethje >> Sent: 28 jul 2004 y. 23:39 >> >> Igor Kachan wrote: >> >>> CK Lester wrote: >>>> >>>> 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 >>> >>> He - he, CK, this version above is yours one, >>> it doesn't quite work perfectly... >>> >>>> Sure, you could define B_ and C_, >>> >>> Yes, good, this is my version ... >> >> How should B_ and C_ be defined, and how >> should the appropriate value >> be assigned to B_ and C_? >> Will you define a separate type for each sequence? >> >> <snip> > > Yes, a separate type for each sequence. > > }}} <eucode> > integer B_ > type sequence_with_length_B() > ... > end type > > integer C_ > type sequence_with_length_C() > ... > end type > > integer D_ > type sequence_with_length_D() > ... > end type > </eucode> {{{ And what is the advantage compared to conventional Euphoria programming style, i.e. not using all those types, but using 'length(A_A)', 'length(A_B)' etc. directly? Regards, Juergen