Skip to content

Instantly share code, notes, and snippets.

@adh
Created May 1, 2011 17:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adh/950666 to your computer and use it in GitHub Desktop.
Save adh/950666 to your computer and use it in GitHub Desktop.
/\___/\ dfsch version 0.4.0-dev
( o o ) (rel-0.3.0-937-g451e094) [May 1 2011 15:05:17]
== * == dfsch is free software, and you are welcome to redistribute it
) ( under certain conditions; see file COPYING for details.
]=> (define t (tokyo-cabinet:open-table "foo.tab"))
#<tokyo-cabinet:table 0x2206160 >
]=> (define (print-results idl)
..> (for-each (lambda (id) (write (collection->list (map-ref t id))) (newline)) idl))
#<standard-function 0x21e35f0 print-results(idl)>
]=> (define q (tokyo-cabinet:make-query t))
#<tokyo-cabinet:query 0x2213740 >
]=> (print-results (tokyo-cabinet:query-search q))
(("class" "U") ("name" "Random") ("surname" "User"))
(("class" "A") ("name" "James") ("surname" "Hacker"))
()
]=> (tokyo-cabinet:add-condition! q "name" :equal "James")
()
]=> (print-results (tokyo-cabinet:query-search q))
(("class" "A") ("name" "James") ("surname" "Hacker"))
()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment