Recursion is a method of problem solving where the solution to a problem depends on solutions to smaller instances of the same problem. In computer science a recursive function calls itself directly or indirectly.
4
votes
0answers
205 views
Non recursive lambda evaluator that “magically” optimizes tail recursion
I think pasting my main method GetTermValue plus the StackFrame class and a couple of helper methods (Return and Replace) should be all I need to keep it concise, but first a few notes about the code:
...
4
votes
0answers
80 views
Recursion for inductive process
I am self-learning R, and I am struggling with code finding stopping time (kns, ks) of an arbitrary stochastic process which can be defined as following:
Basis: k0= inf {u >=0: max_[0,u]- min_[0,u]=H ...
4
votes
0answers
352 views
How to Implement Recursive Function of sqlite3 on Android Devices
I'm trying to implement recursive function within an android app;
First, i try it (recursive function) from 'cmd' windows:
I create a table :
CREATE TABLE tree(
id_tree integer PRIMARY KEY ...
4
votes
0answers
120 views
The price of using infinite_defaultdict
This is for me a heaven sent:
>>> from collections import defaultdict
>>> infinite_defaultdict = lambda: defaultdict(infinite_defaultdict)
>>> d = infinite_defaultdict()
...
3
votes
0answers
76 views
Haskell functions not equivalent (but they are?)
I have a piece of Haskell code which capitalises words appropriately. For example, it will take "rObOT" and change it to "Robot". One function is list comprehension, the other is recursive. Both seem ...
3
votes
0answers
73 views
Why doesn't code trying to catch a StackOverflowError run?
This question extends from try-finally block prevents StackOverflowError.
If I add a catch block, why catch block codes never runs?
public static void foo() {
try {
foo();
} ...
3
votes
0answers
31 views
Pass this to recurive jquery animate function
I'm trying to make an infinite animation loop. A div needs to make a rhombus shape movement all the time. but it needs to animate "this".
I have already tried a few options that usually save me in a ...
3
votes
0answers
84 views
Avoid for-loop in recursive formula
I have the following data:
> set.seed(0)
> x <- c(1,rep(0, 15)) ; x
[1] 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> y <- rnorm(length(x)) ; y
[1] 1.262954285 -0.326233361 1.329799263 ...
3
votes
0answers
60 views
Typechecker assertion failed on recursively-typed class
Consider the following small example:
type 'r foo_t = <get : 'r bar option ; set : 'r bar option -> 'r; ..> as 'r
and 'r bar
constraint 'r = 'r foo_t
class c : object('r)
constraint 'r ...
3
votes
0answers
537 views
Perl File::Copy::Recursive fcopy doesn't create directories on UNC Paths
When i use fcopy to copy files from an UNC Path to another, it doesn't work if the target directory doesn't exist. But it does work perfectly on local path, (resulting in creating that directory)
use ...
3
votes
0answers
137 views
Why can optim() be used recursively in R
I am hoping someone can clear something up for me please. I am using optim to optimise a set of parameters to fit a model to a timeseries. The code works fine and optimises fine.
However, I recently ...
3
votes
0answers
187 views
Jenkin-List SVN Folders
So currently setting up Jenkins to automate our deployment process, I have almost done and was told by my boss to add another feature.
The feature is that the developer gets to chose a branch to ...
3
votes
0answers
396 views
Python. Recursive nesting in equation building (physical chemistry)
Do you have any experience with recursive algorithms? (I bet you do.)
I'm new to coding (1 week of every now and again coding) and I've been working on something (explanation below). I want to code ...
3
votes
0answers
1k views
Cycle MLM Matrix Recursion PHP
I am working at Matrix MLM Tree or Cycle. I made recursion functions and It's working fine.
It's not making fully pyramid like so:
It's just increasing in Left Hand not at the Right hand:
Result ...
2
votes
0answers
24 views
From a cloud function: how to call JavaScript function that is recursive?
Is this recursion coded wrong or is it just that console.log() is not always executed even if the recursion is executed?
function testrecur(s) {
console.log("begin testrecur=" + s);
...
2
votes
0answers
37 views
Call stack size exceeded after several clicks in a combobox
I'm have a combobox on a website built with Dojo and using the ArcGIS Javascript API. Since the combobox can contain thousands of entries, I'm proceeding with paging, dispatching 25 entries at a ...
2
votes
0answers
54 views
Recursion: how to try different combinations of integers 1 to 9, and (partially) reverse sequence to start over in case of error?
Language:
Java
Aim:
general: Solve a sudoku game
specific: Make a recursive method solve() that:
Checks if number conflicts with other numbers in row, column or box
Fills in integer between [1-9] ...
2
votes
0answers
41 views
Swift compiler segmentation fault with generic recursive function
I've run into an interesting issue with the Swift compiler, which seems to be caused by a very simple generic function. I've got a workaround, but I'd really like to understand what the underlying ...
2
votes
0answers
82 views
ORMLite one to many foreign object is fetched with foreignAutoRefresh = false
I have one to many relationship in local database. I am using ORMLite technology and my foreign object for one part is configured with foreignAutoRefresh = false.
@DatabaseTable(tableName = "Person")
...
2
votes
0answers
37 views
Getting recursive information with Doctrine, in Symfony2
I have 3 Entities in doctrine:
Listitem:
class Listitem
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue()
*/
protected $id;
...
}
Item:
class Item
{
/**
* @ORM\Id
* ...
2
votes
0answers
54 views
Java serialization and recursion
The backstory:
I have a Location class for room objects. It contains an ArrayList for exits.
I have an Exit class for exits from locations, which store the direction of the exit and where it leads ...
2
votes
0answers
26 views
Boost serialization with recursion
I have a heavily recursive class hierarchy at runtime that I want to serialize. Something like:
Ware -> Warehouse goal -> [Workers on the Way] -> Current Road -> Current Worker -> Current carried ...
2
votes
0answers
33 views
Build tree from flat QStandardItemModel
i have problem with QStandardItemModel. I want to get values from one model (id, name, parent) and build tree in another model.
First i'm getting all childrens of any parent to ...
2
votes
0answers
70 views
Implementing Rosseta Code FFT into VBA Excel
I attempted to implement the FFT Rosetta Code into VBA excel. I was unable to reconstruct the same output data exactly as written in the Rosetta Code. At first I thought it was type conversion ...
2
votes
0answers
64 views
Mongoose, recursive population of hierarchy
I have quite a large dataset where every Item has a hierarchy field with a children attribute which is an array of references to other Items. I want to get all top parent Items and populate the ...
2
votes
0answers
40 views
How do rule-based systems deal with recursion?
I am just beginning to learn about rule-based systems, and am having trouble understanding how they can handle recursion.
Some quick background. I have studied a little programming language theory ...
2
votes
0answers
52 views
In a PEG, process the input twice
Background
I'm using PEG.js online.
I have a PEG that takes a function (only math assignments and expressions are valid) and returns a literal math exppression equivalent, like 3+2*5.
Example input ...
2
votes
0answers
23 views
Generative Recursion vs. Corecursion
Wikipedia's discussion of recursion indicates that generatively recursive functions "can often be interpreted as corecursive functions" (emphasis mine) while Wikipedia's discussion of corecursion ...
2
votes
0answers
32 views
PHP Recursive Descent Recognizer no output with valid input
Ok I have a PHP RDR for the language:
EXP ::= EXP + TERM | EXP - TERM | TERM
TERM ::= TERM * FACTOR | TERM / FACTOR | FACTOR
FACTOR ::= ( EXP ) | DIGIT
DIGIT ::= 0 | 1 | 2 | 3
That should be ...
2
votes
0answers
94 views
Recursive Merge Sort on linked lists in python
i would like to ask you for help with this project i am working on where i have to write recursive merge sort function that will work on linked lists.this is what i have so far(i didnt put whole code ...
2
votes
0answers
84 views
7zip Extraction and Delete Fail on only one of many files
I tried using PHP to run 7zip to recursively extract all the zip files that a user had put inside other zip files and then delete the original zip.
The code I used worked except for a larger file ...
2
votes
0answers
49 views
Get Nested Level from Recursive Menu
I was looking at implementing the recursive function from this SO item: PHP: nested menu with a recursive function, expand only some nodes (not all the tree) to build a right click menu on my ...
2
votes
0answers
48 views
Segmentation fault implementing Red Black tree
this is my first question on Stack Overflow!
I have to implement a Red Black tree but for some reason I am getting a segmentation fault when running the code. I've been through it a thousand times ...
2
votes
0answers
36 views
Efficient Tree Traversal for simple search
I am using a MIB parser I have written using PHP for a SNMP web interface project I am building.
The node object is in the flowing structure:
class MibNode
{
public $name;
public $oid;
...
2
votes
0answers
92 views
recursive variadic template function code bloat
I had a look at the dump files from gcc to see how the compiler deals with recursive variadic template functions.
With this test code,
#include <cstdio>
#include <cstdarg>
using ...
2
votes
0answers
125 views
How can I get subdomain users that are members of group in main domain. Java
My goal is recursive getting all group members from domain and subdomains using only connection to main dc.
I have Active Directory forest containing domain.com, sub.domain.com.
My 'MainGroup' located ...
2
votes
0answers
43 views
AVL tree in java
The program that I am writing simulates a road charging system which reads several lines of inputs, each one representing a different command until I reach the EOF (\n).
This commands simulate a road ...
2
votes
0answers
62 views
c++ recursive return function Without return
In the following code, I wrote a function recursively which should return a value, and really when two numbers are equal it returns, in the function I did not use the return and she is still working, ...
2
votes
0answers
28 views
Create/update nested array from a single array
I'm trying to create a very specific data structure with simple arrays but have got into some issues that I have troubles solving.
I have an empty array and one that I want to build the empty array ...
2
votes
0answers
49 views
Issue when trying to recursively open sub-directories in C
I'm working on an assignment that will list the directories in the current directory (.) and will recursively open sub-directories and print out their file contents.
I'm having this weird issue, ...
2
votes
0answers
174 views
recursive method finding number of paths in a matrix
i have wrote a method that calculates number of paths from a given cell in a 2-dimension array, to a given destination cell, but for some reason it returns an incorrect answer, any thoughts?
...
2
votes
0answers
104 views
Recursive algorithm
I need help with this exercise:
Give the pseudo-code that receives in input an integer n and prints the all possible matrices nxn where the a are above b and b are above c.
For example with n=2: (the ...
2
votes
0answers
32 views
Recursion involving tree with many branches and all branches need to be stored
I want to store all the result which are basically 8 points generated after every time function
GenTestPoint is called.
Can you suggest me how to store all the points generated i.e 4096+512+64+8 ...
2
votes
0answers
39 views
Libraries Not Copying Correctly
I have a recursive set of methods for copying a large fileshare to a new destination and, while copying, keeps track of how many items are in the destination folders it creates to break up the source ...
2
votes
0answers
45 views
Efficient retrieval of structural information for nested lists
Actual question
Is there any way I could use or build on top of rapply() to derive the same kind of structural information for arbitrarily structured lists that I get via the following function.
...
2
votes
0answers
146 views
Rails: avoid recursive destroy callbacks
I have two models:
class Car < ActiveRecord::Base
has_many :adverts, :dependent => :destroy
end
class Advert < ActiveRecord::Base
belongs_to :car
# Destroy the car, if there is no ...
2
votes
0answers
32 views
I cannot print the output correctly using recursion
I am new to networking. I need to design a network with the following topology:
The network consists of a number of N hops where each hop is directly connected to the next hop.
The objective is to ...
2
votes
0answers
67 views
Filling an M x N rectangle with squares with sides of lengths 2^K, 2^(K - 1), …, 4, 2, 1
We are given an M x N rectangle and asked to fill it with squares with sides of lengths 2^K, 2^(K - 1), ..., 4, 2, 1. We first fill with 2^K (as much as we can), then with 2^(K - 1), and so on. How ...
2
votes
0answers
152 views
Recursive list.files for FTP-Server
is there a ftp-version of list.files(path, recursive=TRUE)?
I want to get all the URL's of the ZIP-Archieves in subdirectories on this FTP-Server
url <- ...
2
votes
0answers
78 views
Recursion in Python vs. JavaScript
I'm trying to write a recursive function in JavaScript. I can write it in Python with the following code:
import copy
kamers1 = [[0,0],[0]]
lijst = ['a','b','c']
uitkomst = []
def fill(kamers, ...