Questions tagged [downvalues]

Questions about DownValues which specify function definitions for symbols.

69 questions
10
votes
2 answers

Unexpected behavior when directly assigning to DownValues

I'm encountering some unexpected behavior when assigning to DownValues. When I assign two definitions for test[1] as below, Mathematica stores both definitions: DownValues[test] = {HoldPattern[test[1]] :> 1, HoldPattern[test[1]] :>…
tom
  • 636
  • 3
  • 11
1
vote
2 answers

Given a list of date and value pairs, efficiently sum the values by date

I have a list of date & value pairs. There can be multiple entries for each day. Sample data can be generated with the following: maxDays = 10; date = AbsoluteTime[{2013, 5, 13}]; dateValuePairs = Flatten[Table[{date + day * 86400, value}, {day,…
mmorris
  • 1,172
  • 7
  • 18
1
vote
0 answers

Pure OwnValue Functions vs Patterned DownValue Functions

Is it better to use pure Function assigned to symbols as their OwnValues vs function defined by patterns as symbol's DownValues. Which one is faster and are there any exceptions?
user13892
  • 9,375
  • 1
  • 13
  • 41