AnsweredAssumed Answered

vrf Create combinations from a test string - recursion

Question asked by VRFuser on Apr 2, 2004
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"><TITLE>Re: [vrf] Create combinations from a test string</TITLE><META content="MSHTML 6.00.2800.1276" name=GENERATOR><STYLE></STYLE></HEAD><BODY bgColor=#ffffff><DIV><FONT face=Arial color=#0000ff size=2><SPAN class=671210419-02042004>That could be complicated.  The basic Idea is to stack the variables you need to keep when you enter the function and unstack them when you exit the function.  That is simple to do when you deal with a function, which is not our case.  The emulation I suggested is good for when you don't need to save your variables.  I guess after spending some time, it could be done.</SPAN></FONT></DIV><DIV><FONT face=Arial color=#0000ff size=2><SPAN class=671210419-02042004></SPAN></FONT> </DIV><DIV><FONT face=Arial color=#0000ff size=2><SPAN class=671210419-02042004>VBScript seems a good idea...</SPAN></FONT></DIV><BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">  <DIV><FONT face="Times New Roman" size=2>-----Message   d'origine-----<BR><B>De:</B> Andrew Fudge   []<BR><B>Date:</B> 2 avril 2004   11:20<BR><BR></FONT></DIV>  <DIV><FONT face=Arial size=2>Hello Bruno</FONT></DIV>  <DIV><FONT face=Arial size=2></FONT> </DIV>  <DIV><FONT face=Arial size=2>Your example is interesting.</FONT></DIV>  <DIV><FONT face=Arial size=2></FONT> </DIV>  <DIV><FONT face=Arial size=2>I have no time to play with this today.  I   gave it a little thought (10 mins) and could not see how the implementation of   the attached vb code could be converted/emulated in VEE without getting   complicated.  How much thought needs to go into the mechanism to work   well?  VEE would have to store a kind of stack where each branch status   is stored so that the function would know what part of the tree was next and   so on.</FONT></DIV>  <DIV><FONT face=Arial size=2></FONT> </DIV>  <DIV><FONT face=Arial size=2>Our requirement was to list all sub folders   and/or files in a specified base folder.  If you enjoy playing with this   stuff if you can see if this requirement can be implemented in VEE, just out   of interest.</FONT></DIV>  <DIV><FONT face=Arial size=2></FONT> </DIV>  <DIV><FONT face=Arial size=2>The 2 attached VB Class files contain code to   list sub folders and files.  If you know VB then it's easy to   understand.  You can view them in a text editor.  The main   function is called "ListSubFoldersAndFiles" which returns a string   array.</FONT></DIV>  <DIV><FONT face=Arial size=2></FONT> </DIV>  <DIV><FONT face=Arial size=2>I suppose VBScripts could handle this.  I'll   try it sometime.</FONT></DIV>  <DIV><FONT face=Arial size=2></FONT> </DIV>  <BLOCKQUOTE   style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">    <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>    <DIV     style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>     <A     href="">Beliveau, Bruno</A> </DIV>    <DIV style="FONT: 10pt arial"><B>To:</B> <A     href="">VRF</A> </DIV>    <DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, April 02, 2004 3:29     PM</DIV>    <DIV style="FONT: 10pt arial"><B>Subject:</B> [vrf] Re: Create combinations     from a test string</DIV>    <DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT     face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial     size=2></FONT><BR></DIV>    <P><FONT size=2>If recursion is what you need, you can do it another way,     and supported by vee...</FONT> </P>    <P><FONT size=2>-----Message d'origine-----</FONT> <BR><FONT size=2>De:     Andrew Fudge [<A     href=""></A>]</FONT>     <BR><FONT size=2>Date: 2 avril 2004 06:01</FONT> </P>    <P><FONT size=2>I'll second that!  (Recursion)</FONT> </P>    <P><FONT size=2>Recursion is hardly ever needed, but when it is, it's ****     useful.  To make</FONT> <BR><FONT size=2>a work-around because of no     recursion can get very messy/complicated.</FONT> <BR><FONT size=2>Recursion     is clean and neat.</FONT> </P>    <P><FONT size=2>I needed to check the size of each sub folder in a folder     once.  I needed to</FONT> <BR><FONT size=2>use a VB DLL to do this     using recursion.  P.I.T.A.</FONT> </P>    <P><FONT size=2>AI and decision trees,  How would VEE cope with these     requirements without</FONT> <BR><FONT size=2>being overly complicated and     messy.</FONT> </P>    <P><FONT size=2>Also the need for callback functions.  It would be nice     to be able to pass</FONT> <BR><FONT size=2>an address of a function to an     API SetWindowsHook kind of function.  The</FONT> <BR><FONT     size=2>BrowseForFolderEx API call needed this to set the initial     folder.  Again I</FONT> <BR><FONT size=2>had to do this in a VB     DLL.  I know that .NET would probably handle this</FONT> <BR><FONT     size=2>BrowseForFolder ok, but what about other callback function     requirements..</FONT> </P><BR>    <P><FONT size=2>----- Original Message ----- </FONT><BR><FONT size=2>From:     |Dave.Watling@Zarlink.Com></FONT> <BR><FONT size=2>Sent: Friday, April     02, 2004 11:16 AM</FONT> </P>    <P><FONT size=2>> I knew this would come up at some point.  The     easiest method of creating</FONT> <BR><FONT size=2>> combinations is by     using a recursive function.  However, Vee cannot</FONT> <BR><FONT     size=2>> perform recursion.  Also, the 'Quicksort' method of sorting     data also</FONT> <BR><FONT size=2>> requires recursion.  Please     could Agilent make note of this, since when</FONT> <BR><FONT size=2>> I     first brought this up about five years ago, I was asked by Agilent</FONT>     <BR><FONT size=2>> "Why would you want recursion?".</FONT> <BR><FONT     size=2>> You have your answer now, Agilent!</FONT> <BR><FONT size=2>>     (by the way, I am told that LabView does perform recursion - can     anyone</FONT> <BR><FONT size=2>> confirm this?)</FONT> <BR><FONT     size=2>></FONT> <BR><FONT size=2>></FONT> <BR><FONT size=2>-----     Original Message ----- </FONT><BR><FONT size=2>> From: "KOHLER,ADAM     |></FONT> <BR><FONT size=2>> Date:     02-Apr-2004 10:49 AM</FONT> <BR><FONT size=2>></FONT> <BR><FONT     size=2>> I need to be able to generate all the combinations from this     text string</FONT> <BR><FONT size=2>> example</FONT> <BR><FONT     size=2>></FONT> <BR><FONT size=2>>     PDIF|PSUM|LOFF|LDIF|OFF,TRACE1|TRACE2,[TRACE1]|[TRACE2],[-6.0]</FONT>     <BR><FONT size=2>></FONT> <BR><FONT size=2>> The output is four values     comma separated as a text string.  This example</FONT> <BR><FONT     size=2>> should generate the text string array.</FONT> <BR><FONT     size=2>> The code needs to be able to cope with more values and detect     how many</FONT> <BR><FONT size=2>> variations there are in each part of     the string.</FONT> <BR><FONT size=2>></FONT> <BR><FONT size=2>> Does     anyone have any ideas how to do this?</FONT> <BR><FONT size=2>></FONT>     <BR><FONT size=2>> PDIF,TRACE1,[TRACE1],[-6.0]</FONT> <BR><FONT     size=2>> PSUM,TRACE1,[TRACE1],[-6.0]</FONT> <BR><FONT size=2>>     LOFF,TRACE1,[TRACE1],[-6.0]</FONT> <BR><FONT size=2>>     LDIF,TRACE1,[TRACE1],[-6.0]</FONT> <BR><FONT size=2>>     OFF,TRACE1,[TRACE1],[-6.0]</FONT> <BR><FONT size=2>>     PDIF,TRACE2,[TRACE1],[-6.0]</FONT> <BR><FONT size=2>>     PSUM,TRACE2,[TRACE1],[-6.0]</FONT> <BR><FONT size=2>>     LOFF,TRACE2,[TRACE1],[-6.0]</FONT> <BR><FONT size=2>>     LDIF,TRACE2,[TRACE1],[-6.0]</FONT> <BR><FONT size=2>>     OFF,TRACE2,[TRACE1],[-6.0]</FONT> <BR><FONT size=2>>     PDIF,TRACE3,[TRACE1],[-6.0]</FONT> <BR><FONT size=2>>     PSUM,TRACE3,[TRACE1],[-6.0]</FONT> <BR><FONT size=2>>     LOFF,TRACE3,[TRACE1],[-6.0]</FONT> <BR><FONT size=2>>     LDIF,TRACE3,[TRACE1],[-6.0]</FONT> <BR><FONT size=2>>     OFF,TRACE3,[TRACE1],[-6.0]</FONT> <BR><FONT size=2>>     PDIF,TRACE1,[TRACE2],[-6.0]</FONT> <BR><FONT size=2>>     PSUM,TRACE1,[TRACE2],[-6.0]</FONT> <BR><FONT size=2>>     LOFF,TRACE1,[TRACE2],[-6.0]</FONT> <BR><FONT size=2>>     LDIF,TRACE1,[TRACE2],[-6.0]</FONT> <BR><FONT size=2>>     OFF,TRACE1,[TRACE2],[-6.0]</FONT> <BR><FONT size=2>>     PDIF,TRACE2,[TRACE2],[-6.0]</FONT> <BR><FONT size=2>>     PSUM,TRACE2,[TRACE2],[-6.0]</FONT> <BR><FONT size=2>>     LOFF,TRACE2,[TRACE2],[-6.0]</FONT> <BR><FONT size=2>>     LDIF,TRACE2,[TRACE2],[-6.0]</FONT> <BR><FONT size=2>>     OFF,TRACE2,[TRACE2],[-6.0]</FONT> </P>    <P><FONT face=Arial color=#000000 size=2></FONT>    <P></P><FONT size=2></FONT>    <HR>  </BLOCKQUOTE></BLOCKQUOTE>---<BR>You are currently subscribed to vrf as:<BR>To subscribe send a blank email to "".<BR>To unsubscribe send a blank email to "".<BR>To send messages to this mailing list,  email "".  <BR>If you need help with the mailing list send a message to "".</BODY></HTML>