home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!ames!ncar!noao!arizona!arizona.edu!cerritos.edu!news.service.uci.edu!beckman.com!dn66!a_rubin
- From: a_rubin@dsg4.dse.beckman.com (Arthur Rubin)
- Newsgroups: sci.math.symbolic
- Subject: Re: Question about programming in mma
- Keywords: symbols mma
- Message-ID: <a_rubin.721589449@dn66>
- Date: 12 Nov 92 17:30:49 GMT
- References: <1992Nov11.211405.27798@mlb.semi.harris.com>
- Organization: Beckman Instruments, Inc.
- Lines: 31
- Nntp-Posting-Host: dn66.dse.beckman.com
-
- In <1992Nov11.211405.27798@mlb.semi.harris.com> gsp@mlb.semi.harris.com (Gary Porter,62B-384,7295697) writes:
-
- >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 }
-
- SetAttributes[dropCar,HoldAll]
- --
- Arthur L. Rubin: a_rubin@dsg4.dse.beckman.com (work) Beckman Instruments/Brea
- 216-5888@mcimail.com 70707.453@compuserve.com arthur@pnet01.cts.com (personal)
- My opinions are my own, and do not represent those of my employer.
- My interaction with our news system is unstable; please mail anything important.
-