Re: a beginner's question

• To: mathgroup at smc.vnet.net
• Subject: [mg77791] Re: [mg77768] a beginner's question
• From: Sseziwa Mukasa <mukasa at jeol.com>
• Date: Sun, 17 Jun 2007 05:58:13 -0400 (EDT)
• References: <200706160731.DAA25957@smc.vnet.net>

```On Jun 16, 2007, at 3:31 AM, 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 !

Module is a scoping construct, the values of symbols in the list of
the first argument to Module, p in this case, are replaced by symbols
of the from name\$n where name is the name of symbol, p again, and n
is a number.  This has the effect of making expressions referring to
that symbol in the second argument of Module referring to that symbol
local to that expression.  See the Mathematica  Help Browser for more
information.  Since you are new to programming you may need to read
up on the concept of scope, the Wikipedia entry (http://
en.wikipedia.org/wiki/Scope_(programming)) is a decent starting point.

; defines a compound expression in Mathematica, it lets you evaluate
a series of expressions together in sequence.

Regards,

Ssezi

```

• Prev by Date: Re: a beginner's question
• Next by Date: Re: MathLink: letting Mathematica do the hard work
• Previous by thread: a beginner's question
• Next by thread: Re: a beginner's question