Equivalent Tao solutions for some problems from comp.lang.python

0 views
Skip to first unread message

Limin Fu

unread,
May 9, 2005, 10:29:03 AM5/9/05
to taos...@googlegroups.com
Hi!

This thread will contain equivalent solutions in Tao language for some
interesting problems I found in comp.lang.python.

Anybody are welcome to add something to this thread, so that people
used Python can get a quick impression about Tao just by reading this
thread.

Creation of similar threads for other languages are also appreciated.

Please include a title of the problem and a link where it can be found
in the groups or forums of other languages.

Cheers,

Limin

Limin Fu

unread,
May 9, 2005, 10:36:58 AM5/9/05
to taos...@googlegroups.com
The first one:

[PROBLEM]
replace string patern with different value
By aji...@gmail.com,
http://groups-beta.google.com/group/comp.lang.python/browse_frm/thread/a91c37729bf900eb/dd8049fb16bb6835#dd8049fb16bb6835

> I would like to replace string with different values,
> For example :
> source = 'kode1 bla bla kode1 bla kode1'
> I have a list with each member will replace each of kode1.
> L = [11,22,33]
> So the new source will become:
> newsource = '11 bla bla 22 bla 33'

[Tao solution]

source = "kode1 bla bla kode1 bla kode1";
L=[11,22,33];

i=-1;
repeat( source=~s/kode1/""+L[i++]/ );

Limin
Reply all
Reply to author
Forward
0 new messages