Re: documentation specification for Documentation Center
- To: mathgroup at smc.vnet.net
- Subject: [mg90054] Re: documentation specification for Documentation Center
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Fri, 27 Jun 2008 06:18:21 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <g3vkkc$k76$1@smc.vnet.net>
Francisco Gutierrez wrote: > I have problems creating packages. See for example the following very simple package: > BeginPackage["fuss`Func`"] > > crisclas::usage="Inputs are a set of training > vectors, a first guess vector, a zero, and a learning rate "; > > Begin["`Private`"] > > crisclas[trainingvec_,guess_,cero_,ritmo_]:=Module[{guess1=guess,\ > hacerlalista={}},If[trainingvec[[i]].guess-cero>0, guess, \ ======================!!!!!!!!!!!!^^^^ ERROR: the index 'i' has been neither *declared* nor *defined* at this stage. At "best", without the package context, the function is going to use whatever value a global called 'i', if any, holds, which is certainly not what you want. An easy fix is to define the index 'i' in the list of local variables (i.e. first argument of Module[]): Module[{guess1 = guess, hacerlalista = {}, i = 1}, <snip> Regards, -- Jean-Marc