Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1992

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Functional solution to union of intervals

  • To: MathGroup at
  • Subject: Re: Functional solution to union of intervals
  • From: fateman at (Richard Fateman)
  • Date: Fri, 5 Jun 92 14:58:57 PDT

I think this works, and it seems to me to be far simpler to
understand.  If Lists in Mathematica were implemented as linked
lists, instead of fixed-length arrays which have to be copied
over at every Prepend, it would probably be quite fast.

(* Take a list of intervals of the form {{low1, high1} ...{lown,highn}}
   and return a list of maximal intervals *)


mi1[new:{low_,hi_},old:{{l_,h_},___} ]:=
         If [(l<=low<=h || l<=hi<=h || low< l<hi || low <h <hi), 

(* I think the test can be simplified to omit several of the
conditions... *)


  • Prev by Date: maybe better union of intervals
  • Next by Date: Re: Polygons
  • Previous by thread: Functional solution to union of intervals
  • Next by thread: Quaternions etc.