home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: sci.math.symbolic
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!jvnc.net!darwin.sura.net!mlb.semi.harris.com!widget!gsp
- From: gsp@mlb.semi.harris.com (Gary Porter,62B-384,7295697)
- Subject: Question about programming in mma
- Date: Wed, 11 Nov 1992 21:14:05 GMT
- Nntp-Posting-Host: widget.mlb.semi.harris.com
- Reply-To: gsp@mlb.semi.harris.com
- Organization: Harris Semiconductor Corporation
- Keywords: symbols mma
- Sender: news@mlb.semi.harris.com
- Message-ID: <1992Nov11.211405.27798@mlb.semi.harris.com>
- Lines: 31
-
- Can someone tell me how to pass symbols as parameters
- in mathematica. (like nlambda or macros in lisp)
-
- For example, I want to define a function "dropCar" that
- takes a symbol as a parameter and has the side-effect of setting the
- symbol's value to the "rest" of it's list.
-
- dropCar[ symbol_ ] := Block[ {},
- symbol = Rest[ symbol ]
- ]
-
- y = { 1.1, 2.2, 3.3 }
-
- Such that:
-
- dropCar[ y ]
-
- sets y to { 2.2, 3.3 }, and another:
-
- dropCar[ y ]
-
- sets y to { 3.3 }
-
- The above code doesn't work, do you know of a way to do this?
-
- ---
- Gary Porter Principal Engineer
- Internet: gsp@mlb.semi.harris.com Harris Semiconductor
- Phone: (407) 729-5697 PO Box 883 MS 62B-022
- FAX: (407) 729-4960 Melbourne, FL 32902-0883
-
-