I'm trying to calculate the number of success cases within a recursive function in C#, but I'm astonished by the fact that my variable is shared between all the function calls!
[update 2]
More than strange this time. doing so
i = i + validTreesFun(tree.Nodes, newWords.ToList()) ;
resets i to 0
doing this
i = validTreesFun(tree.Nod...
This question is about the way that Scala does pattern matching and recursion with lists and the performance thereof.
If I have a function that recurses over a list and I do it with matching on a cons, for example something like:
def myFunction(xs) = xs match {
case Nil => Nil
case x :: xs => «something» myFunction(xs)
}
in Hask...
Hey. I know this is not a 'refactor my code' site but I made this little piece of code which works perfectly fine with moderately sized input but it's problematic with string of size, say, over 2000.
What it does - it takes a string of numbers as a parameter, and it returns the number of ways it can be interpreted as a string of letters...
Hi,
I would like to make a LeftOuterJoin between one table and same table,
but dont know how to make the distinguish them...
SubSonic.SqlQuery q = new Select().
From(TABLE.Schema).
LeftOuterJoin<TABLE>();
This returns me the error:
The objects "dbo.TABLE" and "dbo.TABLE" in the FROM clause have the same exposed names....
Hello everybody,
I stumbled across this problem in F#. Suppose, I want to declare two types that reference each other:
type firstType =
| T1 of secondType
//................
type secondType =
| T1 of firstType
//................
How do I do that, so the compiler does not generate an error?
...
Lets say I have a million people objects that, when evaluated using
person1.Matches(person2);
return true or false.
I want to put them into groups. These groups are made by any one person being a match with any other person in the group. So any person from one group will NOT be a match with any person from another group. Any person in...
Hello,
I'm trying to come up with a way to make the computer do some work for me. I'm using SIMD (SSE2 & SSE3) to calculate the cross product, and I was wondering if it could go any faster. Currently I have the following:
const int maskShuffleCross1 = _MM_SHUFFLE(3,0,2,1); // y z x
const int maskShuffleCross2 = _MM_SHUFFLE(3,1,0,2); //...
There is an XMLList of items, each item has three properties: prop1,
prop2, and prop3.
There are two TextAreas, t1 and t2.
t1 displays the XMLList.toString
t2 is blank
There are two buttons: Show and Clear.
When you click Show, the following should happen:
For each item in the XMLList, if prop3 is false and prop1 is "BB",
then add that ...
Trying to build a recursive html menu using c#. The html structure I need is as follows:
<ul>
<li>Office</li>
<li>Home
<ul>
<li>Beds</li>
<li>Desks</li>
</ul>
</li>
<li>Outdoor
<ul>
<li>Children
<ul>
<li>Playsets</li>
</ul>
</li>
...
I've got the following piece of code on a PHP 5.2.4 (no safe_mode) linux server:
mkdir( $path, 0777, true );
when I enter a path like:
'/path/to/create/recur/ively/'
all directories are created axcept for the last one...
when I add another directory like:
'/path/to/create/recur/ively/more/'
again, all paths are created except ...
I'm currently in a situation where I have very limited access to a server, but need to upload and download a significant amount of files contained within a single directory structure. I don't have SSH access, so I can't use SCP - and rsync isn't an option either unfortunately.
I'm currently using ncftpput, which is great but seems to b...
Hi,
I have edited my theme in Wordpress to show the 20 most recent comments to each post on the post list. Works fine and all.
However I have nested comments enabled on my WP and would like to show nesting within the 20 recent comments. That is being if a comment is a reply to another comment which is in the recent 20 comments then nes...
I am using PHP to move the contents of a images subfolder
GalleryName/images/
into another folder. After the move, I need to delete the GalleryName directory and everything else inside it.
I know that rmdir() won't work unless the directory is empty. I've spent a while trying to build a recursive function to scandir() starting fr...
I wrote the following program to prime factorize a number:
import math
def prime_factorize(x,li=[]):
until = int(math.sqrt(x))+1
for i in xrange(2,until):
if not x%i:
li.append(i)
break
else: #This else belongs to for
li.append(x)
print li #First print state...
I want to write code (using recursive function) to unnest the parentheses in a LIST in Lisp language. Example:
(unnest '(1 (2 (3)) (4 5))) ==> (1 2 3 4 5)
Thanks. Any help is appreciated!
...
I am trying to create a multi-dimensional array whose parts are determined by a string. I'm using . as the delimiter, and each part (except for the last) should be an array
ex:
config.debug.router.strictMode = true
I want the same results as if I were to type:
$arr = array('config' => array('debug' => array('router' => array('strictM...
If I have a self-referential Topic class and I want to recursively loop through all of my subtopics, what would be a good Ruby way to do that:
@category.topics.all(:parent_id => topic.id).each do |subtopic|
subtopic.delete_tags
@category.topics.all(:parent_id => subtopic.id).each do |subsubtopic|
subsubtopic.delete_tags
...
I have been learning scheme and I like to know the difference between the two. Thanks.
...
Yes, I know the wording is hard to understand, but this is something that bugs me a lot. On a recent project, I have a function that recurses, and there are a number of conditions that would cause it to stop recursing (at the moment three). Which of the situations would be optional? (I.E. best performance or easiest maintenance).
1) ...
I've got a result set from adLDAP of the form
OU=LEAF1,OU=PARENT1,OU=ROOT,DC=datacenter,DC=local
OU=PARENT1,OU=ROOT,DC=datacenter,DC=local
OU=ROOT,DC=datacenter,DC=local
OU=LEAF2,OU=CHILD,OU=PARENT2,OU=ROOT,DC=datacenter,DC=local
OU=CHILD,OU=PARENT2,OU=ROOT,DC=datacenter,DC=local
OU=PARENT2,OU=ROOT,DC=datacenter,DC=local
Where each li...