Re: sleepless night & UFOs
- Posted by Lucius Hilley III <lhilley at CDC.NET> Apr 19, 1999
- 491 views
Hello Jiri; Is this what you are looking for? function remap(sequence s, sequence in, atom value) return (s * 0) + value end function Happily, Lucius L. Hilley III http://www.cdc.net/~lhilley A happy member of the webring ICQ# 9638898 AIM Screen Name: LLH III On Tue, 20 Apr 1999 10:32:40 +1200, Jiri Babor <J.Babor at GNS.CRI.NZ> wrote: >Sorry, Guys, > >I know I should not even be here, I am supposed to be chasing >international driving licences or packing, but I hope somebody will >help me get over a nasty mental block. I need a fast function to >change an arbitrary element of a sequence: > > s = remap( s, { i1, i2, ...., iN }, newvalue) > >In other words: > > s[i1][i2]...[iN] = newvalue > >where s is a nested sequence of an arbitrary depth, and i1, ..., iN >are indexes of the element to be assigned the newvalue. I think it is >possible, in fact I think I once devised a recursive formula to do >exactly that for a version of my menus, but I just cannot find it. So, >please, I already had one sleepless night! > > >[Side note to Robert] >Since we already have a 'nan' (not-a-number) quantity, can we have a >similar, possibly even more useful 'thing' for general objects? >Something like 'null', or 'NULL' or 'Null' in some hated environments, >or 'None' in Python. 'nao' would be ok with me, but my personal >preference is for 'ufo' (undefined-f...-object). > >Just one other thing: Ralf, your 'each' construct is an excellent >idea. I also think, given plenty of time, even Gabriel will eventually >like it. (Sorry, Gabriel, *any* sign of conservatism brings out the >worst in me!) jiri