rust-unofficial / too-many-lists

Learn Rust by writing Entirely Too Many linked lists
https://rust-unofficial.github.io/too-many-lists/
MIT License
3.24k stars 281 forks source link

images ... #59

Open kontrafiktion opened 8 years ago

kontrafiktion commented 8 years ago

Would you be interested in some images (boxes and lines) that might make some concepts/problems clearer. E.g. it took me quite a while to grok:

pub fn pop(&mut self) -> Option<i32> {
    match mem::replace(&mut self.head, Link::Empty) {
        Link::Empty => None,
        Link::More(node) => {
            self.head = node.next;
            Some(node.elem)
        }
    }
}

So I created pop_move2 2

If you are interested, I would create some more. For the one above, I have used draw.io, so it should be possible to edit them collaboratively, or do you know a better tool?

Manishearth commented 8 years ago

Yes, such images would be nice to have!

Generally I use graphviz or LaTeX for this, so that the source can be committed in-tree as well.

kontrafiktion commented 8 years ago

The source of draw.io files can be committed (but is unreadable). I wouldn't know how to create nice/clear layouts graphviz and I wouldn't even want to start using LaTeX. Alternatively, I could offer UniCode Images like this (using MonoDraw):

┌─────────────────────┐         ┌─────────────────────┐
│        Node         │         │        Node         │
│        next:◆───────┼────────▷│        next:        │
│      elem: 31       │         │      elem: 31       │
└─────────────────────┘         └─────────────────────┘

but they are (visually) max bigger less nice than a SVG/PNG created with draw.io

kontrafiktion commented 8 years ago

ah, and no colors :-(

Manishearth commented 8 years ago

draw.io is fine then

kontrafiktion commented 8 years ago

rustbook does not seem to support images. I just created a simple Makefile that invokes rustbook and copies to the "book" folder.

You can find the current work in progress here: https://github.com/kontrafiktion/too-many-lists/tree/some-images

btw: To be able to build on my machine (OS X) with rustup/multirust, I have to invoke rustbook like this:

DYLD_LIBRARY_PATH=${HOME}/.multirust/toolchains/nightly-x86_64-apple-darwin/lib rustbook
Manishearth commented 8 years ago

I'm surprised it doesn't handle images, we should add support for that. cc @steveklabnik @GuillaumeGomez

steveklabnik commented 8 years ago

Rustbook is going to die off sometime, you should port this to mdbook instead, IMHO. It's what I'm using for the next version of the book, and plan on porting all the other in-tree books over when that ships.

"Port" shouldn't be too tough, they're very similar. Just try to run it on this source, I bet it'll Just Work

On Oct 15, 2016, 23:52 -0400, Manish Goregaokar notifications@github.com, wrote:

I'm surprised it doesn't handle images, we should add support for that. cc @steveklabnik (https://github.com/steveklabnik) @GuillaumeGomez (https://github.com/GuillaumeGomez)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub (https://github.com/rust-unofficial/too-many-lists/issues/59#issuecomment-254025829), or mute the thread (https://github.com/notifications/unsubscribe-auth/AABsis0Cxuv_BgQfqQuTpw68ozZHkVWeks5q0Z-VgaJpZM4KXAC1).

kontrafiktion commented 8 years ago

I created an experimental branch (https://github.com/kontrafiktion/too-many-lists/tree/mdbook-migration) that contains a preliminary migration.

If you want to do the migration again, here is the list of things I did:

1) replace the "%" in the first line of each document by a "#" 2) move all the files to a directory "src" 3) create a book.json file with the title etc. 4) add README.md to the SUMMARY.md

the only "issue" I found: mdbook does not support meta "title" information per page. It will use the "title" from the book.json.

To simplify a future the real migration I created a very simple script "convert-2-mdbook" The only thing I did by hand was the addition of README.md to SUMMARY.md

lgtm

edunham commented 8 years ago

save for https://github.com/rust-unofficial/too-many-lists/issues/64, we are now on mdbook.