MathGroup Archive 2005

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

Search the Archive

Re: simple set operations

  • To: mathgroup at
  • Subject: [mg57655] Re: simple set operations
  • From: dh <dh at>
  • Date: Fri, 3 Jun 2005 05:33:39 -0400 (EDT)
  • References: <d7mk8b$c5m$>
  • Sender: owner-wri-mathgroup at

Hi Ed,
see below.
Sincerely, Daniel

Edward Peschko wrote:
> hey all,
> I'm hesitant to ask these questions (because they are so simple) but after a 
> 15 minute search through the docs I'm getting nowhere, so here goes:
>     1) what's the easiest way to generate a list of elements? ie:
> 	'a' .. 'h' == { a,b,c,d,e,f,g,h }
I would numerate the elements. It is easier to work with numbers than 
with characters.  If you want to see the names, you can  put the names 
in a list or function "names" and get the name by names[[i]] or 
names[i]. To get the list with numbers: Range[n]
>     2) Is there a quick way to check whether an element is in a set?
> 	if ('a' == (any('a','b','c','d')) { print "a is in a,b,c,d"; }
MemeberQ will help: MemeberQ[List_of_Elements, Element ]
> The first one I see could possibly be done by 'Array', but I don't see how -
> the '#' refers to the generation of numbers, but there seems to be no 
> corresponding 'letter' symbol.
> As for #2, the easiest way would be through an overloading of the '==' operator,
> but again, that doesn't seem to work..
> Thanks much for any help,
> Ed

  • Prev by Date: Re: simple set operations
  • Next by Date: Re: simple set operations
  • Previous by thread: Re: simple set operations
  • Next by thread: Re: simple set operations