« first day (2443 days earlier)      last day (2031 days later) » 

1:34 AM
@JasonB. how does one delete an ExpressionStore?
 
2:29 AM
I've managed to hit some odd bug in Mathematica...
li = Listener["a"];
li = {1};
li[[1]] = 2

Set::noval: Symbol DynamicListener`Private`listener$424146 in part assignment does not have an immediate value.

2

li["Variable"]

HoldPattern[DynamicListener`Private`listener$424146]

DynamicListener`Private`listener$424146

{1}

DynamicListener`Private`listener$424146 = {1};
DynamicListener`Private`listener$424146[[1]] = 2

2
I'm creating a listener object and wanted to attach part assignment to it but it seems Mathematica doesn't like how I'm doing it.
It seems as if it must be because the Symbol I'm binding to is stored in a Language`ExpressionStore
As this works and is effectively the same
Huh... I guess not...
myStore = Language`NewExpressionStore["varCache"];
addVar[key_, var_] :=
  myStore@"put"[$obj, key, HoldPattern[var]];
addVar~SetAttributes~HoldRest;
getVar[key_] :=
  ReleaseHold@myStore@"get"[$obj, key];
setVar[key_, val_] :=
  Replace[myStore@"get"[$obj, key],
   Verbatim[HoldPattern][v_] :>
    Set[v, val]
   ];
setVar~SetAttributes~HoldRest;
setVarPart[key_, part__, val_] :=
 Replace[myStore@"get"[$obj, key],
  Verbatim[HoldPattern][v_] :>
   Set[v[[part]], val]
  ]
setVarPart~SetAttributes~HoldRest;
Bizarre
 
2:48 AM
It also doesn't come out of the MutationHandler stuff I'm using...
varObjQ[s_Symbol] :=
  MatchQ[OwnValues[s], {_ :> varObj[_String]}];
varObjQ~SetAttributes~HoldFirst
varObjMutate~SetAttributes~HoldAllComplete
varObjMutate[Set[s_Symbol?varObjQ, val_]] := setVar[s["Name"], val]
varObjMutate[Set[s_Symbol?varObjQ[[part__]], val_]] :=
  setVarPart[s["Name"], part, val];
varObj /: Get@varObj[s_] := getVar[s];
varObj[s_]["Name"] := s;
Language`SetMutationHandler[varObj, varObjMutate];

addVar["v", myVar]

vv = varObj["v"];

vv // Get

myVar

vv = 2;

vv // Get

2

vv = {1}
I am very confused
Maybe Update isn't being called because the variable is only tracked in the ExpressionStore and so its apparent ref count is 0...
Wild
But powerful, if so.
Part 45 in this ongoing saga that is wasting all this chat space: it's even weirder than I thought (and sadly does not have to do with the ref counting)
{DynamicListener`Private`listener$445285[[1]] =
  2, DynamicListener`Private`listener$445285}

Set::noval: Symbol DynamicListener`Private`listener$445285 in part assignment does not have an immediate value.

{2, {1}}

DynamicListener`Private`listener$445285 = {1};
li[[1]] = 2

2
I'll stop wasting space for now and just come back when I've figured out what is happening...
Agh. Subtle but uninteresting. I'd accidentally done this:
HoldPattern[x] = {1}

{1}

x

{1}

x[[1]] = 2

Set::noval: Symbol x in part assignment does not have an immediate value.

2
 
3:42 AM
@b3m2a1 I believe you need to clear the contents, like store["remove"[First@#]] & /@ store["listTable"[]] - just clearing the variable store wouldn't clear the contents
 
@JasonB. Good to know. I'm currently doing a thing like that (found it in GeneralUtilities`ClearStore) but was assuming there'd be a simple destructor.
 
These are the only hooks I see for an expression store: {"get","getKeys","put","remove","containsQ","listTable"}
remove and containsQ can both take either just an expression or an expression-key pair
 
Oh interesting. I didn't know about "getKeys" and "containsQ". I should add them to this (unless you want to take credit for that answer and post it yourself).
 
4:01 AM
You should absolutely add it - also mention somewhere in the post that it's a weak hash map, as described here: stackoverflow.com/a/154771/4712538
as opposed to the normal undocumented HashTable, this is the super secret undocumented weak hash table
:-)
 
4:56 AM
@JasonB. what's the point of the first object (the primary key in some sense)?
 
5:43 AM
@Kuba have you ever hit this before:
 
6:30 AM
@b3m2a1 I've hit a recursion limit on FE side of Dynamics but I think the error was more pinky. And I don't remember "Unresolved.." frame at all.
 
That's what surprised me. I'd have expected it to have a bunch of error messages but it didn't have any.
 
@b3m2a1 let me know once you know the cause
 
Well it was a slightly odd thing where I had an object whose construction caused infinite recursion (I used System`Private`EntryQ instead of System`Private`HoldNoEntryQ).
And then I attached a MakeBoxes rule to one of these objects after it was constructed
And for unknown reasons after infinite recursion it still allowed my object to build
Actually I think it was a subtle thing but I can probably explain it.
In any case it was a whole chain of oddities building off my constructor being bad
And then formatting this object that threw infinite recursion upon evaluation.
 
@b3m2a1 ok.
 
@Kuba @JasonB. as part of making a listener system for some better Dynamic behavior I just created an object that's entirely backed by Language`ExpressionStore with some vetoable/inspectable value changes and things.
It's nice for its purpose, but I think as an academic exercise it's actually more interesting.
Like I bind values to it by attaching symbols with Temporary set
 
6:44 AM
@b3m2a1 hit us
 
And then provide access into them
I'll post about it in a bit. The code ended up being longer than expected.
 
Ok, looking forward to reading it.
 
But the basic idea is you have something like:
$cache = Language`NewExpressionStore["ObjectHandler"];
newObject[] :=
  Module[
   {
    obj = object[],
    value = Null
    },
   $cache@"put"[obj, "value", Hold[value]];
   obj
   ];
setValue[obj_, val_] :=
 Replace[$cache@"get"[obj, "value"],
  Hold[var_] :> Set[var, val]
  ]
And then that value exists only as long as obj is held by the user.
Then we use the MutationHandler system to provide an OOP layer on this.
One interesting thing is that we can imagine ditching value altogether, though
All attributes bound to obj could simply be foisted on the $cache
The reason for value was that it will be seen by Dynamic and tracked.
 
I must say I didn't grasp the idea of the `Store` yet. Or the use cases didn't occur to me yet.
Make sure to add comments once you post it :)
 
Will do. I discovered some fun things about them and some annoying ones as I went along.
 
 
1 hour later…
8:01 AM
@Kuba see the Implementation section here: mathematica.stackexchange.com/questions/182617/…
I describe things in words mostly as I was writing in a rush and trying mostly to give a sense of how/why this is interesting and/or novel but I can link back to chunks of my implementation to explain what I mean.
Admittedly I failed in my original purpose of reimplementing Dynamic using Internal`TrackExpression and friends
But I need to research more about how to get that working. I had some ideas a month or two back but I've forgotten them
 
8:18 AM
@b3m2a1 Will try to read it soon. Yeah I was thinking about too but each time I find limitations of the outcome or gaps in understanding that make me abandon it.
 
I think someday either WRI needs to implement a more targeted update system or someone around here needs to figure it out because the current state of Dynamic is... not great.
 
8:48 AM
@b3m2a1 while there are applications for such system I don't think it can be general enough without insight into FE.
 
@Kuba I'm not sure I entirely know what you mean by "insight into the FE"
 
Being able to implement features that are done front end side as opposed to only use vague set of FEPrivate, FrontEnd symbols.
 
Ah I see. You mean we need a much more robust FE in general :)
e.g. one where controlling a simple grid and getting it to update intelligently and resize nicely isn't a disaster
 
Indeed
To have control over FE side caching so that you can reshape layout without triggering dynamics again etc etc
For more complicated gui this stuff really enforces a coding style/limitation that seem to be ignored in basic tutorials
Btw, #dailyfun:

> The outer edge of the grid is taken to be at the midpoint of the outermost spacing on every side.

Except, the very outer spacing is ignored:

Framed@Grid[{{1, 1}}, Spacings -> 5]
 
:) GridBox is terrible
 
8:54 AM
I'm fine with deleting this line from Spacing docs details but then setting Spacings -> {Automatic, {{oddS, evenS}}} respects the outer one. That is the first one is evenS because the outer one is not rendered
So much fun
 
I spent a while reminding my self how Tk works and was getting a little bit wistful
I was able to write a full implementation of the Pokemon UI (for the old games from the '90s) in it
I wrote the code horribly inefficiently and it still crushed anything I could have tried to do in Mathematica
 
I get a depression each time I play with JS
 
You can create a grid in it where you specify which rows should resize, at what rate they resize, what they should resize in response to, etc.
If you see John Fultz at the WTC you should make a personal request that they include more primitive, less user friendly box forms in the FE. Tell him it's for your sanity.
I've been trying to think up things but I can't remember most of the old questions I had
If I think them up I'll let you know
 
Ok
 
Just imagine making this in Mathematica and not wanting to cry...
And this is, of course, the basic demo for GTK+
Not some fancy UI that someone probably took a week to get perfect
 
9:09 AM
@b3m2a1 and this is still a crude 90's style gui. People now are used to fancu web gui with interaction blendend with pretty graphics etc.
 
Yeah but I figure if we can become despondent over the little things, why not?
:)
 
I once tried to make InputField that is reshaped/resized on events. 1) lack of events 2) 15fps
 
Lol
Okay it's late and thinking about I should go to sleep before I impulse delete Mathematica off my machine
2
Goodnight all
 
@b3m2a1 see you
 
 
1 hour later…
10:44 AM
hi , I want your help to edit the following mathematica code . the code represent applying transnational operator on 3 balls setting in one site I want to edit it so I would have instead of 3 ball setting in one site , two balls setting in the same site and the third ball set in on the site next to the site of the two balls , the code is : With[{baseline = -2.5 {0, 1, 2, 3}, t = Range[-2, 2, 0.01]},
Module[{s}, s = Cos[2 Pi t];

Graphics[{Table[Line@Thread@{t, s + baseline[[k]]}, {k, 1, 4}]}]]]
 
11:44 AM
@b3m2a1 The first object, the expression, is important because whenever all other references to the expression are gone - if it isn't in the $History and not assigned to any variable and its reference count goes to zero - then anything cached on that expression is removed from the store.
 
12:26 PM
@maya this seems like a question for the main site rather than chat, but try to include more background information about the problem - what is transnational operator? And be specific about where you're having trouble -- just asking for help editing the code is not likely to get good answers
 
 
3 hours later…
4:08 PM
EstimatedProcess does a good job of guess HMM when the emission distribution in Guassian but it messes up of the order of elements in Markov matrix and order of emission distribution when it is Exponential distribution.. is there any reason why it's doing so or am I making some mistakes?
hmmEem = HiddenMarkovProcess[{0.3, 0.7}, {{0.5, 0.5}, {0.3, 0.7}},{ExponentialDistribution[2], ExponentialDistribution[4]}];
datae50 = RandomFunction[hmmEem, {0, 100}, 100]
`In[112]:= EstimatedProcess[datae50, HiddenMarkovProcess[2, ExponentialDistribution[\[Lambda]]]]`

`Out[112]= HiddenMarkovProcess[{1., 0.}, {{0.83304, 0.16696}, {0.548216,
0.451784}}, {ExponentialDistribution[3.68729],ExponentialDistribution[1.72329]}]`
 
4:58 PM
@b3m2a1 - I put the basic use case for an ExpressionStore in here, have a look: NotebookPut@Import["https://pastebin.com/raw/ddkHGJxb", "NB"]
@Szabolcs - it may be of interest to you as well, I used your IGraphM package as an example
 
5:44 PM
@JasonB. A simpler way to count objects is Length[IGraphM`LTemplate`LExpressionList["IG"]] (i.e. this is built in)
 
I assumed there was a builtin function, but didn't see it immediately, thanks
I was going to use TriangleLink as an example, but I'm not familiar enough with the code in that paclet.
Probably for your case, creating an "IG" library object isn't so expensive that you want to cache them, but if you wanted to, the ExpressionStore is good for this
 
6:33 PM
@JasonB. Thanks for all the tips. Do you know if you can poke Taliesin (or whoever did this) to add a "tableKeys" method? That would allow a much nicer way to clear all the table data without loading the entire table first.
Oh this is interesting but in retrospect unsurprising. Function constructs some form for itself internally:
hf = HoldComplete[Function[Null, #, HoldFirst]];
System`Private`HoldValidQ @@ hf

False

System`Private`ValidQ @@ hf

True
 
6:56 PM
@b3m2a1 The original developer isn't really working on that code any more (it was never meant to be user code). I added a "clearTable"[] method, but it's just in a branch, haven't tried to merge it. In my applications deleting the library objects takes most time, overhead from mapping over the list isn't that large - and also I'm not clearing the cache that often.
 
@JasonB. I'm having some fun using this as an OOP backend which is where that'd be really nice to have. It'd just give a quick way to access my object.
 
 
2 hours later…
9:34 PM
For those interested here's a Mathematica object system that cleans itself up nicely and is backed by an ExpressionStore: github.com/b3m2a1/mathematica-tools/blob/master/…
 
 
2 hours later…
11:36 PM
@Szabolcs from the end of that stream it sounds like there's a Graph meeting that they're planning to stream.
Tomorrow
Thought you might be interested in case you want to add your few cents in a more live fashion
 

« first day (2443 days earlier)      last day (2031 days later) »