Data update

This commit is contained in:
Ingy döt Net 2025-08-11 18:05:26 -07:00
parent 4d5544505c
commit 4924dd0264
3073 changed files with 55820 additions and 4408 deletions

View file

@ -0,0 +1,9 @@
(import random)
(let printer (fun (val) {
(sys:sleep (mod (random) 1000))
(print val) }))
(async printer "Enjoy")
(async printer "Rosetta")
(async printer "Code")

View file

@ -0,0 +1,15 @@
use tokio::task::JoinSet;
#[tokio::main]
async fn main() {
let words = vec!["Enjoy", "Rosetta", "Code"];
let mut set = JoinSet::new();
for word in words {
set.spawn(async move {
println!("{}", word);
});
}
set.join_all().await;
}

View file

@ -0,0 +1,26 @@
use tokio::{sync::mpsc, task::JoinSet};
#[tokio::main]
async fn main() {
let words = vec!["Enjoy", "Rosetta", "Code"];
let mut set = JoinSet::new();
let (tx, mut rx) = mpsc::channel(words.len());
for word in words {
let tx = tx.clone();
set.spawn(async move {
tx.send(word).await.unwrap();
});
}
drop(tx);
tokio::spawn(async move {
set.join_all().await;
});
while let Some(word) = rx.recv().await {
println!("{}", word);
}
}