Message Boards Message Boards


[✓] Create a new list?

Posted 10 months ago
4 Replies
0 Total Likes

Dear all,

I have a list (for example):

List={{{a, b, c},d},{{e, f, 
  h}, {{i, j, 
   k}, m}}

Is there any way that I can generate a new list as following :

NewList={{{a, b, c}->d},{{e, f, 
  h}, {{i, j, 
   k}-> m}}


4 Replies
list={{{a, b, c},d},{{e, f, g}, h}, {{i, j, k}, m}}
Map[Rule[#[[1]], #[[2]]] &, list]

Note List cannot be capitalized.

just do:

Rule @@@ list

Dear Sander and Neil,

Thank you very for your help.

Kind Regards,

@M.A. Ghorbani you have been with the forum for a while already and you ignoring the rules:

The rules explain how to format your code properly. If you do not format code, it may become corrupted and useless to other members. Please EDIT your posts and make sure code blocks start on a new paragraph and look framed and colored like this.

int = Integrate[1/(x^3 - 1), x];
Map[Framed, int, Infinity]

enter image description here

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract