Tcl Source Code

Artifact [af2f9a7cd3]
Login

Artifact af2f9a7cd3c91927555186d47d2f24771608170d:

Ticket change [af2f9a7cd3] - New ticket [0d2bcd9544] "lgroup" to regroup a list. by anonymous 2014-01-12 00:21:31.
D 2014-01-12T00:21:31.315
J assignee nobody
J closer nobody
J cmimetype text/plain
J comment ~\sPrototype\r\n\r\nlgroup\slistIn\slengthOfSublist\s?stepForward?\r\n\r\nstepForward\sdefaults\sto\s$lengthOfSublist\r\n\r\n~\sExample\r\n\r\nset\sl\s{a\sb\sc\sd\se\sf\sg\sh}\r\nlgroup\s$l\s4\s#\s{a\sb\sc\sd}\s{e\sf\sg\sh}\r\nlgroup\s$l\s3\s#\s{a\sb\sc}\s{d\se\sf}\s{g\sh}\r\nlgroup\s$l\s1\s#\sa\sb\sc\sd\se\sf\sg\sh\r\nlgroup\s$l\s-1\s#\serror\r\nlgroup\s$l\s3\s2\s#\s{a\sb\sc}\s{c\sd\se}\s{e\sf\sg}\s{g\sh}\r\nlgroup\s$l\s2\s3\s#\s{a\sb}\s{d\se}\s{g\sh}\r\n\r\n~\sUsefulness\r\n\r\nThis\scan\sbe\sused\sto\srearrange\sresults\sreturned\sby\sSQLite3.\r\n\r\n~\sIncomplete\simplementation\r\n\r\nSince\sI\sjust\suse\sit\sto\sprocess\swhat\sSQLite3\sreturns,\sI\shave\signored\sthe\s"stepForward".\sI\sthink\srewrite\sit\sin\sC\swill\sspeed\sit\sup.\sI\sdidn't\scheck\swhether\s$lengthOfSublist\sequals\sto\szero.\r\n\r\nproc\slgroup\s{listIn\slengthOfSublist}\s{\r\n\tset\si\s0\r\n\tforeach\sit\s$listIn\s{\r\n\t\tlappend\stmp\s$it\r\n\t\tif\s{[llength\s$tmp]\s==\s$lengthOfSublist}\s{\r\n\t\t\tlappend\sresult\s$tmp\r\n\t\t\tset\stmp\s{}\r\n\t\t}\r\n\t\tincr\si\r\n\t}\r\n\tif\s{[expr\s[llength\s$listIn]\s%\s$lengthOfSublist]\s!=\s0}\s{\r\n\t\tlappend\sresult\s$tmp\r\n\t}\r\n\treturn\s$result\r\n}
J is_private 0
J login anonymous
J priority 5\sMedium
J private_contact c1589a2fa4fc7951c4aba10439d3b95af55c3a63
J resolution None
J severity Minor
J status Open
J submitter anonymous
J subsystem -\sNew\sBuiltin\sCommands
J title "lgroup"\sto\sregroup\sa\slist
J type RFE
K 0d2bcd9544735adea2d2c3aabd5f0d1e222cb4fc
U anonymous
Z 53d909a63996a6810263c3f967050c8e