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
0 answers

Drools Accumulate on Properties

I have inherited some Drools code and am trying to understand exactly how it is working. The code in question should go through a number of dates from two different sources, and for one source find the earliest and the other source find the…
Neil
  • 413
  • 4
  • 22
0
votes
3 answers

How do i add together values from all objects of a class in java?

I am trying to retrieve certain values from multiple objects under the same class. I have used a for each loop to iterate through each object, and would like to create an aggregated total, representing the rating and the cost of the item from the…
GracefulLemming
  • 153
  • 2
  • 10
0
votes
2 answers

Implementing "Accumulate" Function in Scheme

I've been hung on trying to implement an Accumulate function for a couple weeks, now. I have properly implemented a "Map" function, that iterates across a list and runs a function on each element. I am using this function to implement "Accumulate" …
0
votes
1 answer

Type error when using recursion accumulating lists

A dictionary is a list of pairs. The task is to take a dictionary and return a pair of lists: the keys and values. I tried to do it iterating (using recursion) over the dictionary and accumulating keys and values in two lists, but I get a type error…
angus
  • 2,305
  • 1
  • 15
  • 22
0
votes
6 answers

Do you know a custom tag to increment a value in a Django template?

One very annoying thing with strict MVC is that you can make the smallest processing in template. While it's usually a good practice, in this case it gets in the way: I make a for loop on a queryset of a lot of objects and display some…
Bite code
  • 578,959
  • 113
  • 301
  • 329
0
votes
1 answer

Drools - ClassCastException in Drools 6

I have a very simple Drools project in Eclipse that runs to completion just fine, but when I open or click on my .drl file, the following error pops up in Eclipse: An error has occurred. See error log for more details. …
Emily
  • 145
  • 2
  • 8
0
votes
1 answer

WSO2CEP : Getting previous event value from stream in siddhi query

I have been using following siddhi query to get the events count per minute; ts as timestamp (string) and ftp_requests as count (int). from FTPInStream[command == 'USER'] select time:timestampInMilliseconds(time:dateAdd(str:replaceAll(ts,'T',' '),…
aneela
  • 1,457
  • 3
  • 24
  • 45
0
votes
3 answers

How to sums up values of a different key when same value is for another key in an associative array in PHP?

Please refer following array in PHP: $array1 = array( array('location'=>'AA','time_spent'=>2), array('location'=>'BB','time_spent'=>2), array('location'=>'AA','time_spent'=>3), array('location'=>'CC','time_spent'=>2), …
Wenuka
  • 887
  • 2
  • 9
  • 25
0
votes
1 answer

Accumulate/Collect based on temporal operator

I am trying to write a rule that collects / accumulates values based on a temporal operator. rule "Zone6 Overlap" when $i1 : Instance ($e1 : event == " Vel : 20.99-23.98 km/h : " && $name1 : name) from entry-point "Stream" $i2 : Instance…
Stu
  • 67
  • 6
0
votes
1 answer

How to make accumulative count based on date in MySQL?

I have the following table "testfinal"and would like to make it look like table "testfinal1" with accumulative sum based on orderdate. testfinal +------+------------+-------+--------+----------+ | ID | Orderdate | apple | banana | quantity…
Leigh Tsai
  • 297
  • 6
  • 20
0
votes
2 answers

accumulation error

I have quite straight forward question. The following code prints out celsius and fahrenheit. My question is though about number of times it iterate. For a small number e.g. start 0, stop at 10, with a step of 1.1. After the loop is finished it will…
starzdust
  • 15
  • 2
0
votes
1 answer

vegan accumulation curve predictions

I'm having a matrix of plants(rows) and pollinators(columns) and interaction frequencies within (converted to 0 (no interaction) and 1 (interaction/s present) for this analysis). I'm using the vegan package and have produced a species accumulation…
AnkeS
  • 3
  • 3
0
votes
2 answers

vending machine program php

so I'm doing this program on php. It's a simple vending machine program, with 3 images. The logic: Accumulate their prices each click of the image in $total variable. Then, on clicking display total price, it should display the total price. Mine…
javaMan1995
  • 51
  • 1
  • 1
  • 12
0
votes
2 answers

Drools - How to accumulate facts that don't share a property with a fact in working memory

I want to create a collection of facts from a nested collection, where the facts do not share a property with another fact in working memory. Let's say I have a Person class that has a collection of Address objects. I want the set of all the Address…
Emily
  • 145
  • 2
  • 8
0
votes
1 answer

Prestashop 1.6 and multiple discounts

I'd like to cumulate discounts on my prestshop. For exemple, I have a quantity discount of 20% starts from 5 pieces bought and another discount of 25% on all products who has to be cumulated with the first one. Now, 25% is apply with less than 5…
JazZ
  • 4,469
  • 2
  • 20
  • 40