forced event-driven list interpolation


    Apr 24 2008 | 12:16 am
    i've got a series of two-item lists that look like this:
    45 67 49 67 52 68 52 72 52 74
    etc.
    i would like to build in interpolation for those lists. so as the new lists come in, interpolated versions of them are added. it's ok if the lists come fast and furious. the above would be changed to
    45 67 this is first event 46 67 47 67 48 67 49 67 here ends second event 50 67 51 68 52 68 here ends third event 52 69 52 70 52 71 52 72 here ends fourth event 52 73 52 74 here ends fifth event
    take note of the slower interpolation of the second list item during the third event.
    anyone got a cool solution for this?
    best
    j

    • Apr 24 2008 | 1:02 am
      Something like this might work (but I think this code is buggy, not able to check it right now):
      (defun interplists(lst) (cons (cons (car lst) (cadr lst)) (cond ((null lst) nil) ((= (car lst) (caddr lst)) (cond ((= (cadr lst) (cadddr lst)) (interplists (cdddr lst))) (t (cons (cons (car lst) (+ (cadr lst) 1)) (interplists (cddr lst))))) ) (t (cons (cons (+ (car lst) 1) (cadr lst)) (interplists (cddr lst)))) ) ) )
      [mxj maxlispj]
      :-)
      On Apr 23, 2008, at 8:16 PM, joshua goldberg wrote:
      > i've got a series of two-item lists that look like this: > > 45 67 > 49 67 > 52 68 > 52 72 > 52 74 > > etc. > > i would like to build in interpolation for those lists. so as the > new lists come in, interpolated versions of them are added. it's > ok if the lists come fast and furious. the above would be changed to > > 45 67 this is first event > 46 67 > 47 67 > 48 67 > 49 67 here ends second event > 50 67 > 51 68 > 52 68 here ends third event > 52 69 > 52 70 > 52 71 > 52 72 here ends fourth event > 52 73 > 52 74 here ends fifth event > > take note of the slower interpolation of the second list item > during the third event. > > anyone got a cool solution for this? > > best > > j >