MathGroup Archive 2012

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

Search the Archive

Putting a Test or Condition on the Right-Hand Side of a Function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127461] Putting a Test or Condition on the Right-Hand Side of a Function
  • From: Gregory Lypny <gregory.lypny at videotron.ca>
  • Date: Thu, 26 Jul 2012 03:35:45 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net

Hello everyone,

I have a simple function that displays the integer part of a real number if the fraction part is less than a millionth.

	dropDecimal[x_] := If[FractionalPart[x] < .000001, IntegerPart[x], x]

In trying to learn more about functional programming, I was wondering whether there is a way to put the condition or test on the right-hand side of the 
function.

Gregory



  • Prev by Date: Re: Can anyone see a faster way to compute quantities for a pair or
  • Next by Date: Re: Contour plot labels with higher precision
  • Previous by thread: how to jump from one cell to the other using the keyboard?
  • Next by thread: Re: Putting a Test or Condition on the Right-Hand Side of a Function