Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Test of a pure function

  • To: mathgroup at
  • Subject: [mg34038] RE: [mg34010] Test of a pure function
  • From: "DrBob" <majort at>
  • Date: Sat, 27 Apr 2002 00:57:04 -0400 (EDT)
  • Reply-to: <drbob at>
  • Sender: owner-wri-mathgroup at

A pure function isn't always the way to go --- for maintainability of
the code, if nothing else.  Look at this approach:






This function gives the positions in xBins of elements that bracket x
or, if x < Min[xBins] it gives {1}, and if x > Max[xBins] it gives
{Length[xBins]+1}.  The two special cases return singletons while usual
cases result in at least two elements returned.

It seems to me that a good solution might involve ListCorrelate, but I
haven't been able to think that through as yet.

Bobby Treat

-----Original Message-----
From: Shawn O'Connor [mailto:soconnor at] 
To: mathgroup at
Subject: [mg34038] [mg34010] Test of a pure function


    I hope someone can help me with this I know the solution should be
but I am still learning how pure functions work.

I am trying to pick out a position in a list were a number falls i.e.

Position[xBins, _?(#1<=x <= #2 &)].  I keep getting errors Like these

Function::slotn: Slot number 2 in #1¾x¾#2& cannot be filled
from \

Function::slotn: Slot number 2 in
#1¾x¾#2& cannot be filled from \

Function::slotn: Slot number 2 in #1¾x¾#2& cannot be filled from

General::stop: Further output of
Function::slotn will be suppressed during \
this calculation.

Can I make a comparison with the nth and nth+1 element in a pure
Thank you,

  • Prev by Date: Re: 3D contour through a point
  • Next by Date: Re: Getting File Directory Using Any Platform
  • Previous by thread: Re: Test of a pure function
  • Next by thread: RE: Re: Test of a pure function