The tag has no wiki summary.

learn more… | top users | synonyms

3
votes
0answers
27 views

A c++ PEG parser generator

Last Weekend I wrote a c++ PEG packrat parser generator and would love to get some feedback on the code and/or syntax. I currently use the << operator for defining grammar expressions and ...
2
votes
1answer
55 views

Efficiency of Recursive Checkers Legal Move Generator

I'm implementing a checkers engine for a scientific experiment. I found out through profiling that this is one of the functions that takes up a lot of time. I'm not looking for an in-depth analysis, ...
0
votes
0answers
85 views

Array Creation Inspired by Python's List Comprehension

I challenged myself to develop something functionally similar to Python's list-comprehension. Below is what I came up with. Obviously, Javascript doesn't have the elegant syntax, so ll = [x for x in ...
2
votes
0answers
148 views

Is there better way to read from a file and connect all data in one big data than to use generators?

Is there better way to read from a file and connect all data in one big data than to use generators? At the moment, I do the following: use generators to read data from files. use numpy to pack all ...
1
vote
1answer
68 views

Discrete random variable generator

There is my SSCCE to generate a value of discrete random variable. values is set of value the RV can take and procents is equivalent to discrete pdf. Can you anticipate any issue with this snippet? ...
-2
votes
1answer
28 views

I just began developing an extension/mod Generator for the Facebook Plugin - Like Box [closed]

Here is the link to the current version of the "Custom Likebox/Facepile for Facebook" Generator: Custom Likebox/Facepile for Facebook Input is greatly appreciated. I've used many a ...
0
votes
1answer
96 views

What is wrong with this number generator? [closed]

First, generate four million pseudo-random numbers using a specific form of what is known as a "Lagged Fibonacci Generator": For 1 <= k <= 55, s_k = [100003 - 200003k + 300007k^3] (modulo ...
3
votes
0answers
129 views

Iterator and Generator version of python range function

I have created iterator and generator version of python range function Here is Generator version: def irange(*args): if len(args) > 3: raise TypeError('irange() expected at most 3 ...
2
votes
1answer
189 views

Objective-C CF Random Name Generator

Based on a python name generator grammar I found here I've decided to write my own in objective-C. The idea is I can load the grammar from a plist file and generate random names from it. I'm looking ...
2
votes
3answers
151 views

Need advice regarding Style and Flow in C++ (Simple randomization program)

I come here humbly asking for advice from those with more experience than I. I believe this is a novice question but I hope it is useful to others. I'm a few months into learning C++ programming and I ...
3
votes
2answers
208 views

Text parser implemented as a generator

I often need to parse tab-separated text (usually from a huge file) into records. I wrote a generator to do that for me; is there anything that could be improved in it, in terms of performance, ...
1
vote
2answers
122 views

Can this python generator be made more efficient?

I'm trying to get a better grasp on generators in python because I don't use them enough (I think generators are cool). To do so I wrote a generator for prime numbers: def primes(): x = 2 ...
1
vote
2answers
298 views

Random Topic Generator

I've written a python module that randomly generates a list of ideas that can be used as the premises for furthur research. For instance, it would be useful in situations where a new thesis topic is ...
2
votes
2answers
212 views

Python generator to produce lattice points on an n-simplex.

Looking for a code review, and hopefully to learn something if someone has a nicer solution. Here's what I wrote: from __future__ import division, print_function from future_builtins import * ...
6
votes
7answers
477 views

Generator expressions or yield generators?

This is a revisit to a question already asked here about a year and a half ago. While solving Project Euler's Problem 40 I wrote this: def counting_digits(): for number in count(1): for ...
1
vote
2answers
1k views

Python generator function that yields combinations of elements in a sequence sorted by subset order

In Python, itertools.combinations yields combinations of elements in a sequence sorted by lexicographical order. In the course of solving certain math problems, I found it useful to write a function, ...