Reputation
Next tag badge:
215/100 score
20/20 answers
Badges
7 212 301
Impact
~449k people reached

2d
answered How to specify that Quiet should silence foo::shdw messages for ANY symbol foo?
2d
comment How to specify that Quiet should silence foo::shdw messages for ANY symbol foo?
Can't you just avoid the shadowing? The shadowing issues typically indicate the problems with design of the code, and can be avoided. OTOH, these problems, if not taken care of, can lead to pretty nasty surprises, so I'd hesitate to just silence them.
2d
comment Splitting a list into increasing sublists
@ciao As much as I'd like to solve this puzzle, I can't afford taking any more time from other things I need to take care of, at the moment. I did actually look at the accumulated original list before asking you, but I guess my pattern-recognition skills got seriously worse in the few last years. But the one thing that really stopped me from looking in that direction initially was that we can't exclude negative elements in the list, in which case accumulated list will not be necessarily sorted, and so binary search can't be used. But I see the direction of thought.
2d
comment Splitting a list into increasing sublists
@ciao You got me intrigued - how would you apply a binary search to this problem?
2d
comment Splitting a list into increasing sublists
@ciao This is not an error per se. The initial value of the sum, which the sum of elements in the first sublist of the result must be larger than, has not been specified by the OP. I took it to be zero. In this interpretation, the answer is right. Alternatative interpretation is that it it e.g. -Infinity (or, simply, any number smaller than the first element). The problem is simply underspecified in this respect.
2d
comment No names when loading package
Ok, I missed the point. Given that you work within nb, link given by @ilian is most relevant. But, is there any reason you don't just use any text editor to save this contents to a file? It seems a much simpler way to me.
2d
comment No names when loading package
So, does the correct command give you the function names all right?
2d
comment No names when loading package
You quoted Names["SOPackages`*"], while it should've been Names["SOPackage`*"]. Could it be just a simple typo?
2d
comment Large lists to manipulate later in chunks
@martin Sure. It may get closed by then, though, and if it does, it will be best to completely reformulate the question and ask it again. Alternatively, you may ping the closers or mods, or anyone in chat, and ask to reopen the original question. Even if it does not get closed, it might be better to delete it and ask a fresh one. The advantage of asking a new question is that new questions attract more attention - it is hard to get attention to an update to the old question, typically. Just make sure that the new version is better formulated.
2d
comment Splitting a list into increasing sublists
@ciao One guess would be that, for integers, the list of 4 elements produced at each iteration of Fold, can still be packed, and is packed since Fold auto-compiles. For reals, the list contains 2 integers and 2 reals, and so can't be packed. Not sure if I am right, but I can't see any better explanation at the moment. One thing that kind of confirms my guess is that if you use N@{0, 0, 0, 0} as a starting value in FoldList, instead of {0, 0, 0, 0}, then the performance on integers also degrades just like it does for reals.
2d
comment Splitting a list into increasing sublists
@PatrickStevens Yes, you are right. You pick a symbol which becomes the head of the linked list "cons cell", and in case when you work with several linked lists at the same time, you will indeed generally have to pick different symbols for them. In practice, however, it is pretty rare to have more than two linked lists interacting with each other at the same time.
2d
comment Splitting a list into increasing sublists
@ciao Thanks. It does work with negative numbers, for me. Can you provide an example where it fails for you? Re: slowdown - indeed. Probably related to the auto-compilation, although I still don't understand why - by default the arguments of compiled function are anyway reals.
2d
comment Large lists to manipulate later in chunks
@m_goldberg I disagree with the particular reason you mentioned - the Streaming module I mentioned in my comment above allows one to define lazy lists, which have not yet been materialized until the data has been actually requested. This doesn't therefore require more RAM. It is not a documented functionality, but it at least may be used to solve the problem. But I do agree that the current formulation of the question isn't very meaningful, because it is not clear what is meant to be done with the data.
Aug
29
comment Splitting a list into increasing sublists
@Xavier Thanks. Glad you liked it. You can search the site for dynP function of Mr.Wizard, which has comparable performance to Internal`PartitionRagged, while being implemented purely in top-level code.
Aug
29
comment Splitting a list into increasing sublists
Voted it up without testing, but I guess target should be list?
Aug
28
answered Splitting a list into increasing sublists
Aug
28
comment Splitting a list into increasing sublists
I have explained in a linked post, what to do when your elements are themselves lists - section named "Generalized linked lists". You have to use a symbolic container like ll (or any other symbol) instead of List, and then use Flatten with 3 args. I am a bit surprised that you didn't see that, given that you provided a link to that post. In any case, linked lists were the first thing that also came to my mind when I read the question.
Aug
28
comment Large lists to manipulate later in chunks
The chunked list functionality already exists in Streaming module, which hasn't been yet documented / officially added to the system, though. But the meaningful answer strongly depends on what you plan to do with the data.
Aug
27
comment Can a Trie be implemented efficiently?
@belisarius Thanks for the info. I upvoted. Looks to be indeed comparatively one of the cleanest and shortest solutions. The {} -> {} part of my code is rather arbitrary, and partly was dictated by the need of this terminal element to be an (idle) rule - which was only necessary in the original code that used lists of rules. The code using Associations can use some more easy-to-understand expression for a terminal element.
Aug
26
comment Change Notebook's Default Context
You can make an input cell with the CellContext being MyPackage`Private` . Then you can use short names for private functions in that cell. You can automate creation of such cells with a palette or e.g. docked cell in your particular notebook.