Skip to content

Commit 2782b01

Browse files
authored
Merge pull request #2 from cym13/update
Update
2 parents 07c16f0 + d7b7e71 commit 2782b01

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

source/markov/chain.d

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,10 @@ public:
190190
foreach(ref state; _states)
191191
{
192192
T current = state.random;
193-
if(current) return push(current), current;
193+
if(current) {
194+
push(current);
195+
return current;
196+
}
194197
}
195198

196199
return null;
@@ -265,7 +268,10 @@ public:
265268
foreach(ref state; _states.values.sort!"a.size > b.size")
266269
{
267270
T current = state.select(_history[$ - state.size .. $]);
268-
if(current) return push(current), current;
271+
if(current) {
272+
push(current);
273+
return current;
274+
}
269275
}
270276
}
271277

source/markov/counter.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ private:
3535
/++
3636
+ Returns the hash for a token.
3737
++/
38-
hash_t toHash() const
38+
hash_t toHash() const nothrow @safe
3939
{
4040
static if(__traits(compiles, {
4141
T key = void;
@@ -46,7 +46,7 @@ private:
4646
}
4747
else
4848
{
49-
return hashOf(_key);
49+
return typeid(T).getHash(&_key);
5050
}
5151
}
5252

source/markov/json/encoder.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public:
2828
{
2929
JSONValue states = chain.states.map!(s => encodeState(s)).array;
3030

31-
return toJSON(&states, _pretty);
31+
return toJSON(states, _pretty);
3232
}
3333

3434
private:

0 commit comments

Comments
 (0)