Rosetta Code talk:Village Pump/Suggest a programming task

From Rosetta Code

Get moving on these

Can we get moving on some of these? --Short Circuit 23:00, 7 November 2007 (MST)

Task guidelines?

Moved to Village Pump:Home/Task creation process discussion

LZW compression and decompression

Sir, I introduce myself as a student pursuing my Mtech VLSI Design in INDIA I am in need of LZW compression and decompression coding in VERILOG HDL Can anyone help.

If possible, send me the coding to,

manekantan@gmail.com

Thanks in advance, Regards, Manikandan

Assertions

Are there enough languages that use assertions to warrant a task for them? I know Java, C, and C++ have them, but I'm not sure about other languages. Also, do assertions work similarly enough across all of the languages to make comparison worthwhile? --Mwn3d 21:22, 3 February 2009 (UTC)

Is there a literary definition of the concept? As far as I know, it's a runtime check of a boolean condition, combined with a debugging aid, such as a breakpoint or logging command. That concept seems fairly universal, at least for procedural languages. I'd be curious what the analog would be for languages like Lisp or Haskell. --Short Circuit 23:39, 3 February 2009 (UTC)
I know Modula-3 and Ada both have assertion pragmas. I believe OCaml/F# have assertion commands. Oberon-2 has an ASSERT builtin command. I'd say it's "universal" enough that there should at least be libraries for basic assertions in all languages. --01:12, 4 February 2009 (UTC)

Gamma function and similar

What should it happen when one asks for a "function"/algorithm which is already implemented in a language, in its "standard libs/functions...", or which is implemented in a external extra lib? Should one just show its usage, or show how it would be implemented if the language wouldn't have that function?

It seems it strongly depends on how the task was written, but doubts and shadows remain to me; examples:

  • The Gamma function exists in Fortran2008; if the task asks just show how to compute the Gamma function in your language, I surely would use the intrinsic function, or well known libraries (Python numpy/scipy e.g.). If the task asks for a specific algorithm...? I suppose I am forced to implement it forgetting about libraries and intrinsics.
  • Basic bitmap storage... Perl uses the Imlib2; it achieves the aim of the task (providing a graphics framework for other related tasks?), but it does not show how in Perl you would create a basic bitmap storage...
  • Bresenham's line algorithm ... Perl again... Imlib2 has its own draw_line routine... since here the task asks explicitly for the implementation of a specific algorithm for drawing lines, cannot we use intrinsics if any? This time, Perl both shows how to use the Imlib2 and implements the Bresenham algorithm... what if the task would have been show how to draw a line using the basic bitmap storage from This Other Task?
  • LZW compression ... I've not uploaded my C version because it is long since I had to implement a Dictionary and a String facility (so it was easy to translate the Java code...); then I've found the Judy lib (used in Creating an Associative Array), but I haven't adapted the code yet, nor I am sure Judy can fit the specific need directly (I should anyway write support functions). But in this case, since the algorithm requested by the task is LZW, not Dictionary (or associative arrays, for which there's another task), using heavily extern functions/libraries is ok... except if we use a liblzw that with a simple lzwcompress(in, out) resolve the task...?

Maybe a moral: if the task is written in a rather general way (like: show how to draw a line, show how to compute the Gamma function in your language and so on), then it seems you can use everything you can, even implement a well-known/used algorithm. If the task asks explicitly for the implementation of an algorithm (Bresenham, LZW, Lanczos approximation...), then we must implement it, disregarding just "details" (e.g.: Bresenham needs to plot single points, we can use any function we can/want to plot them; LZW needs associative arrays, and we can use any already made function/method/object ... and so on)

(Middle point: a task could be permissive: show how to draw a line, e.g. using the Bresenham algorithm or the Xiaolin Wu algorithm, but it would be better in this case if the task is separated, since the former just draws a sharp line, the latter draws an antialiased line)

Is this The Interpretation we should follow? --ShinTakezou 14:14, 24 February 2009 (UTC)