General question about operations on list of numbers

    Nov 29 2012 | 1:06 pm
    I want to get a list of numbers into my object and perform some operations on these numbers.
    Each operation will create new values.
    I am seeking a general advice: would you store each lists as an atom, convert the data to longs of doubles only for the calculations and then store the data back into atoms after each operation or would you rather convert the incoming data into regular C arrays, perform all the calculations and put the data into an atom only when you send them to the output ?
    Thank you in advance.

    • Nov 29 2012 | 7:49 pm
      Hello Nicolas,
      This is how I am doing it. Currently I am putting data into an array of long integers and then I put the outcome list in an atom just before sending it to output. What do you think about it ?
      Another source for... ...sources - especially when it comes to lists - are Peter Elsea's lobjects. But I don't understand everything. Pointers and friends are still giving me headaches. Aargl.
      void rb_mebiii_list(t_rb_mebiii *x, t_symbol *s, short ac, t_atom *av)
      	short performable ;
      	if (ac >= 6) {																				// performs if list has six items at least
      		short i;
      		for (i=0 ; i < 6; i++) {
      			if (atom_gettype(av)==A_LONG) {														// checks type (expected : long)
      				// fills array of coordinates with values from list
      				x->pointsRoughCoords[i] = atom_getlong(av);
      				if (x->pointsRoughCoords[i] >= 0 && x->pointsRoughCoords[i] output_list[0] = x->xPosition;
      			x->output_list[1] = x->yPosition;
      			x->output_list[2] = x->calibratedZPosition;
      			for (i=0; i < 3; i++) {							// transferts data into t_atom
      		else {
      			post("rb.mebiii: wrong data - cannot operate !");
      	else {
      		post("rb.mebiii: a list with %i elements is too short", ac);
    • Nov 30 2012 | 8:02 am
      Thanks a lot for your help, Nicolas.