Questions tagged [accumulate]

Accumulation refers to the process of repeatedly combining the previously calculated result with the next item, until the supply of items is exhausted.

Accumulation refers to the process of repeatedly combining the previously calculated result with the next item, until the supply of items is exhausted.

When we are interested only in the final result, it is equivalent to left folding; and if we keep the whole sequence of results progressively calculated, it is known as left scan.

319 questions
0
votes
1 answer

How to accumulate facts with same field value in drools

I've written a rule for alerting ssh event with "failed password". This rule is here: rule "Hello World" when accumulate(m:Message(eventType=="Failed password") over window:time( 59s );s:count(m);s>3) then System.out.println( "success"…
M M
  • 31
  • 7
0
votes
1 answer

Python: Numpy accumulated list not seperated by commas

Simple example: I got a list called 'mylist' and I want to accumulate the numbers inside and save them into a new list called 'mylist_accum'. import numpy mylist = [1,2,3,4,5] print mylist mylist_accum = numpy.add.accumulate(mylist) print…
k.troy2012
  • 344
  • 4
  • 21
0
votes
2 answers

How to increment a variable in parallelized bash script

so I have a bash script that forks new process in a double for-loop for each date "d": for each instance "i": do-something "d" "i" & done done And in do-something, I would like to increment a counter variable. However, since it's a…
THIS USER NEEDS HELP
  • 3,136
  • 4
  • 30
  • 55
0
votes
2 answers

In Ruby, should I use control flow to initialize an accumulator inside a loop?

Is it good practice to initialize an accumulator like this? 100.times do @accumulator = (@accumulator || 0) + 1 end Or should I just initialize it outside the loop and do: @accumulator = 0 100.times do @accumulator += 1 end
Dorsal6
  • 13
  • 2
0
votes
1 answer

json accumulate(String,String) method not found

I am trying to use JSONObject in my Servlet class using Netbeans , I imported several versions of json simple jar , but accumulate method is not there ,infact none of the json methods are there when i try to use autocomplete for methods on json…
devcodes
  • 1,038
  • 19
  • 38
0
votes
1 answer

How should an accumulator in a Python clock be handled correctly?

I'm writing a small clock object in Python that can be started, stopped and reset. I'm having difficulty knowing how to keep track of the accumulation of time correctly. Right now, the way the update procedure is written, the clock accumulates too…
d3pd
  • 7,935
  • 24
  • 76
  • 127
0
votes
1 answer

How to accumulate within a loop python

I am new to programming and I am having difficulty accumulating within a loop wrong_guesses=0 formSoFar='' game_over=False while (game_over==False and wrong_guesses
pumpkin
  • 57
  • 4
0
votes
1 answer

How to use a function in another function in python

I have to do a code where I need to create a game that gets the user to guess an equation. After the end of each guess I have to show how much of the equation the user has guessed. For example if the equation is 1+2*3+4 and the user guessed that the…
pumpkin
  • 57
  • 4
0
votes
1 answer

Accumulating multiple columns of the same type of data in R

I am a relative newcomer to R so I'm probably asking one of the easiest things here. I have 10 columns of the same type of data that I would like to accumulate under one name. The column headings are: egg_diameter1,…
JAM10100
  • 13
  • 3
0
votes
1 answer

Drools accumulate method that returns zero if no matching source fact

I am trying to implement a rule in Drools that calculates the sum of a some property of a fact. That works great using accumulate and sum. The problem is that when there are not fact that matches the criteria in the source part of the accumulate…
0
votes
1 answer

Jess Accumulate

I am having a serious trouble with the rule engine Jess. The problem that I am facing is with the Conditional Element Accumulate. I am trying to write a rule which gives me a list of words - according to some criteria - from my working memory but it…
Kadir GUNEL
  • 97
  • 1
  • 4
0
votes
1 answer

Jess defquery and accumulate CE

I am new to Jess The Rule Engine and I am having a trouble with a simple query. I have a simple java bean file and a .clp file . By using java bean file I create word objects and by using .clp I do some processes, by defining rules, on imported java…
Kadir GUNEL
  • 97
  • 1
  • 4
0
votes
2 answers

C++: Something's wrong with my accumulator

I've been running this code but I have not been able to get an accumulation of doubled figures. #include #include #include using namespace std; int main(){ vector student_marks; size_t num_students; …
coffeeFlow
  • 179
  • 1
  • 6
0
votes
2 answers

Multimap intelligent sorting by key

I have been working on this problem for sometime now. I have 3 .txt files containing some stuff to read in and arrange within a multimap, std::multimap> but if the key already exists, I increment the value and…
Chewco
  • 249
  • 2
  • 10
0
votes
1 answer

How to condition with accumulate in drools

I want to List< String > name of Control_Exam_List() << is List< String > but It had condition form $scheduleCheck. then I used "from" function but still not work. Drools Rule rule "People List" salience 5 when $scheduleCheck : Schedule( ) …
user3429028