On Mon, Oct 27, 2008 at 10:37:19PM +0000, Andy Wardley wrote:
>M wrote:
>> It all works fine apart form the uniquing stage which does nothing 
>
>That's most puzzling.  list.unique definitely works (for the
>definition of "works" that I just tried):

I'm sure it does, if it didn't it would have been fixed ages ago.

>   [EMAIL PROTECTED] ~] tpage
>   [% list = [10 20 10 11 1 20 21 'foo' 'Foo' 'bar' 'foo'];
>      list.unique.join
>   %]

oooh I din't know you could do multiple lines inside a [% %] with ;s
handy.

>It's so trivially simple that I can't see anything that can
>go wrong with it.  Unless I'm missing something obvious...

I assumed this to be the case, which is why I was baffled, I didn't know
it was 

>   sub list_unique {
>       my %u;
>       [ grep { ++$u{$_} == 1 } @{$_[0]} ];
>   }

but assumed it was that simple.

> > I've solved my problem by adding a DISCRETE to the SQL
>
>That's the better solution, I think.  But it's still very puzzling as
>to why list.unique wasn't working.  Could it be that your data wasn't
>exactly the same?  Perhaps some elements had leading or trailing
>whitespace that differentiated it enough to make it non-unique?

Possible, but the DISCRETE has worked and that wouldn't if there was
whitespace as you suggest.

I suspect it has something to do with the hash returned by the DBI
query, but that's all a bit beyond me tbh, and having a solution means I
don't need to think about it any more.

M
-- 
GPG key here. http://www.gatrell.org/gpg.public.key

Attachment: signature.asc
Description: Digital signature

_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to