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: Programming: Replace Heads
Replies: 1   Last Post: Nov 9, 1996 2:02 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Xah Lee

Posts: 171
Registered: 12/4/04
Programming: Replace Heads
Posted: Nov 6, 1996 12:49 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I'm delited 2 have the opportunity 2 post another interesting prograMing

Given an abritrary expression, how to replace all heads to List?

my solution:
Map[ {(Sequence@@#)}&, expr, {0,-2}]



f := ({a,b,c,d,e,g}[[Random[Integer, {1,6}] ]])

Array[ Hold@f, {3,2,3},1, Hold@f]//ReleaseHold

Map[ {(Sequence@@#)}&, %, {0,-2}]

Post your solutions. Please cc to me 2. I will write up a summary of
solutions of PrograMMing Competition of last month.

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.