View Single Post
Old 01-16-2022, 06:07 PM   #291
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 11,095
Karma: 76037135
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I'm having some trouble with using an inlist with square brackets, e.g.

Code:
program:
coll = $#kobocoll;

first_non_empty
   (
	if '[Send to Device]' inlist coll then 'sync.png' fi,
	if "[Kobo Store]" inlist coll then 'drm-locked.png' fi,
   )
incorrectly marks every book with sync.png (and if I comment the line out, then drm-locked.png). It doesn't happen if I remove the square brackets. Technically it's still working as it's not exact and still matches, but what is going on?

EDIT: I think I know what's happening. I forgot about regex. Putting in slashes to.... break (I forgot the actual word) them makes it work.

EDIT: Is there a better way to merge three lists then this? I'm a bit surprised that list_union doesn't handle more than 2 lists.

Code:
new_entries = list_union(first_list, second_list, ',';
new_list = list_union(new_entries, third_list, ',')

Last edited by ownedbycats; 01-16-2022 at 06:51 PM.
ownedbycats is offline   Reply With Quote