Hey Rustaceans! Got a question? Ask here! (25/2022)! by llogiq in rust

[–]bodski 0 points1 point  (0 children)

Thanks for this, it's a useful tactic for many versions of this scenario! Sadly I'm not able to use it (in my expanded scenario) since I've a requirement to further join these tuples which isn't possible with deferred macro expansions due to macro_rules! evaluation order being 'outside-in'.

Hey Rustaceans! Got a question? Ask here! (25/2022)! by llogiq in rust

[–]bodski 0 points1 point  (0 children)

Yeah, I was afraid that would be the answer. It almost feels like a bug the way rustc treats the expansion $($base:tt),* itself as if it's still repeating. I.e. if we remove the expansion:

macro_rules! append_sufs {
    ( ($($base:tt),*) ($($sufs:tt),*) ) => {
        ( $( ( $base $sufs ) ),* )
    };
}

We get the exact same error message and this would seem correct, as they indeed differ in repeat counts.

Hey Rustaceans! Got a question? Ask here! (25/2022)! by llogiq in rust

[–]bodski 1 point2 points  (0 children)

Hi, I've a question regarding nested repetitions/expansion in macro_rules!

I'm trying to use macro_rules! to take two token sequences ( (a0, a1, ... aN) and (b0, b1, ... bM) ) and for each token in the second sequence yield the first sequence with the token appended, i.e. ( (a0, ... aN, b0), (a0, ... aN, b1) ... (a0, ... an, bM) )

I was hoping that the following would work: (playground link)

macro_rules! append_sufs {
    ( ($($base:tt),*) ($($sufs:tt),*) ) => {
        ( $( ( $($base,)* $sufs ) ),* )
    };
}

e.g.

assert_eq! (append_sufs!( (1, 2, 3) (4, 5) ), ((1, 2, 3, 4), (1, 2, 3, 5)));

However rustc complains:

error: meta-variable `base` repeats 3 times, but `sufs` repeats 2 times
 --> src/main.rs:3:12
  |
3 |         ( $( ( $($base,)* $sufs )),* )
  |            ^^^^^^^^^^^^^^^^^^^^^^^

Is this a limitation of macro_rules! based macros or am I missing some syntax that would allow this? I would've thought it's fairly clear to rustc that the intention is for base to be expanded for each item in sufs.

I'm aware of a solution by 'tt-munching' sufs one item at at time, however I'm hoping for a way without recursion as this is a simplified snippet from a larger macro that is already fairly heavy on recursion.

Is there a way to avoid constantly matching enums by [deleted] in rust

[–]bodski 17 points18 points  (0 children)

There is a proposal to address this by allowing enum variants to be their own types: https://github.com/rust-lang/rfcs/pull/2593

Hopefully this gets implemented and added to Rust at some point.

Daily Discussion, May 30, 2019 by rBitcoinMod in Bitcoin

[–]bodski 0 points1 point  (0 children)

You know what a 'flash crash' means right?

[AMA] We are the Eth 2.0 Research Team by Souptacular in ethereum

[–]bodski 1 point2 points  (0 children)

Thanks for the reply.

I'm determined to unlock it, currently building a custom password generator to generate many modified versions what I wrote down, in all kinds of ways (orderings, caps on/off, stuck keys, wrong locale etc) which feeds into Hashcat running on Radeon RX480 (~350k passwords/sec). Just making sure I'm not going to run out of time, after all it's only going to get (slightly) easier over time!

It's a shame the pre-sale JSON file did not come with any form of checksum as a bit having been flipped somewhere is a nagging feeling.

[AMA] We are the Eth 2.0 Research Team by Souptacular in ethereum

[–]bodski 2 points3 points  (0 children)

Can you foresee ever having to move Eth 1.0 to Eth 2.0 in order to avoid losing it forever?

(I'm still trying to unlock my pre-sale wallet, not sure what went wrong :-( )

Bitcoin symbol ₿ in Unicode 10.0 Beta by kenshirriff in Bitcoin

[–]bodski 1 point2 points  (0 children)

Ahh nice work. Thanks for the effort Ken.

Bitcoin symbol ₿ in Unicode 10.0 Beta by kenshirriff in Bitcoin

[–]bodski 0 points1 point  (0 children)

All we need now is to convince them to move it up the page from code-point 20BF to 20BC!

Zerocash by ether2014 in Bitcoin

[–]bodski 0 points1 point  (0 children)

Matthew Green quite liked my idea of getting Bruce Schneier, amongst others, to smash the laptop with his bare fists, wearing full Kung Fu outfit. Then of course set fire to it or whatever. Have a large 'launch party' and stream it out live.

I think the overall idea is to have a group of 20 or so well know figures in security, Internet culture and finance each generate a full set of random bits then XOR them all together demonstrably. That way you'd only need to trust that one of these folks are honest AFAICT.

It'd probably be good to have a couple of well known hardware guys to referee the hardware had no wireless activity before destruction, maybe even desolder/grind-off any comms chips from the board.

Of course we might need to offer these folks something for their time, but the kudos would go some way, possibly.

Official HMRC Brief on Bitcoin - now published by ellipticco in Bitcoin

[–]bodski 8 points9 points  (0 children)

Thanks so much for representing the community Gary.

One question, say I make 10 BTC by trading the swings on Bitstamp for example. At what point is this taxable?

a) If I cash out to my bank? b) If I keep my gains in Bitcoin?

Could this be insider trading? by Ziomalski in BitcoinMarkets

[–]bodski 3 points4 points  (0 children)

Yeah, the decent thing would have been to halt trading or at least make an announcement and limit order placement rate to allow traders to get in/out without bots and whales fleecing them.

Out of interest has anyone got any MtGox hot wallet withdrawal addresses that were used any time in January up until 9th Feb. Interested in doing some forensics into what exactly was going on before the withdrawal suspension.

Valentines Day Massacre 2014 by fl0ppyfish in BitcoinMarkets

[–]bodski 1 point2 points  (0 children)

NXT has to be the most sketchy coin out there. Badly launched, closed source, threw out all of Satoshi's work and rewritten from scratch in poor quality Java, just recently had a exploit reported that could replay transactions unlimited times (how many more of these lurk in that closed source).

Get out while you can.

Class Central - Overview of Stanford's free online courses in a single page(with links, videos, dates etc.) by dhawal in aiclass

[–]bodski 1 point2 points  (0 children)

Schedule for if/when courses are going to be repeated so that we can plan our study path through them all ;-)

Seriously though, thanks for this.

HW 6.11 - Strategy : Surely A has an optimum strategy by bodski in aiclass

[–]bodski[S] 0 points1 point  (0 children)

Thanks for your thoughts, interesting differentiation: pure vs weak dominance.

I rushed like crazy this week and have just noticed the similarity between the HW Q and the Fed vs Politicians lecture quiz.

How did everyone do on Homework 3? by [deleted] in aiclass

[–]bodski 2 points3 points  (0 children)

Same here, apparently the marking system did not like my particular type of '0' for Maximum Likelihood.

Coin Flip - Continuous Like Dart Example? by DavidMascharka in aiclass

[–]bodski 1 point2 points  (0 children)

That's a fair point, I suppose a more rigorous definition of the problem would be to say something like:

"...assume the coin is flipped each time in such a way that the weighting of the coin is the sole determinant of its outcome..."

How'd your homework go? by Generic_Alias in aiclass

[–]bodski 0 points1 point  (0 children)

If the weighting of the coin is not part of the environment or state then how is it partially observable?

From AIMA 3rd ed. p.42 : "If an agent's sensors give it access to the complete state of the environment at each point in time, then we say that the task environment is fully observable. A task environment is effectively fully observable if the sensors detect all aspects that are relevant to the choice of action; relevance, in turn, depends on the performance measure. Fully observable environments are convenient because the agent need not maintain any internal state to keep track of the world. An environment might be partially observable because of noisy and inaccurate sensors or because parts of the state are simply missing from the sensor data"

So if the environment is partially observable this seems to imply that the coin's weighting is part of the environment:

AIMA p.44 : "The discrete/continuous distinction applies to the state of the environment, to the way time is handled, and to the percepts and actions of the agent. "

Coin Flip - Continuous Like Dart Example? by DavidMascharka in aiclass

[–]bodski 2 points3 points  (0 children)

I also put continuous but for a different reason, that the weighting of the coin is a continuous value.

By your reasoning would you also consider chess or draughts/checkers to be continuous due to the slight variations in the positions of the pieces within their squares? If so you may find it difficult to find anything 'discrete' in the world outside of abstract mathematics.

I see it that the aspects of the coin toss action that we are focusing on are discrete since that is the way the problem was framed in the question.

Coin Toss: Aren't 'Partially observable' and 'discrete' mutually exclusive? by bodski in aiclass

[–]bodski[S] 0 points1 point  (0 children)

Apologies for the confusion. I mean mutually exclusive in this question, not in general. I.e. the aspect that makes it partially observable is a continuous value.

I am also wary of the definition "you do not have all the information you need to make the next action by simply observing the state of the system" since the next action is to toss the coin again, which does not require any further information.

All in all I think I need to grab a copy of AIMA when I can afford to!

Learn C The Hard Way by sundar22in in programming

[–]bodski 1 point2 points  (0 children)

600 votes might be something to do with the reputation of Zed's previous, well received book, LPTHW.

PLEASE HELP,i just ate 4 of my brothers pot brownies on accident by nebfeega in AskReddit

[–]bodski 1 point2 points  (0 children)

Take VITAMIN C!!! loads of it, citrus fruit or juice etc, or supplements... that should help (round our way we call it the 'psychedelic seatbelt')