Talk:SEDOLs: Difference between revisions

From Rosetta Code
Content added Content deleted
(→‎R: stretch goal seems ok)
Line 24: Line 24:
::::Hi Danbron; why the change? It seems a good extension to the task, to make it reject badly formed SEDOLs, as a lot of money could ride on its correctness. How about adding the checking as a "stretch goal" to the task? --[[User:Paddy3118|Paddy3118]] 18:50, 1 October 2009 (UTC)
::::Hi Danbron; why the change? It seems a good extension to the task, to make it reject badly formed SEDOLs, as a lot of money could ride on its correctness. How about adding the checking as a "stretch goal" to the task? --[[User:Paddy3118|Paddy3118]] 18:50, 1 October 2009 (UTC)
:::::The reversion was due to the fact that the change broke most of the code. I'm fine adding it as "extra credit" that doesn't make most examples "wrong". The examples that provide extra validation could easily break it out as a separate function or call it out comments in the code. (I see calculation and validation as separate concerns that shouldn't be mixed, and would personally separate them into two functions. And I don't feel sorry for anyone that loses money running code he copped from a website, unscrutinized :) --[[User:DanBron|DanBron]] 19:43, 1 October 2009 (UTC)
:::::The reversion was due to the fact that the change broke most of the code. I'm fine adding it as "extra credit" that doesn't make most examples "wrong". The examples that provide extra validation could easily break it out as a separate function or call it out comments in the code. (I see calculation and validation as separate concerns that shouldn't be mixed, and would personally separate them into two functions. And I don't feel sorry for anyone that loses money running code he copped from a website, unscrutinized :) --[[User:DanBron|DanBron]] 19:43, 1 October 2009 (UTC)
::::::Thanks. Edit made. --[[User:Paddy3118|Paddy3118]] 05:48, 2 October 2009 (UTC)


== '0' checksum ==
== '0' checksum ==

Revision as of 05:48, 2 October 2009

J

Does the J solution reject strings with vowels in them? It says on the wikipedia that vowels are never used in the 6-character code, so the function should reject strings that have them. --Mwn3d 04:58, 5 August 2008 (UTC)

The J code isn't a validator, it merely calculates and appends the check digit.
You could modify it to whine about vowels by removing them:
    sn   =.  '0123456789 BCD FGH JKLMN PQRST VWXYZ'  
Not terribly exciting.
68.175.31.239 12:44, 5 August 2008 (UTC) (aka DanBron)

R

Does the R solution reject strings with vowels in them? It says on the wikipedia that vowels are never used in the 6-character code, so the function should reject strings that have them. (Is this a common trait of languages with single letter names ;-)
--Paddy3118 19:18, 29 September 2009 (UTC)

Now it looks like Modula-3 doesn't do the check. Maybe we need to move the algorithm here. --Mwn3d 22:10, 29 September 2009 (UTC)
Well, it seems most of the languages do not check for vowels. Only 8 out of the 26 examples check for vowels. --Mbishop 01:47, 30 September 2009 (UTC)
The specification doesn't say anything about checking for vowels, or validation in general. It says calculate and append the check digit.
This was recently added: "Your program should also check each input is correctly formed, especially with respect to valid characters allowed in a SEDOL string." --Mwn3d 17:04, 1 October 2009 (UTC)
I disagree with this addition and may remove it. I created the initial task and this wasn't in scope -- some people may've implemented it for extra credit, but that doesn't mean everyone has to. The addition requirement breaks most of the existing solutions. DanBron 17:12, 1 October 2009 (UTC)
Hi Danbron; why the change? It seems a good extension to the task, to make it reject badly formed SEDOLs, as a lot of money could ride on its correctness. How about adding the checking as a "stretch goal" to the task? --Paddy3118 18:50, 1 October 2009 (UTC)
The reversion was due to the fact that the change broke most of the code. I'm fine adding it as "extra credit" that doesn't make most examples "wrong". The examples that provide extra validation could easily break it out as a separate function or call it out comments in the code. (I see calculation and validation as separate concerns that shouldn't be mixed, and would personally separate them into two functions. And I don't feel sorry for anyone that loses money running code he copped from a website, unscrutinized :) --DanBron 19:43, 1 October 2009 (UTC)
Thanks. Edit made. --Paddy3118 05:48, 2 October 2009 (UTC)

'0' checksum

Among the test strings ought to be one that requires a '0' to verify that the checksum is in the range 0..9 instead of 1..10. --IanOsgood 00:34, 7 August 2008 (UTC)

TCL and _

Hi, I generally like the use of '_' in the TCL solution, but on checking, I find that it fails to reject the use of '_' in a SEDOL: <lang tcl>(bin) 11 % set code B0YBKT B0YBKT (bin) 12 % set sedol "${code}[sedol::checksum $code]" B0YBKT7 (bin) 13 % set code B0YBAT B0YBAT (bin) 14 % set sedol "${code}[sedol::checksum $code]" invalid character: A (bin) 15 % set code B0YB_T B0YB_T (bin) 16 % set sedol "${code}[sedol::checksum $code]" B0YB_T7 (bin) 17 % </lang> --Paddy3118 05:01, 28 April 2009 (UTC)

True. I'll fix that. --Glennj 11:19, 28 April 2009 (UTC)