Reputation
65,433
Next tag badge:
207/100 score
19/20 answers
Badges
6 194 285
Newest
 Nice Answer
Impact
~407k people reached

Feb
8
comment Interrupting package evaluation, handling error
@rcollyer Finally, for certain languages (such as Scheme) which support continuations, there is a resume mechanism. Even in Java, I suspect this is still possible if one really wants, since one can access the execution stack via reflection (although I personally did not use this much).
Feb
8
comment Interrupting package evaluation, handling error
@rcollyer In other words, most important is the right separation between different modules, and loose coupling. Besides, the developers of a given module have to make sure that they do all the clean-up work so that exceptions they throw don't leave their module in some invalid state. There is a big debate which exceptions must be checked (compile-time) and which must be run-time, here there are different opinions. I personally think that checked exceptions are good because this is documented in method's signatures, although some exceptions should be run-time.
Feb
8
comment Interrupting package evaluation, handling error
@rcollyer Well, when I was dealing with exceptions during my work in industry with Java (a typical project would be more than a thousand classes), the standard way is to subclass exceptions to have specific exception types for various error cases. Those exceptions are just thrown from whichever function encounters the error, without any additional wrappers - there is no need for them. What is really important is modular design and right API design, and specific exceptions which can be thrown by various methods are part of the API specs. What you do with the error is application-specific.
Feb
8
revised Interrupting package evaluation, handling error
added 130 characters in body
Feb
8
answered Interrupting package evaluation, handling error
Feb
8
comment Retaining and reusing a one-to-one mapping from a sort
Well, I left that comment specifically for you to use it should you wish to do so. I posted another answer because it became clear that the OP wants SortBy-like behavior with a list of comparison functions, and it was more than just using Ordering.
Feb
8
awarded  Enlightened
Feb
8
comment Wavelets: Relative error vs compression ratio
+1. It's nice to see you here, Vivek!
Feb
8
comment Splicing a list of arguments into a function with Sequence
+1. The extent to which this can be called "bypassing" depends on whether or not SlotSequence (##) uses Sequence internally. One thing I am certain about is that both use the same underlying mechanism. In particular, Sequence @@ array can be also written as ##& @@ array (a form beloved by @Mr.Wizard). The discussion in comments below my answer to this question seems relevant here.
Feb
8
comment pointer like operations in mathematica and evaluation control
I think I've done something very similar to what you want in this answer
Feb
8
answered Retaining and reusing a one-to-one mapping from a sort
Feb
8
comment Retaining and reusing a one-to-one mapping from a sort
If I wanted to make this a separate answer, I would have done so at the start :). I think it would be better to start with order = Ordering@Ordering@ref, replacing the slower Position- based code, since people tend to pay more attention to things at the begining of the post. But this is up to you, of course.
Feb
8
comment Retaining and reusing a one-to-one mapping from a sort
Istvan, the way you compute order is really not efficient. Efficent way would be Ordering[Ordering[ref]], and that's all there is to it here, really (so you don't need your longer code using rules either) .
Feb
8
comment Retaining and reusing a one-to-one mapping from a sort
You most certainly can do this, just the ordering function would become more complex,and this can possibly degrade the efficiency. Another option is to construct a list with positions like Transpose[{lst,Range[Length[lst]]}],where lst is the original list, and use SortBy on this one, changing all your sorting functions as f-> First@f[#]&. Then, after a list is sorted, extract positions of elements of the original list in a sorted list as sorted[[All,2]].
Feb
8
comment Retaining and reusing a one-to-one mapping from a sort
Yes you can. Have a look at Ordering function.
Feb
8
awarded  Nice Answer
Feb
8
comment Splicing a list of arguments into a function with Sequence
@Guillochon This may be a good idea.
Feb
8
comment Splicing a list of arguments into a function with Sequence
@Guillochon Thanks for the accept, although you could have given it some more time - perhaps someone would come up with a better answer.
Feb
8
answered Splicing a list of arguments into a function with Sequence
Feb
8
revised Efficient code for tallying entries in very large lists
added 468 characters in body