Skip to main content
16 events
when toggle format what by license comment
Feb 7, 2014 at 21:14 comment added Steve D Rojo, sorry I missed this chat invitation. Any way we could continue our discussion at some point? I would really like to be able to work this out.
Jan 27, 2014 at 5:24 comment added Rojo let us continue this discussion in chat
Jan 27, 2014 at 5:24 comment added Steve D But then how would one use this mechanism to store something in the notebook from within a function? So that it is accessible from outside the function?
Jan 27, 2014 at 5:23 comment added Rojo @SteveD, GetFromNotebook[name] doesn't make sense if it's outside the function as you pasted
Jan 27, 2014 at 5:20 comment added Steve D Yes, the function only does one thing (I am trying to keep it simple): it is passed a name, and tries to store that name in the notebook. For example, name="test";StoreInNotebook[name];GetFromNotebook[name] works just fine. It is the fact that StoreInNotebook is called from inside a function that is the problem I can't fix.
Jan 27, 2014 at 4:53 comment added Rojo @SteveD doesn't StoreInNotebook receive symbols and not strings? Furthermore, without a parenthesis there, your function ends at StoreInNotebook[name].
Jan 27, 2014 at 3:50 comment added Steve D The following (after your code above) shows the problem: func[name_String] := StoreInNotebook[name]; func["test"]; GetFromNotebook[name] The reason I asked is because I have a function that is passed someone's name, and I would like to store that name in the notebook; I then later would like to recover the name.
Jan 27, 2014 at 3:33 comment added Rojo @SteveD can you create some short reproducible example?
Jan 27, 2014 at 3:29 comment added Steve D This is so useful, but I have a problem with using it inside a function call: namely, if I use StoreInNotebook within a function, then try to call GetFromNotebook later on, I get the error Uncompress::string: String expected at position 1 in Uncompress[Inherited]. Any thoughts?
May 23, 2012 at 19:30 comment added celtschk Thank you for sharing this method; I've now written a new version of PermanentSet which uses this method to store the values (see my answer).
May 23, 2012 at 18:38 history edited Rojo CC BY-SA 3.0
deleted 4 characters in body
May 23, 2012 at 18:36 comment added Leonid Shifrin Nothing else comes to mind. Interestingly, you did it exactly the way I had in mind, particularly I also would use the symbol cv, and make it depend on a parameter, not to explicitly break the scoping (even though the rules act earlier than bindings, so this does not matter here). Also, With[{cv:=...} (which breaks the scoping) won't likely work here without using SetDelayed@@Hold[...] for definitions, due to renamings performed by With.
May 23, 2012 at 18:31 comment added Rojo @LeonidShifrin, I just edited. Any other tips?
May 23, 2012 at 18:31 history edited Rojo CC BY-SA 3.0
deleted 4 characters in body
May 23, 2012 at 18:18 comment added Leonid Shifrin Good stuff - +1. A stylistic comment: you could significantly reduce code duplication by generating part of that at definition - time with, e.g., replacement rules.
May 23, 2012 at 18:04 history answered Rojo CC BY-SA 3.0