User talk:Waldorf

From Rosetta Code
Revision as of 02:53, 2 March 2009 by MikeMol (talk | contribs) (→‎Primitive types: new section)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Appropriate Tasks

The recent turmoil concerning the structure task brings up a basic question. What are appropriate (and by inference, inappropriate) tasks for Rosetta Code?

Is Rosetta Code only for tasks appropriate to scripting languages? One comment complained about a task dealing with data representation issues being too low level. It is my understanding that Rosetta Code intends to explore language syntax, capabilities, libraries, and structure through the implementation of specific tasks. Some tasks already exist that are best implemented with SQL or some variation thereof. Why, then is a task focused on representation issues out of bounds.

I agree that the structure task was ill-defined. Is it appropriate to define a new task to demonstrate language capabilities regarding specification of data representations?

I have no problem with exploring data representation. However, I firmly believe that tasks need to be modularized. A task that explores something needs to be created in such a way that prevents it from hindering the completion of other portions of the task. In practice, this means that a task needs to focus on as few things as possible. A task that focuses on data representation needs to be about data representation.
Modularization is important because we need article titles to be representative of what the article is about. An article named "Custom data types" is not a good name for an article about sharing data between multiple languages, while "Share data between C and another language" would be. --Short Circuit 15:44, 26 February 2007 (EST)
I am thinking about creating a number of well-contained tasks related to data representation. Some languages are strongly typed, some are weakly typed, some are statically typed, and some are dynamically typed. Each of the combinations of those attributes provides different abilities and approaches to defining data. There already exist tasks for defining structures and classes. I would like to add other tasks: Demonstrate how to determine or set the address of a variable. Demonstrate how to determine or set the minimum size (memory footprint) of a variable or data type. Demonstrate how to control the memory layout of fields within a data structure.
Finally, I would like to develop a task to demonstrate how to make a data type that acts like a primitive data type but has programmer-defined characteristics such as a limited range of valid values. This task would include a demonstration, or discussion if the capability is built into the language, of how to implement the required range checking.
Sounds good to me. I'm not holding you back. I don't want to hold anyone back, really; This site grows as people add tasks. Of all the content on Rosetta Code, only around 10% was originally mine. --Short Circuit 19:17, 26 February 2007 (EST)

Lucas-Lehmer test

Hi,...

I'm not an ADA producer... but I think that your program may be able to get a bit further if you changed the following line:

     MP : Long_Long_Integer := 2**Item - 1;

To (in hybrid Ada/C at least):

     MP : Long_Long_Integer := 2ULL**Item - 1;

(esp if the bit width on Int is ≤ ¼ of Long_Long_Integer's width)

The logic is Lucas-Lehmer should be generate n in 2*n-1 where n is "almost" half the bit width of Long_Long_Integer. If this width is 128, then n should get to:

M2 M3 M5 M7 M13 M17 M19 M31 M61

Unsigned also help get to M127 if Long_Long_Integer is 32 bytes wide, if there is such a thing.

Cheers NevilleDNZ 02:59, 16 February 2008 (MST)

I gather from your example above that you are suggesting the use of an unsigned integer type. I use a Windows XP OS. The largest unsigned number available to me on my Ada compiler is a 64 bit unsigned number, which yields the same result.--Waldorf 07:02, 16 February 2008 (MST)

Monty Hall simulation results

Hi, Your sample results could be in error could you take a look at the comment in the MH talk page please, thanks. --Paddy3118 15:24, 11 August 2008 (UTC)

The problem was handled by increasing the number of iterations. The discrete random number generator in the GNAT compiler is flaky for small numbers of runs.--Waldorf 00:22, 15 August 2008 (UTC)

Primitive types

There's some interest in the intention behind Defining Primitive Types, if you can take a moment to weigh in. --Short Circuit 02:53, 2 March 2009 (UTC)