Consider the following functional as an example:
ClearAll[urlModifier];
urlModifier[url_]:=ReplaceAll[Function@Evaluate[
Inactive[URLBuild][
URLParse[url]/.{"slot"->Inactive[StringReplace][Slot[]," "->"_"]}
]
],{Inactive[x_]:>x}];
If I evaluate it using the following command:
urlModifier["https://www.somewebsite.com/path/slot"]["hello world!"]
It fails probably because the Slot[]
is not aligning with the Function
.
But if I do in-place evaluation of urlModifier["https://www.somewebsite.com/path/slot"]
and use the result as input:
URLBuild[<|"Scheme"->"https","User"->None,"Domain"->"www.somewebsite.com","Port"->None,"Path"->{"","path",StringReplace[Slot[]," "->"_"]},"Query"->{},"Fragment"->None|>]&["hello world!"]
It works fine.
What should I do to urlModifier
to make it accept the Slot[]
for its Function
that it creates?