Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #1509

Re: package construction

From "Sjoerd C. de Vries" <sjoerd.c.devries@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: package construction
Date 2011-04-06 09:12 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <inhaph$28b$1@smc.vnet.net> (permalink)
References <inerrp$jae$1@smc.vnet.net>

Show all headers | View raw


This is from tutorial/SettingUpMathematicaPackages. It doesn't look
that complicated to me...

BeginPackage["Collatz`"]

Collatz::usage =
        "Collatz[n] gives a list of the iterates in the 3n+1 problem,
        starting from n. The conjecture is that this sequence always
        terminates."

Begin["`Private`"]

Collatz[1] := {1}
Collatz[n_Integer]  := Prepend[Collatz[3 n + 1], n] /; OddQ[n] && n >
0
Collatz[n_Integer] := Prepend[Collatz[n/2], n] /; EvenQ[n] && n > 0

End[ ]
EndPackage[ ]

Cheers -- Sjoerd


On Apr 5, 12:45 pm, Jack L Goldberg 1 <jackg...@umich.edu> wrote:
> Hi Folks;
>
> Something puzzles me. (Actually, a lot puzzles me but thats a story  
> for my psychologist).  Considering the incredible sophistication of  
> Mathematica, why is it so mysteriously hard for a beginner to write a pac=
kage  
> and store it properly so that it can by accessed as easily as built-n  
> packages?
>
> Has anyone put there mind to develop a template to make this stuff  
> automatic. As a model, consider digital cameras, which have automatic  
> mode for camera dummies like me, and a manual mode for the serious  
> enthusiasts.  I envisage a template in which the pertinent questions =
 
> are asked of the developer: Name of package, name of commands for  
> users and the syntax of these commands, the private code and etc. Mathema=
tica  
> then takes this info, does all the routine stuff needed to have a  
> package ready to go.
>
> I suppose that this has not been done because it is far harder to do  
> than I imagine it to be. But when I consider the sophistication of  
> Resolve, I can't believe this is harder.
>
> Jack

Back to comp.soft-sys.math.mathematica | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

package construction Jack L Goldberg 1 <jackgold@umich.edu> - 2011-04-05 10:45 +0000
  Re: package construction "Sjoerd C. de Vries" <sjoerd.c.devries@gmail.com> - 2011-04-06 09:12 +0000
    Re: package construction Alexey <lehin.p@gmail.com> - 2011-04-07 12:06 +0000
  Re: package construction "Nasser M. Abbasi" <nma@12000.org> - 2011-04-06 09:14 +0000

csiph-web