1. Suggestions for improvement in Euphoria
- Posted by Gambit <gambit at BENDNET.COM> Nov 24, 1998
- 503 views
Here are a few suggestions for better methods of accessing sequences in Euphoria. The first (and simplest) lacking in sequence slicing is the inability to do: new = old[length(old)..1] to get a reverse element-ordering. I have needed this a lot and I'm sure I'm not the only one. Second, I think there needs to be a better way of accessing the last element within a sequence. Perhaps a value of -1 could be used to represent the last element, or a character such as '~' to represent the length of the sequence. Example: new = old[1..length(old)] could be the same as: new = old[1..-1] -or- pointer = -1 new = old[1..pointer] -or- new = old[1..~] the first and last of the new methods would severely reduce the typing required on most slicing operations, and in some cases the second example would allow more universal code: if var1 = var2 then element = 2 else element = -1 end if var3 = sequence[element] Third, there needs to be better support for multi-depth slicing: new = old[1][5][2][3] should be replaced with: new = old[{1, 5, 2, 3}] -or- pointer = {1, 5, 2, 3} new = old[pointer] as this would allow you to use a sequence to let you access different depths during run-time without having to use recursive function. Fourth, there needs to be support for grabbing many high-level elements at once: new = repeat(3, 0) new[1] = old[2][3][4][1] new[2] = old[3][3][4][1] new[3] = old[4][3][4][1] should be replaced with: new = old[2..4][3][4][1] and of course the above method of using a sequence to specify depths could be applied to get: pointer = {3, 4, 1} new = old[2..4][pointer] These are some of the things I most want changed in Euphoria. I'm curious to see who else agrees, or if RDS is already implementing features similar to these in the upcoming Euphoria 2.1.
2. Re: Suggestions for improvement in Euphoria
- Posted by "Bown, John" <John.Bown at UK.ORIGIN-IT.COM> Nov 24, 1998
- 482 views
> >Here are a few suggestions for better methods of accessing sequences in >Euphoria. And a few alternatives. I'm not trying to say you're wrong, just throwing up some alternatives. > new = old[length(old)..1] > to get a reverse element-ordering. I have needed this a lot and I'm sure > I'm not the only one. Could also use new = reverse(old) > Second, I think there needs to be a better way of accessing the last > element within a sequence. As this is usually to allow slicing to be done perhaps the Basic [ oops ] concept of new = left( old, n ) / new = right( old , n ) / new = mid( old , n , m ) to extract sub-slices would be useful Of course we're getting back to the need for beginer.e with all these function pre-defined > Third, there needs to be better support for multi-depth slicing: > new = old[1][5][2][3] > should be replaced with: > new = old[{1, 5, 2, 3}] Hmm, not sure if that's very readable/obviously understanable, but new=old[1,5,2,3] would be welcomed by me. The argument against is that we're really talking about sequences kludged to look like sparse arrays and so different number of indexes would apply at different depths of sequence. But that said; we have that problem with the [][][] form anyway. >These are some of the things I most want changed in Euphoria. I'm curious to >see who else agrees, or if RDS is already implementing features similar to >these in the upcoming Euphoria 2.1. I'd like to see a Ctrl-Break trap that doesn't put ^C up on the screen when used. Ctrl-C and Ctrl-Break ( along with Ctrl-S, Ctrl-P etc ) passed as unique character values through get_key() just like any other and without MS-DOS using them for its own purposes en-route ( ie Ctrl-P = Print Screen ). Is there a list of things to come in 2.1 ?
3. Re: Suggestions for improvement in Euphoria
- Posted by Irv Mullins <irv at ELLIJAY.COM> Nov 24, 1998
- 454 views
On Tue, 24 Nov 1998 07:24:06 -0500, Gambit <gambit at BENDNET.COM> wrote: >Here are a few suggestions for better methods of accessing sequences in >Euphoria. It's too easy to write your own reverse, however, the rest of these are pretty good points. > Second, I think there needs to be a better way of accessing the last > element within a sequence. Perhaps a value of -1 could be used to > represent the last element, or a character such as '~' to represent the > length of the sequence. Example: > new = old[1..length(old)] > could be the same as: > new = old[1..-1] > -or- > pointer = -1 > new = old[1..pointer] > -or- > new = old[1..~] I sort of like the ~ it's quick to type and not used elsewhere. The other suggestions simply add obfuscation: pointer is misleading and -1 is counter-intuitive. > Third, there needs to be better support for multi-depth slicing: > new = old[1][5][2][3] > should be replaced with: > new = old[{1, 5, 2, 3}] > -or- > pointer = {1, 5, 2, 3} > new = old[pointer] > as this would allow you to use a sequence to let you access different > depths during run-time without having to use recursive function. Hmm. That's an interesting concept. It would certainly simplify certain types of code. > Fourth, there needs to be support for grabbing many high-level elements > at once: Also interesting, and useful. >These are some of the things I most want changed in Euphoria. I'm curious to >see who else agrees, or if RDS is already implementing features similar to these >in the upcoming Euphoria 2.1.
4. Re: Suggestions for improvement in Euphoria
- Posted by Daniel Berstein <daber at PAIR.COM> Nov 24, 1998
- 453 views
> Third, there needs to be better support for multi-depth slicing: > new = old[1][5][2][3] > should be replaced with: > new = old[{1, 5, 2, 3}] > -or- > pointer = {1, 5, 2, 3} > new = old[pointer] > as this would allow you to use a sequence to let you access different > depths during run-time without having to use recursive function. Great suggestion! It's brilliant! Using sequences to address sequeces... mmm... terrific! With this enhancement you can do 100% dynamic data strucutures. Note that you can still use the old (current) way: s = {{1,2,3,{4,5}}} s1 = s[{1,4,1}] -- s1 = {4} s2 = s[{1,4}][1] -- s2 = {4} s3 = s[1][4][1] -- s3 = {4} No code breaking!!! Another suggestion that comes to my mind: s = {a,b,c,d,e} s1 = s[~..{1,3,5}] -- s1 = {a,c,e} Regards, Daniel Berstein daber at pair.com
5. Re: Suggestions for improvement in Euphoria
- Posted by Mathew Hounsell <mat.hounsell at EXCITE.COM> Nov 24, 1998
- 461 views
- Last edited Nov 25, 1998
To Gambit and others: I have sent a package to RDS with routines for sequence manipulation (SEQUENCE.E) Negative Length Slicing to Reverse a Sequence: Can't do it in slices but I have a fast reverse function, and a reverse_all function that reverses all sub sequences. Better Way to Slice to End of Sequence: I can't help you except to say I'm in favour of the end keyword. That and the add_section(), replace_section() and del_section() functions in SEQUENCE.E use -1 to stand for the length of the sequence. Multi-Depth Slicing: Add_Value(), Put_Value() and Get_Value() in SEQUENCE.E do this. {1,2,3,4} would reference [1][2][3][4] not atoms and subsequence in the index list are counted as errors. Grabbing More Than One High Level Element at Once: Never thought of that I may change my ?_Value() functions above to support it. -------------------- Sincerely, Mathew Hounsell Mat.Hounsell at MailExcite.Com _______________________________________________________ Get your free, private e-mail at http://mail.excite.com/
6. Re: Suggestions for improvement in Euphoria
- Posted by Rolf Schroeder <r.schroeder at BERGEDORF.DE> Nov 25, 1998
- 521 views
- Last edited Nov 26, 1998
A lot of wishes so far! I would like to state: keep Eu as simple as possible as a language, but as powerfull as possible! I agree partly so far, but I fear the increasing complexity of language definition. I personaly would like (and this is NOT a religious wish) a simple and easy "goto !lable" statement without ANY restrictions within a procedure (i.e. leave deeply nested for-loops). Nobody is forced to use a goto and may write complicated if.. elsif.. else.. ..end if structures. But to forbide the goto is as severe as to allow procedures longer then 100 characters! (hope, I will not be killed for the goto-wish), Rolf
7. Re: Suggestions for improvement in Euphoria
- Posted by Bert Belder <bbelder at HOTMAIL.COM> Nov 26, 1998
- 483 views
> Third, there needs to be better support for multi-depth slicing: > new = old[1][5][2][3] > should be replaced with: > new = old[{1, 5, 2, 3}] > -or- > pointer = {1, 5, 2, 3} > new = old[pointer] > as this would allow you to use a sequence to let you access different > depths during run-time without having to use recursive function. Indeed, great idea. There are two more things which would be nice: old = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}} new = old[ 1..2 ][ 1..2 ] new = {{1, 2}, {4,5}} and, at file reading sequence s s = getc( {handle, 10} ) just like the peek() function. Bert
8. Re: Suggestions for improvement in Euphoria
- Posted by Ralf Nieuwenhuijsen <nieuwen at XS4ALL.NL> Nov 26, 1998
- 465 views
>sequence s >s = getc( {handle, 10} ) > >just like the peek() function. I like this. A keeper. And maybe.. a -1 could indicate the rest of the file-buffer. This is for those cases where the program *procceses* data, however, the data could be too much for our memory to handle (and to start swapping in such cases isnt that handy as well). And in file.e add this global routine: global function read_textfile (sequence fname) sequence result integer fhandle fhandle = open (fname, "r") if fhandle then result = getc ({fhandle, -1}) while result[length(result)] != -1 do result = result & getc({fhandle,-1}) end while return result else return -1 end if end function Such a method allows us to write programs that handle I/O *fast*, which as to speed, in one of the few bottlenecks of Euphoria currently. Ralf