You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With string-join, you can create a string for multiple strings, optionally interspersed with a separator. array:join can be used to create an array from multiple arrays.
fn:intersperse, which has been added to the XQuery 4 draft, does something very similar, and early feedback indicates that the function is useful, but easily to overlook due to its name.
I propose to unify the functions by…
renaming fn:intersperse to fn:join;
adding a parameter to array:join: $separator as array(*)* := (); and
allowing a separator sequence for fn:string-join: $separator as xs:string* := ().
Activity
benibela commentedon Dec 4, 2023
Could also call it
sequence-joinoritems-join, then it is more consistent withstring-joinitems-joinvariant would also be consistent withitems-afteror it could be a sequence.
array:join([1,2,3], '-')to make it[1,'-',2,'-',3]ChristianGruen commentedon Dec 4, 2023
I suggested
fn:joinas we already havearray:joinand various other sequence functions that don’t includesequence.The
items-functions will probably be renamed:https://qt4cg.org/pr/855/xpath-functions-40/Overview.html#func-subsequence-after
#844 (comment)
I thought about this, but then it wouldn’t be possible to include multiple arrays.
joewiz commentedon Dec 4, 2023
+1 to
fn:join(andarray:join)michaelhkay commentedon Dec 5, 2023
I'm still a little uneasy that for many people with a database background, join means relational equijoin.
ChristianGruen commentedon Aug 1, 2024
I noticed that during XML Prague the
PRG-requiredlabel was added to this issue.Does someone remember which of my suggestions were regarded as necessary? Would it be helpful if I create a PR for my initial proposal?
michaelhkay commentedon Aug 1, 2024
Not I, I'm afraid.
fn:intersperse → fn:join, array:join($arrays, $separator). Closes qt4…
fn:intersperse → fn:join, array:join($arrays, $separator). Closes qt4…
Join functions: Revisions. qt4cg#868
Join functions: Revisions. qt4cg#868
Join functions: Revisions. qt4cg#868
Join functions: Revisions. qt4cg#868
Join functions: Revisions. qt4cg#868