<commit_before>//! An asynchronous fibonacci sequence generator.

#[macro_use]
extern crate crossbeam_channel as channel;

use std::thread;
use crossbeam_channel::{bounded, Receiver, Sender};

fn fibonacci(fib: Sender<u64>, quit: Receiver<()>) {
    let (mut x, mut y) = (0, 1);
    loop {
        select! {
            send(fib, x) -> _ => {
                let tmp = x;
                x = y;
                y = tmp + y;
            }
            recv(quit) -> _ => {
                println!("quit");
                return;
            }
        }
    }
}

fn main() {
    let (fib_s, fib_r) = bounded(0);
    let (quit_s, quit_r) = bounded(0);

    thread::spawn(move || {
        for _ in 0..10 {
            println!("{}", fib_r.recv().unwrap());
        }
        quit_s.send(()).unwrap();
    });

    fibonacci(fib_s, quit_r);
}<commit_msg>Remove the quit channel<commit_after>//! An asynchronous fibonacci sequence generator.

#[macro_use]
extern crate crossbeam_channel;

use std::thread;
use crossbeam_channel::{bounded, Sender};

fn fibonacci(sender: Sender<u64>) {
    let (mut x, mut y) = (0, 1);
    loop {
        select! {
            send(sender, x) -> res => match res {
                Err(_) => return,
                Ok(()) => {
                    let tmp = x;
                    x = y;
                    y = tmp + y;
                }
            }
        }
    }
}

fn main() {
    let (s, r) = bounded(0);

    thread::spawn(move || {
        for num in r.iter().take(20) {
            println!("{}", num);
        }
        drop(r);
    });

    fibonacci(s);
}
{'fraction_non_alphanumeric': 0.15601503759398497, 'fraction_numerical': 0.010025062656641603, 'mean_word_length': 1.51496062992126, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4586663', 'n_tokens_mistral': 559, 'n_tokens_neox': 517, 'n_words': 125}