4 ms·
I find the description confusing: "snek is a simple data structure for working with vertices and edges" If I hear data structure lisp code is not on my mind, s
by kowdermeister 9y ago
I find the description confusing: "snek is a simple data structure for working with vertices and edges"
If I hear data structure lisp code is not on my mind, so it's rather an API or a drawing library?
What am I manipulating exactly?
; context start
(with-snek (snk)
What's in `snk`? Sorry, I never used lisp before
Do you plan to write an API documentation?
- inconvergent 9y agoyou manipulate a data structure that contains vertices and edges. there is more about it here http://inconvergent.net/snek-is-not-an-acronym/ http://inconvergent.net/snek-is-not-an-acronym/. snk is an instance of snek, so it contains a realisation of the structure and its current state.
- pje 9y agoso...snk is a graph?
- inconvergent 9y agoyes, it is.
- Retra 9y agoMost data structures are graphs. This one just happens to be "self-aware" enough to use graph terminology.
- aerique 9y agoIf I hear data structure lisp code is not on my mind, so it's rather an API or a drawing library? Most Lisps, especially Common Lisp which inconvergent is using, have plenty of data structures: http://www.lispworks.com/documentation/lw70/CLHS/Front/Contents.htm http://www.lispworks.com/documentation/lw70/CLHS/Front/Conte... Common Lisp doesn't have a nice literal structure for hash tables/maps/dicts but that is easily mended with a macro. "(with-snek (snk) ..." is a macro which abstracts away lower level tedious boilerplate. It hands you "snk" on a platter so you can manipulate it. Common Lisp itself also comes with some of these macros: http://www.lispworks.com/documentation/lw70/CLHS/Front/X_Alph_W.htm http://www.lispworks.com/documentation/lw70/CLHS/Front/X_Alp... "with-open-file" (skip to the examples) is a nice one since it takes care of opening and closing the file for you so you can write your block of code inside of it and be sure the file gets opened and closed properly: (with-open-file (f "/path/to/file" :direction :output :if-exists :supersede) ... your code writing to "f" comes here ... )