(* ::Package:: *)

(************************************************************************)
(* This file was generated automatically by the Mathematica front end.  *)
(* It contains Initialization cells from a Notebook file, which         *)
(* typically will have the same name as this file except ending in      *)
(* ".nb" instead of ".m".                                               *)
(*                                                                      *)
(* This file is intended to be loaded into the Mathematica kernel using *)
(* the package loading commands Get or Needs.  Doing so is equivalent   *)
(* to using the Evaluate Initialization Cells menu command in the front *)
(* end.                                                                 *)
(*                                                                      *)
(* DO NOT EDIT THIS FILE.  This entire file is regenerated              *)
(* automatically each time the parent Notebook file is saved in the     *)
(* Mathematica front end.  Any changes you make to this file will be    *)
(* overwritten.                                                         *)
(************************************************************************)



(* :Name: PwM`Chap02Language` *)


(* :Book: Programming with Mathematica: An Introduction *)


(* :Author: Paul Wellin *)


(* :Summary: This package contains the functions defined in Chapter 2 The Mathematica language. Function names updated to be compatible with Mathematica 10 *)


(* :Context: PwM`Chap02Language` *)


(* :Package Version: 1.01 *)


(* :Copyright: Copyright 2014, Paul R Wellin *)


(* :History: Version 1.0 by Paul Wellin, Dec 2012 
            Version 1.01 by Paul Wellin Nov 2014*)


(* :Keywords: string characters, composite numbers, natural numbers and subsets. *)


(* :Source: Chap02Language.nb *)


(* :Mathematica Version: 10.0.1 *)


Remove[compositeQ]


BeginPackage["PwM`Chap02Language`"]


CharacterQ::usage="Character[c] returns True if c is a string of length one.";


compositeQ::usage="compositeQ[n] returns True if n is a composite number.";


NaturalQ::usage="NaturalQ[n] returns True if n is a natural number.";


subsetQ::usage="subsetQ[\!\(\*SubscriptBox[\(lis\), \(1\)]\),\!\(\*SubscriptBox[\(lis\), \(2\)]\)] returns True if \!\(\*SubscriptBox[\(lis\), \(1\)]\) is a subset of \!\(\*SubscriptBox[\(lis\), \(2\)]\).";


Begin["`Private`"]


CharacterQ[ch_]:=StringQ[ch]&&StringLength[ch]==1


NaturalQ[n_]:=IntegerQ[n]&&n>=0


subsetQ[{},lis2_]:=True


subsetQ[lis1_,lis2_]:=Intersection[lis1,lis2]==lis1


lis1_\[Subset]lis2_:=Intersection[lis1,lis2]==lis1


compositeQ[n_Integer/;n>1]:=Not[PrimeQ[n]]


End[]


EndPackage[]



