Skip to content

Instantly share code, notes, and snippets.

@porterjamesj
Created August 22, 2016 18:33
Show Gist options
  • Save porterjamesj/fbf4387ce6a6951196349225a881c274 to your computer and use it in GitHub Desktop.
Save porterjamesj/fbf4387ce6a6951196349225a881c274 to your computer and use it in GitHub Desktop.
i feel like all of those things are intended to be used in larger programs
so like, you could fit them into a smaller algorithm problem, but they
yeah?
so like, read the bit on transducers, and then implement one that
does a caeser cipher
and then getting more ambitious you could do stuff like more
complex encryption, or compression, or whatever
some compression algorithms can work on streams!
gzip can work on streaming data
i actually implemented such a thing at my last job :)
we have to stream really big files (like 100s of GB, way too big to fit in memory) and compress them on the fly through our webapp
it was pretty fun :)
bioinformatic data
basically genome sequences
we stored them uncompressed, but wanted to be able to serve them
to users compressed on uncompressed depending what they wanted
so, maybe lets read the part on transducers from the clojure docs and see what we can do?
it depends, but i'd say so
usually if there's documentation on something i will read it, not completedly, but just enough
to get off the ground implementing something
and then just go start working on it and refer back to the doumentation if i get stuck
the thing i'm trying to learn right now there's little documentation so i'm doing a lot of reading the source code
of things to figure out how they work instead
9p, its a network filesystem protocol from plan9, the operating system that the bell labs people designed to be like
the "next unix". it never really took off, but it had a lot of cool ideas, one of which was this protocol
a lot of the people who worked on plan9 now work on Go (the language) and so there's a lot of libraries etc
in the Go worled for doing plan9 styff
ive been curious about it for a while so i'm trying to learn about the protocol and write a small server that uses it
nothign really, it's just a hell of a lot simpler than modern alternatives
like the other thing i could use would be FUSE, but FUSE isn't really a network protocol so much as it is a kernel extensoin API? like a FUSE filesystem is represented as a shared library with a bunch of C functions that the kernel loads in and calls
which is fine, but FUSE is also really complicated, theres like 30 different functions at least in the interface?
9p is cool because it's explicitly a network protocol, clients and servers can be written in whatever langauge you wanted
it makes the idea of mounting filesystems that exist on the network rather than your own machine a first class thing
which is pretty cool, and was sort of one of the main ideas of plan9
they thought of it as like a "distributed operating system", part
of the theme was accessing remote resources in the same wa you
access local resources (by mounting them into your filesystem
tree, which you could do, since everything just exposed itself as
a 9p server)
im using go just because theres tools around it, but ive read the source code for python and c implenetations to learn about whats going on more
its been pretty fun :)
but anyway, transucse4r?
my impression is that they might be a slightly higher level of abstraction that we need to write a caeser cipher
but lets keep reading and see
hmmm interesting, i feel like a caeser cipher transducer would just be
(map (caeser 3))
where caeser is a function that takes a number and returns a function that
rotates a character that number of places in the alphabet
maybe?
lets try it :)
i mean lets see if it works first
i dont really have much of a working clojure setup, so lets use your machien
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment