Q&A's, tips, howto's
hilti
Posts: 140 Joined: Sun Apr 19, 2009 10:09 pm
Location: Hannover, Germany
Contact:
Post
by hilti » Wed May 08, 2013 11:49 am
Hi!
I've just come across this blog post and wondered if the Gist shown there is newLISP? Because the use of (nth) looks pretty familiar to me.
http://blog.bugsense.com/post/499247554 ... me-android
What Do You think?
Code: Select all
(load "stdlib.lql")
(load "dblib.lql")
(timespace "day")
(define string-row *stream*)
(let ((row (reverse
(string-split (str string-row) ":"))))
(if (= (length row) 4)
(begin
(let ((os-ver (nth row 0))
(phone-model (nth row 1))
(error-class (nth row 2)))
(incdb "sessions" 1)
(incdb (session-by "osver" os-ver) 1)
(incdb (session-by "device" phone-model) 1)
(incdb (session-by "error" error-class) 1)
(incdb (session-by-crash "os_ver_class" os-ver error-class) 1)
(incdb (session-by-crash "device_class" phone-model error-class) 1)
(push! (unique "os_ver") os-ver)
(push! (unique "device") phone-model)
(push! (unique "error_class") error-class)))
#f))
Update:
A full blown custom LISP language written in C to implement queries, which is many times faster that having a VM (with a garbage collector) online all the time
http://highscalability.com/blog/2012/11 ... -mobi.html
cormullion
Posts: 2038 Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:
Post
by cormullion » Wed May 08, 2013 2:58 pm
Don't think so - the #f is Scheme/Lisp isn't it?
jopython
Posts: 123 Joined: Tue Sep 14, 2010 3:08 pm
Post
by jopython » Thu May 09, 2013 5:39 pm
The function definition tells me it is not newlisp
(define string-row *stream*)
cormullion
Posts: 2038 Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:
Post
by cormullion » Thu May 09, 2013 5:46 pm
That could be a symbol definition though...?
rickyboy
Posts: 607 Joined: Fri Apr 08, 2005 7:13 pm
Location: Front Royal, Virginia
Post
by rickyboy » Thu May 09, 2013 6:18 pm
There are some "tells" in the code that says it's not newLISP.
1. Their nth has its arguments reversed as compared to newLISP's nth .
2. They're using #f for boolean false (ostensibly).
3. Their push! is newLISP's push (ostensibly).
4. Their string-split is newLISP's parse (probably).
5. Their str is newLISP's string (ostensibly).
There could be more.
(λx. x x) (λx. x x)
rickyboy
Posts: 607 Joined: Fri Apr 08, 2005 7:13 pm
Location: Front Royal, Virginia
Post
by rickyboy » Thu May 09, 2013 7:08 pm
Nice article, Marc! Their solution is even more badass given the fact that they pursued such an economical but still very powerful way to store and query their data. Thanks for sharing! --Rick
(λx. x x) (λx. x x)