The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Pairing of Nodes
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Xah Lee

Posts: 171
Registered: 12/4/04
Pairing of Nodes
Posted: Nov 12, 1996 1:20 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

This is a summary on a programing problem "pairing of nodes". Not many
people wrote. I wish they would.

Problem: Pairing of Nodes.
Given two list of the same Dimensions, how to combine the list so that
the end nodes of the new list pair the end nodes of given lists. Example
and solution:

Clear[li1, li2]

li1 = Array[f, {2,3,4}]
li2 = Array[g, {2,3,4}]

Transpose[ {li1, li2},RotateRight@ Range@ Length@ Dimensions@ {li1,

(* ---------solutions --------------*)

(*From: (Frans Martens) *)
MapThread[List, {li1,li2}, Length[Dimensions[li1]]]

(* (hall robert)*)
MapThread[List, {li1, li2}, Depth[li1] -2]

li1 + li2 /. Plus -> List

Mountain View, CA, USA

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.