1

I have 2 rules:

Rule[#, SomeFunction[#]] &/@ SomeFunctionArgs;
Rule[#, OtherFunction[#]] &/@ OtherFunctionArgs;

I want to have one function that combines the 2 results in 1. I have tried to do:

MainFunction[] =: ( Rule[#, SomeFunction[#]] &/@ SomeFunctionArgs; Rule[#, OtherFunction[#]] &/@ OtherFunctionArgs)

But this didn't work.

Any advices?

UPDADE:

SomeFunctionArgs = {
    "A",
    "B"
}

OtherFunctionArgs = { 
    "C",
    "D"
}

This will give {A -> "result1", B -> "result2"}

Rule[#, SomeFunction[#]] &/@ SomeFunctionArgs

This will give {C -> "result3", D -> "result4"}

Rule[#, OtherFunction[#]] &/@ OtherFunctionArgs

I want MainFunction[] to give the following result:

{A -> "result1", B -> "result2", C -> "result3", D -> "result4"}

SuTron
  • 1,708
  • 1
  • 11
  • 21

1 Answers1

2

I figured it out.

Join[
Rule[#, SomeFunction[#]] &/@ SomeFunctionArgs,
Rule[#, OtherFunction[#]] &/@ OtherFunctionArgs
]

This does the required. I was failing, as I was using ; instead of ,.

@ David Carraher Thanks for the comment.

SuTron
  • 1,708
  • 1
  • 11
  • 21