Re: Appending an element to a list
- To: mathgroup at smc.vnet.net
- Subject: [mg23939] Re: Appending an element to a list
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Fri, 16 Jun 2000 00:57:24 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <8i9nta$27l@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, the good old If[] is not working any more ? If[d=!={}, AppendTo[list,d] ] your ReplaceAll AppendTo[list,d] /. {}-> Sequence[] is broken too ? The pattern matcher don't work with myAppend[lst_, {}] := lst myAppend[lst_, ll_] := Append[lst, ll] lst=myAppend[lst,d] Than I have no idea Regards Jens Felix Farkas wrote: > > Hello, > i do have a problem, which is probably very easy, but i couldn't find > a reasonable way to solve it. I would appreciate very much any hint. > > I have a list of lists. My purpose is to append a new elements to this > list. These elements are generated by some function. Sometimes the > output of the function is an empty list meaning no element. In this > situation Append includes the new element in the list. i would like to > avoid this behaviour. > > ex: > > In[1]:= d={} > Out[1]= {} > > In[2]:= Append[{{2,2},{3,3}},d] > Out[2]:= {{2,2},{3,3},{}} > > Thanks in advance. Felix Farkas