Question : How do I access a list element in a Mathematica table of lists

I have a simple table of lists:

1:
2:
MyParams = Table[Subscript[{initialCap, tStart, tEnd}, k], {k, 0, 2}]


Which returns
1:
2:
3:
{Subscript[{initialCap, tStart, tEnd}, 0], Subscript[{initialCap, 
  tStart, tEnd}, 1], Subscript[{initialCap, tStart, tEnd}, 2]}


Is there any way to extract the individual initialCap, tStart or tEnd from MyParams[[0]]?

Answer : How do I access a list element in a Mathematica table of lists

You wouldn't derive from it, but could wrap it.  Here's a silly example that shows you can make your own class to handle things in your way - in this example the constructor takes a domain name and automatically prepends "http://www." and appends ".com/" (demonstrating a behavior that extends HttpWebRequest)...

The actual HttpWebRequest is exposed as a property, and you may choose to wrap commonly used functions and properties such as GetResponse()...

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Net;

static class Program
{
	/// <summary>
	/// The main entry point for the application.
	/// </summary>
	[STAThread]
	static void Main()
	{
		MyWebRequest myReq = new MyWebRequest("experts-exchange");

		MessageBox.Show(myReq.GetResponse().ContentType);
	}
}
public class MyWebRequest
{
	private HttpWebRequest _webRequest;

	public MyWebRequest(string Address)
	{
		_webRequest = (HttpWebRequest)WebRequest.Create("http://www." + Address + ".com/");
	}

	public HttpWebRequest Request
	{
		get { return _webRequest; }
	}

	public WebResponse GetResponse()
	{
		return _webRequest.GetResponse();
	}
}
Random Solutions  
 
programming4us programming4us