Post 2698251 by hierarchon@cybre.space
(DIR) More posts by hierarchon@cybre.space
(DIR) Post #2697890 by hierarchon@cybre.space
2019-01-06T09:14:00Z
0 likes, 1 repeats
do you ever do something terrible, just to see if you couldhttps://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=207331a01c3d9d172cb882b283e7c3cf
(DIR) Post #2698251 by hierarchon@cybre.space
2019-01-06T09:26:50Z
0 likes, 0 repeats
i tried making a version that stores the results of (self.f)(k) in an internal Vec but you run into mutability/lifetime issues and i don't think it's possible without UnsafeCell or something like it :(
(DIR) Post #2738580 by nleigh@cybre.space
2019-01-07T15:45:12Z
0 likes, 0 repeats
@hierarchon I've never written a line of rust and I'm trying to understand this. Is it an obtuse way of determining if a number is even or odd by overloading the methods of a data structure? Are pointers involved?
(DIR) Post #2743132 by hierarchon@cybre.space
2019-01-07T18:50:03Z
0 likes, 0 repeats
@nleigh Rust lets you define what it means for a data type to be indexed like `foo[bar]`, so I'm constructing a new data type that just wraps a function and invoking that function to 'index' into it.