Enhancement request

Started by newdep, August 19, 2005, 05:02:02 AM

Previous topic - Next topic

newdep

Hi Lutz,



below a listing of small (big impact) enhancements, propably not all usefull.

and most of them are solvable with functions and mapping but perhpas the Push/Pop and random request are more instresting?





enhanced for  'CONS with ....(exp-N)

syntax: (cons exp-1 exp-2 ....exp-N)





enhancement for PUSH/POP to work with implicit Indexing (not so easy i think)

syntax: (push (a 0) (x 0 1) -1)





enhanced for difference, intersect and unique with (..list-N)

syntax: (difference (1 2 3 4 5 6 7 8) (4 3 2 1) (9 6))





enhancement for MATCH with 'intelligent matching

syntax: (match '(a ? b c * j) '( a b c d e f g h i j))





enhance for MATCH with (..list-N)

syntax: (match '(1 2 3 *) '(1 2 3 4 ?) '(1 2 3 4 5))





enhance RAND to be working on string or list directly

syntax: (rand "1234567890" 1) -> "0192837465"

syntax: (rand '( (a b) (x z) (c d) (e f) ) 1 ) -> ( (e f) (c d) (a b) (x z) )





Regards, Norman.
-- (define? (Cornflakes))

newdep

#1
And if possible ;-) for CTRL-D to be working in the windows console



There some linux windows users here that get confused by

their finger handling when switching between linux and window ;-)
-- (define? (Cornflakes))

Lutz

#2
- Ctrl-D: how? fgets() on Liunux/UNIX/OSX will return on Ctrl-D but Win32 will not. Special keyboard handling in that section for Win32 would be too much code for such a small feature. Use Ctrl-C on Windows or show me a simple way to do it.



- cons: cannot you not use 'list' for that purpose?



- push/pop: impossible to do, do a: (push (a 0) x 0 1 -1) instead. push/pop can gtake multiple indices so can set-nth and set-nth.



- difference: not sure of I understand, can you not just do: (difference (1 2 3 4 5 6 7 8) (append (4 3 2 1) (9 6))) instead?



- match enhancement: do not understand, it does it already: (match '(a ? c * j) '( a b c d e f g h i j)) => (b (d e f g h i)) returning list of matches.



- match multiple: I like the idea, but just specifying several lists would not be what one would want most of the time. Putting all lists into a list would be more useful but change the functionality ... perhaps an additional parameter to make it work in list-mode, then it would take the list as a list of lists?



- random permuations: I like that one too, lets call it 'shuffle', it would take a list or string and rearrange the sequence of lements or characters in a random fashion, really useful.



Lutz

newdep

#3
The 'difference indeed use currently with append but i thought a C solution could be quicker..



The Push/Pop , yes im using the set-nth for it ;-) But in my program i was

so into the multiple indices that I simple expected it to work..but its fine this way.



The match.. well your output give on my screen a 'nil.. Ill try that again...



And for the match multiple, well  i'm not sure what most of the tim eis used be i needed this function for a match on several nested lists.. I worked around it . But surly my code would lots more elegant with this enhancement...(suit yourself ;-)



Well and for the Random permutaion..hop eyou can implement it ;-)

Yes a Shuffle or a Huzzle would be nice...perhpas even with a nested

lists shuffle * shuffle..?



And for the ctrl-d... aaaaaa just forget it ;-) Im a *nix user anyway ;-)





Regards, Norman.



PS: Thanks for the 8.6.2 !!!!!! GREAT enhancement for difference and intersect!!! Needed that badly ;-)
-- (define? (Cornflakes))