Message Boards Message Boards

[✓] Create a new list?


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}}


POSTED BY: M.A. Ghorbani
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
16 days ago

just do:

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

Dear Sander and Neil,

Thank you very for your help.

Kind Regards,

POSTED BY: M.A. Ghorbani
16 days ago

@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

POSTED BY: Moderation Team
16 days ago

Group Abstract Group Abstract