5
$\begingroup$
Today

enter image description here

Interpreter["ComputedDate"] /@ {"next Monday", "next Tuesday", "next Wednesday"}

enter image description here

What explains this behavior? Can it be controlled?

$\endgroup$
  • 1
    $\begingroup$ In all fairness, Interpreter documentation says "applied to a string to try to interpret..." What makes you believe its output should always be correct? $\endgroup$ – alancalvitti Nov 2 '14 at 1:23
  • $\begingroup$ That language obviously refers to the fact that the function can only recognize a finite number of patterns. There is only one type of pattern being submitted here and it is exhibiting inconsistent behavior; I did not say it was incorrect but rather asked if there was an explanation. Clearly "next" is a relative concept depending on when the week starts, so for all I know it is a timezone issue. $\endgroup$ – mfvonh Nov 2 '14 at 15:27
  • $\begingroup$ I was joking, welcome to a new kind of speculative science. I don't think it's a TZ issue, try more days. $\endgroup$ – alancalvitti Nov 2 '14 at 17:32
  • $\begingroup$ My bad, went over my head. Days Wednesday and forward are shifted shifted a week ahead as of today (Sunday). $\endgroup$ – mfvonh Nov 2 '14 at 20:15
  • 1
    $\begingroup$ @mfvonh Have you tried "this" over "next". People have argued about definition of this Monday vs next Monday. Even Interpreter["ComputedDate"] /@ {"this Monday", "this Tuesday", "this Wednesday"} is ambiguous. Try "current". $\endgroup$ – Hans Nov 5 '14 at 15:38
2
$\begingroup$

As @Hans pointed out in a comment, this isn't as straightforward to interpret as it may seem. Take a look at this question from english.stackexchange: "Which day does “next Tuesday” refer to?". The English language is a complex beast!

To me, “next Tuesday” means the Tuesday that comes next week. For example, on Monday, October 11 and Wednesday, October 13, “next Tuesday” means October 19. Whereas on Monday, October 18, “next Tuesday” means October 26. “This Tuesday” refers to the Tuesday that comes this week, which on Wednesday would refer to yesterday, and on Monday refers to tomorrow. Similarly, “Last Tuesday” is the Tuesday that came last week.

Without any descriptors, day names by themselves mean the next such day in the future unless used in the past tense. “He will do it on Tuesday” means the next time there is a Tuesday, which on Monday would mean “tomorrow” but on Wednesday would mean the following Tuesday. In the past tense, day names mean the last such day which occurred. “He did it on Tuesday” means the most recent day that was a Tuesday.

This alternative is perhaps a bit easier to interpret, and the results it returns make sense to me. You could also use "current Monday" etc.

Today
(* Mon 13 Apr 2015 *)

Interpreter["ComputedDate"] /@ {"this Monday", "this Tuesday", 
  "this Wednesday", "this Thursday", "this Friday", "this Saturday", 
  "this Sunday"}

enter image description here

However, returning to your example using the word "next", quite why the change occurs between Thursday 23rd and Friday 17th April I don't know.

Interpreter["ComputedDate"] /@ {"next Monday", "next Tuesday", 
  "next Wednesday", "next Thursday", "next Friday", "next Saturday", 
  "next Sunday"}

enter image description here

Another thing to try is the following. It seems that the new week is interpreted to start on a Sunday.

Interpreter["ComputedDate"] /@ {"Monday next week", 
  "Tuesday next week", "Wednesday next week", "Thursday next week", 
  "Friday next week", "Saturday next week", "Sunday next week"}

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.