Talk:Optional parameters: Difference between revisions

From Rosetta Code
Content added Content deleted
(don't use my sample data)
Line 17: Line 17:


: Since you're not required to provide the actual sort, you don't actually need to deal with the data structure at all — just provide the parameter declaration. The reason the parameter set is so complex is to discourage the scenario of “oh, this situation is so simple it doesn't need optional parameters”. --[[User:Kevin Reid|Kevin Reid]] 11:12, 24 May 2009 (UTC)
: Since you're not required to provide the actual sort, you don't actually need to deal with the data structure at all — just provide the parameter declaration. The reason the parameter set is so complex is to discourage the scenario of “oh, this situation is so simple it doesn't need optional parameters”. --[[User:Kevin Reid|Kevin Reid]] 11:12, 24 May 2009 (UTC)

:: Yep, Fortran code I am going to add does a little bit more... could it be all reduced to the "interface" (in the Fortran sense) declaration and an explanation of the "present" intrinsic? (To discourage the scenario, it would be enough to me to focus the task on optional argumentes... they can't be disregarded if the task is about them!) --[[User:ShinTakezou|ShinTakezou]] 12:46, 24 May 2009 (UTC)


== Absence of arguments ==
== Absence of arguments ==

Revision as of 12:46, 24 May 2009

Table?

So the input table in your example is:

  "a"    "b"    "c"
  ""     "q"    "z"
  "zap"  "zip"  "Zot"

And sorting is of rows and by column. Actually, now I have written it out - it makes sense. --Paddy3118 06:58, 24 May 2009 (UTC)

Don't use this table

I don't recommend copying my sample data -- it's ugly and also suffers from being written in a hurry -- in particular, the length is too correlated with the first letter. --Kevin Reid

Isn't too much if the aim is to show optional parameters?

I mean, if the aim if to show how languages allow (if allow) (named) optional parameters, then isn't the task too much complex? Even without implementing the sort if not built-in, wouldn't it be simpler just to ask for sorting of an array with the optional parameter ordering and reverse? It would show anyway the "optional parameter" part without the fuss of coping with multidimensional arrays? --ShinTakezou 09:10, 24 May 2009 (UTC)

Since you're not required to provide the actual sort, you don't actually need to deal with the data structure at all — just provide the parameter declaration. The reason the parameter set is so complex is to discourage the scenario of “oh, this situation is so simple it doesn't need optional parameters”. --Kevin Reid 11:12, 24 May 2009 (UTC)
Yep, Fortran code I am going to add does a little bit more... could it be all reduced to the "interface" (in the Fortran sense) declaration and an explanation of the "present" intrinsic? (To discourage the scenario, it would be enough to me to focus the task on optional argumentes... they can't be disregarded if the task is about them!) --ShinTakezou 12:46, 24 May 2009 (UTC)

Absence of arguments

I just realized that my design for this task does not exercise the language's facility for distinguishing absence of optional arguments (as opposed to having a simple default value which someone could also supply explicitly). Is this worthwhile? Any suggestions on how to incorporate it? --Kevin Reid 11:12, 24 May 2009 (UTC)