ID:746553
 
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
These two procedures (cmptext and addtext) accept only individual arguments. No lists, no arglist().

Most other procedures that usually accept a bunch of arguments in the form of proc(val1, val2, val,...) accept lists. (Even though arglist() isn't supported, and it's silly that it isn't, too.)

Basically, instead of
cmptext("val1","val2","val3",...) // I just want to do
var/list/poo = list("val1","val2","val3",...)
cmptext(poo)

Procedures like pick, max, and min all support passing a list.
I agree. It seems odd that these procs don't have this feature. It might be some sort of technical limitation, though.
Of the procedures you listed, only pick(), max(), and min() support a list as a single argument, as their reference entries state. You can pass a list to the is___() procs, but it won't look inside the list, it will only recognize the list as a /list object.

There's several procedures I'd like to have arglist() support for, but apparently it just doesn't work like that. Being able to use arglist() in everything would make it actually useful. But since it isn't supported by the built-in procs, I've had to make my own workarounds.

Speaking of workarounds...
proc/cmptexts(L[])
var n, len = L.len - 1
for(n in 1 to len)
if(L[n] != L[n + 1])
return 0
return 1

Simple enough, but is it enough to ask for built-in support?
In response to Kaiochao
Kaiochao wrote:
Of the procedures you listed, only pick(), max(), and min() support a list as a single argument, as their reference entries state. You can pass a list to the is___() procs, but it won't look inside the list, it will only recognize the list as a /list object.
Oh wait. Yeah. I derped. FFFFFFFFF. Editing post.

There's several procedures I'd like to have arglist() support for, but apparently it just doesn't work like that. Being able to use arglist() in everything would make it actually useful. But since it isn't supported by the built-in procs, I've had to make my own workarounds.
Speaking of workarounds...
> proc/cmptexts(L[])
> var n, len = L.len - 1
> for(n in 1 to len)
> if(L[n] != L[n + 1])
> return 0
> return 1
>
Workarounds are cool and all, but I'm pretty sure any workaround we'd be able to do would take more processing power and take longer. Especially with longer lists.

Simple enough, but is it enough to ask for built-in support?
Is it enough to ask? No. We should demand it! arglist() and just generally accepting lists in some procedures makes a lot of sense...but it's been this way forever...something has to change. :|

Originally, I was going to request arglist support in built-in procedures...but I knew that's not going to happen. For now, the only things that are really limited due to not accepting lists are arguments (or instead of) would be addtext, cmptext, and newlist.
I do believe the arglist() proc was added for the purpose of perfect forwarding. (Maybe.)
cmptext() taking a list doesn't really make any sense in the way it's presented here, since checking to see if all the items are the same is rarely useful. The only use I would see for a list format would be to check one string against a series of possibilities, so something like cmptext(list,str) or cmptext(str,list). In a multiple-arg format (more than 2), you'd have to designate which one was the string to compare to all the others; however a 2+ argument format would require internal changes that wouldn't be worth it.

The series of possibilities test though is easily done with if(item in list), as long as caps aren't a concern. I'd find findtext() more amenable to a list, except then you have the issue of needing to know which item was matched.
The Text library provides a concat() proc that takes a list a returns the concatenation of all items in the list.