Message Boards Message Boards

[✓] Create a new list?

GROUPS:

Dear all,

I have a list (for example):

List={{{a, b, c},d},{{e, f, 
   g}, 
  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, 
   g}-> 
  h}, {{i, j, 
   k}-> m}}

Thanks

POSTED BY: M.A. Ghorbani
Answer
17 days ago
list={{{a, b, c},d},{{e, f, g}, h}, {{i, j, k}, m}}
Map[Rule[#[[1]], #[[2]]] &, list]

Note List cannot be capitalized.

POSTED BY: Neil Singer
Answer
16 days ago

just do:

Rule @@@ list
POSTED BY: Sander Huisman
Answer
16 days ago

Dear Sander and Neil,

Thank you very for your help.

Kind Regards,

POSTED BY: M.A. Ghorbani
Answer
16 days ago

@M.A. Ghorbani you have been with the forum for a while already and you ignoring the rules: https://wolfr.am/READ-1ST

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

POSTED BY: Moderation Team
Answer
16 days ago

Group Abstract Group Abstract