Skip to main content
24 events
when toggle format what by license comment
Jun 16, 2020 at 9:23 history edited CommunityBot
Commonmark migration
Apr 13, 2017 at 12:55 history edited CommunityBot
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
Aug 1, 2016 at 4:50 comment added Wjx @Mr.Wizard wow, a thousand thanks for your appreciation to this series. I am constantly thinking about examples as well, but as you can see, a good example is hard to find......
Aug 1, 2016 at 4:47 comment added Mr.Wizard @Wjx Yes they can be. I certainly have not forgotten about it. I have found your series of questions about pattern matching quite interesting. I hope you are not discouraged by this question presently being closed, and I still hope we eventually come up with a clear and concise example and reopen it.
Aug 1, 2016 at 4:42 comment added Wjx @Mr.Wizard alright……Shortest and Longest can be very very confusing sometimes, especially when using together. And thanks for remembering my problem!
Jul 31, 2016 at 13:30 comment added Mr.Wizard Sorry, but please forget what I wrote before. I messed with far too many combinations of Shortest and Longest and rather confused myself. I updated my answer to the linked question accordingly. I don't think this can be used as a good example for this question.
Jul 31, 2016 at 10:15 comment added Mr.Wizard @Wjx While responding to another one of your questions I think I found an example that you could use to reopen this question. On my system RealDigits[99/700, 10, 24][[1]] /. {pre___, Longest[Repeated[rep__, {2, Infinity}]], inc___} /; MatchQ[{rep}, {inc, __}] :> {{pre}, {rep}, {inc}} gives the answer desired but RealDigits[99/700, 10, 24][[1]] /. {pre___, Longest[Repeated[Shortest[rep__], {2, Infinity}]], inc___} /; MatchQ[{rep}, {inc, __}] :> {{pre}, {rep}, {inc}} gives the "wrong" one. (continued)
Jul 11, 2016 at 0:31 history closed MarcoB
Bob Hanlon
Öskå
Jens
Mr.Wizard
Needs details or clarity
Jul 7, 2016 at 14:40 review Close votes
Jul 11, 2016 at 0:34
Jul 7, 2016 at 0:01 comment added Wjx Oh, thanks! I'll have to admit that this kind of example is hard to find out. I'll try~
Jul 6, 2016 at 23:45 comment added Mr.Wizard Then as I have said several times I think we need a better (and more complex) example where the behavior you wish to see is needed rather than merely incidental. You may have seen the phrase "explain like I'm five." Anyway it's your question and you can update it or not, but without a clarifying update I shall move on to more clear yet interesting questions like (118183).
Jul 6, 2016 at 23:42 comment added Wjx And this problem is just asking for one solution to the thing I've mentioned in the previous comment. The desired result is that when I input Replace[{1, 2}, {Longest[Shortest[x__, 1], 2], y___} :> {x}] I can get Longest work at the top priority thus return {1,2}
Jul 6, 2016 at 23:40 comment added Wjx @Mr.Wizard I know the priority settings works pretty well when handling multiple Shortest s or Longest s, but it's simply wierd that we cannot set priority between them, it doesn't seem like a hard problem to set priority between them as they are the same sort of function and if we do so, all the actions we can do now can be done in the same way, but we can get a much better control of the priority.
Jul 6, 2016 at 23:35 comment added Wjx En, I want to control the priority more, maybe some sort of let it work in a different way. Also I suppose a better understanding will help.
Jul 6, 2016 at 23:22 comment added Mr.Wizard By my reading however you seem to want the priority parameter to make Longest and Shortest behave differently from the way it does now. Your question as written does not appear to be about understanding the existing behavior but rather extending it in a particular way, i.e. "I suppose there must be some cases when we need to specify the priority between them ..." I think you already understand what the priority parameter of Shortest and Longest do as you illustrated that yourself.
Jul 6, 2016 at 23:10 comment added Wjx @Mr.Wizard er, actually this I ask this question just because I find their priority system is totally seperated and want to know how Mathematica automatically handle the priority between them and how can we manipulate this process.
Jul 6, 2016 at 22:56 comment added Mr.Wizard I suspect that you want something fundamentally different from the built-in implementation of Longest and Shortest, even with priority specified. I feel that you still need to provide a better and more complete example that does not have a trivial reduction.
Jul 6, 2016 at 22:50 comment added Wjx As it's already the Shortest one it can find.
Jul 6, 2016 at 22:49 comment added Wjx @Mr.Wizard I suppose the example with two Longest is similar, as you cannot let two sequence simultaneously Longest, but in this case the problem can be solved. I suppose Longest and Shortest shouldn't be considered as actually longest or shortest, but the longest and shortest it can get within the restrictions. So if a Longest with higher priority already set a limit to it, it must follow. Thus, if we can define the priority in my case, for example, set Longest at a higher priority, the Shortest shall find there's no other option but one, thus obey the result given by Longest.
Jul 6, 2016 at 22:37 comment added Mr.Wizard Your example does not make sense to me. How can a single pattern x__ be simultaneously Shortest and Longest?
Jul 6, 2016 at 15:17 comment added Wjx @MacroB Updated~Can this edit explain a bit more?
Jul 6, 2016 at 15:16 history edited Wjx CC BY-SA 3.0
added 1142 characters in body
Jul 6, 2016 at 12:31 comment added MarcoB "I suppose there must be some cases when we need to specify need to priority between them": and yet, you can't even come up with an example for such a need? Aren't you perhaps trying to solve a non-existent problem? Unfortunately the question seems rather unclear to me as written.
Jul 6, 2016 at 12:15 history asked Wjx CC BY-SA 3.0