Hi,
I have a model which includes NODES, and RELATIONSHIPS (that tie the nodes together, via a parent_node, child_node arrangement).
Q1 - Is there any way in EF / Linq-to-entities to perform a query on nodes (e.g. context.Nodes..) to find say "all parents" or "or children" in the graph?
Q2 - If there's not in Linq-to-entities, is th...
[<ReflectedDefinition>]
let rec x = (fun() -> x + "abc") ()
The sample code with the recursive value above produces the following F# compiler error:
error FS0432: [<ReflectedDefinition>] terms cannot contain uses of the prefix splice operator '%'
I can't see any slicing operator usage in the code above, looks like a bug... :)
Lo...
I've got an assignment I can't figure out, any pointers will be much appreciated, it goes like so:
There's a series of light bulbs represented as an array of true/false, there's a switch for every light bulb, by clicking it for any light bulb, you toggle it as well as 2 adjacent ones (1 from left & another 1 from right; if clicked switc...
Right now I have
private static void iterateall(BinaryTree foo) {
if(foo!= null){
System.out.println(foo.node);
iterateall(foo.left);
iterateall(foo.right);
}
}
Can you change it to Iteration instead of a recursion?
...
I'm having quite a hard time figuring out what's going wrong here:
class iterate():
def __init__(self):
self.length=1
def iterated(self, n):
if n==1:
return self.length
elif n%2==0:
self.length+=1
self.iterated(n/2)
elif n!=1:
self.length+=1
...
I am trying to write a simple sieve function to calculate prime numbers in clojure. I've seen this question about writing an efficient sieve function, but I am not to that point yet. Right now I am just trying to write a very simple (and slow) sieve. Here is what I have come up with:
(defn sieve [potentials primes]
(if-let [p (firs...
I have to find recursively if there is any repeated element in an integer array v.
The method must have the following signature:
boolean hasRepeatedElements(int[] v)
I can't see any way of doing that recursively without having to define another method or at least another overload to this method (one that takes for example the element...
I was transferring several thousand files each ~1MB via scp and my connection was broken after the first 2k files or so. I wanted to know if there was a way to resume the recursive transfer w/o starting over. Something like
$ scp -r [email protected]:/datafiles/ ./
... Happy Transfer ...
... BREAK! ...
$ rsync -P [email protected]:/datafile...
Im using Java to create a maze of specified "rows" and "columns" over each other to look like a grid.
I plan to use a depth-first recursive method to "open the doors" between the rooms
(the box created by the rows and columns).
I need help writing a openDoor method that will break the link between rooms.
...
Hi everybody,
I want to create a function that returns the full path from a set node, back to the root value. I tried to make a recursive function, but ran out of luck totally. What would be an appropriate way to do this? I assume that a recursive function is the only way?
Here's the array:
Array
(
[0] => Array
(
...
I am defining a stream in terms of itself (a recursive definition). When trying to access the second element of the stream, StackOverflowError is thrown. The code from scala console:
scala> val s1 = Stream.iterate(1)(identity _)
s1: scala.collection.immutable.Stream[Int] = Stream(1, ?)
scala> lazy val s2 : Stream[Int]= Stream.cons(1, (...
I'm trying to get a better grasp of assembly, and I am a little confused about how to recursively call functions when I have to deal with registers, popping/pushing, etc.
I am embedding x86 assembly in C++. Here I am trying to make a method which given an array of integers will build a linked list containing these integers in the order...
Is the following allowed?
typedef Foo<Bar> Bar;
My compiler complains that 'class Bar' has a previous declaration as 'class Bar'.
...
hello i need program which returns sum of all even number <= to given n number
for example if n=even (let say 10) sum will be 2+4+6+8+10 or if n is odd (let say 13)
2+4+6+8+10+12 please help it should be recursive algorithm
i have done myself
...
So I've been trying to solve this assignment whole day, just can't get it.
The following function accepts 2 strings, the 2nd (not 1st) possibly containing *'s (asterisks).
An * is a replacement for a string (empty, 1 char or more), it can appear appear (only in s2) once, twice, more or not at all, it cannot be adjacent to another * (ab*...
I'm developing an app in Google App Engine. One of my methods is taking never completing, which makes me think it's caught in an infinite loop. I've stared at it, but can't figure it out.
Disclaimer: I'm using http://code.google.com/p/gaeunitlink text to run my tests. Perhaps it's acting oddly?
This is the problematic function:
def _t...
I am trying to search the C:\ drive for all files with a certain extension. I am using the following code which is working fine, however when it encounters an error the whole process stops rather than continuing with the scan. (running in backgroundworker, hence the invoke)
Private Sub ScanFiles(ByVal rootFolder As String, ByVal fileExt...
In my database I have a hierarchical flat table that returns data ordered by ParentID, ObjectID asc
I am having a bit of an issue getting this recursive function to work properly. I get the first Parent>Child>Child but after that I get nothing else.
Any help with this is greatly appreciated.
Here is my testing code:
$objectArr = arra...
I'm writing a module to handle dice rolling. Given x die of y sides, I'm trying to come up with a list of all potential roll combinations.
This code assumes 3 die, each with 3 sides labeled 1, 2, and 3. (I realize I'm using "magic numbers" but this is just an attempt to simplify and get the base code working.)
int[] set = { 1...
I enjoy using recursion whenever I can, it seems like a much more natural way to loop over something then actual loops. I was wondering if there is any limit to recursion in lisp? Like there is in python where it freaks out after like 1000 loops?
Could you use it for say, a game loop?
Testing it out now, simple counting recursive functi...