Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Implementing a array assignment for custom data structure

  • To: mathgroup at smc.vnet.net
  • Subject: [mg88874] Implementing a array assignment for custom data structure
  • From: Salvatore Mangano <smangano at into-technology.com>
  • Date: Tue, 20 May 2008 02:25:41 -0400 (EDT)

Lists support a convenient syntax for element assignment:

a[[i]]=v  

Of course this syntax is syntactic sugar for:

Set[Part[a, i], v]


SparseArray's have a different structure than lists but still support the same syntax.

This leads me to believe that I should be able to implement a custom type (akin to SparseArray) that also allows this syntax (possibly using UpValues) but for the life of me I can't see how to accomplish this.

Any ideas?


  • Prev by Date: Re: Filtering a list of list for certain elements that
  • Next by Date: Re: Framed[3, FrameStyle -> None] fails
  • Previous by thread: Re: Filtering a list of list for certain elements that
  • Next by thread: Re: Implementing a array assignment for custom data structure