Old thread: What are you working on, Jow Forums?
/dpt/ - Daily Programming Thread
Other urls found in this thread:
youtube.com
docs.microsoft.com
en.wikipedia.org
repl.it
reddit.com
twitter.com
enterprise java
Anime girls and C#
so what's the consensus? dork or no?
How do I get this function to return the value?
(defn random-between
"Out put a random number between -theta and +theta"
[]
(let [theta 1.83948]
(- (* rand 2 theta) (theta))))
If I move the actual calculation at the end of the function then the variable theta isn't available.
let me go back to Haskell please
error[E0599]: no method named `send_all` found for type `futures::stream::map::Map` in the current scope
--> src/main.rs:17:28
|
17 | stream.send_all(sink)
| ^^^^^^^^
|
= note: the method `send_all` exists but the following trait bounds were not satisfied:
`&mut futures::stream::map::Map : futures::sink::Sink`
`futures::stream::map::Map : futures::sink::Sink`
FUCK anime girls (metaphorically)
that is the error when the sink/stream are switched:
use tokio::prelude::*;
use tokio::net::TcpListener;
use tokio::codec::{Decoder,LinesCodec};
fn main() {
let addr = "127.0.0.1:3000".parse().expect("err parse addr");
let listener = TcpListener::bind(&addr).expect("err bind listener");
let future = listener
.incoming()
.for_each(|socket| {
let lines_codec = LinesCodec::new();
let (sink, stream) = lines_codec.framed(socket).split();
sink
.send(String::from("Echo server"))
.and_then(|sink| {
let stream =stream.map(|x| format!("ECHO: {}", x));
sink.send_all(stream)
.map(|_| println!("Connection closed"))
})
})
.map_err(|e| eprintln!("Error: {:?}", e));
tokio::run(future)
}
>rand
>(theta)
I think you got those mixed up, you're calling a variable and not calling your function.
That's a nice looking JavaScript project, user. I like it!