Skip to content

Instantly share code, notes, and snippets.

@ncweinhold
ncweinhold / script.scm
Created March 23, 2014 15:07
Example of calling Guile scheme code from C. The scheme code can be modified without recompiling the C code.
(define simple-func
(lambda ()
(display "Script called, now I can change this") (newline)))
(define quick-test
(lambda ()
(display "Adding another function, can modify without recompilation")
(newline)
(adding-without-recompilation)))
@glebm
glebm / topsort.cpp
Created August 23, 2019 11:28
topsort c++
struct TopSortResult {
bool ok;
// If `ok`, contains the topologically sorted node indices.
// Otherwise, contains indices of a detected cycle.
std::vector<std::size_t> nodes;
};
// Topologically sorts dependencies.
TopSortResult topsort(const std::vector<std::vector<int>> &edges) {