MathGroup Archive 2007

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

Search the Archive

Re: a beginner's question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg77814] Re: a beginner's question
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Sun, 17 Jun 2007 06:10:01 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <f5048j$pup$1@smc.vnet.net>

tung tran wrote:
> I am a beginner in Mathematica and in programming. I read the book "An Introduction to Programming with  Mathematica".
> Page 155:
> 
>  FindSubsequence[lis_List, subseq_List] := Module[{p}, p = Partition[lis, Length[subseq], 1]; Position[p, Flatten[{___, subseq, ___}]]]
> 
> I want to know more about the role of Module function and " ; "  in these lines. I have read documentation about Module function but it doesn't help me much in understanding this line of code. Thanks for helping me ! 
> 
> Regards, 
> Tung Anh

Module[{p}, expr1; expr2] creates a *local* variable named "p" and ; is 
used for building compound expressions. You should read pages 98 and 99 
of the above mentioned book since they explained what Module and Block 
are and how they work. Page 22 explains what a compound expression is.

Regards,
Jean-Marc


  • Prev by Date: Re: Manipulate a complex expression
  • Next by Date: Re: a beginner's question
  • Previous by thread: Re: a beginner's question
  • Next by thread: Re: a beginner's question