# Ticket #974: h.scm

File h.scm, 698 bytes (added by , 10 years ago) |
---|

Line | |
---|---|

1 | (use srfi-69) |

2 | |

3 | (define NODES 250000) |

4 | (define EDGES 1000) |

5 | |

6 | (define graph (make-hash-table)) |

7 | |

8 | (define (insert-edges) |

9 | (printf "~N Hash-tables - Inserting edges ~N") |

10 | (do ((n 1 (+ n 1))) ((= n NODES)) |

11 | (if (= (remainder n 5000) 0) |

12 | (printf " ~S nodes inserted ~N" n)) |

13 | (do ((e 2 (+ e 1))) ((= e (+ 1 EDGES))) |

14 | (hash-table-update!/default graph |

15 | n |

16 | (lambda (edges-list) |

17 | (if (member e edges-list) |

18 | edges-list |

19 | (cons e edges-list))) |

20 | (list e))))) |

21 | |

22 | (time (insert-edges)) |