libera/#commonlisp - IRC Chatlog
Search
19:14:08
jackdaniel
generally if you bind a result with (let ((result (call-function))) ...) then you bind only the first result
19:14:43
jackdaniel
but you may do (multiple-value-bind (result return-code plist) (call-function) ...) then if the function returns more values then they are bound
19:20:49
Bike
well - basically computers are creatures of arithmetic - they only know about numbers. when you "send text" over a line, what actually happens is that your text is encoded into a series of numbers which are actually sent. for example in ASCII or UTF-8, "A" becomes 65, whereas in EBCDIC "A" becomes 193.
19:21:05
Bike
In this case you have received a bunch of numbers, but without knowing how they were encoded, you can't get the corresponding text back.
19:21:30
Bike
(fsvo of "actually sent", since the numbers become electrical pulses, etc. irrelevant details)
19:28:37
piethesailor
Nice! Thanks for the explanation, Bike. I am curious though. I now have json from that babel:octets-to-string, which I have parsed with yason:parse. the result is a hash-table
19:33:36
piethesailor
how do I access the information in the hash table? I know I can click on #<HASH-TABLE :TEST EQUAL :COUNT 8 {10045A6943}> and emacs opens a buffer with the information pretty printed, but I am getting nil for (gethash 'results *my-hash*)
19:34:25
minion
piethesailor: please look at pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
19:35:06
jackdaniel
generally you may map over hash table (maphash (lambda (key val) (format t "~s :: ~s~%" key val)) *hash-table*)
19:39:22
louis77
piethesailor: btw. you should be able to right click on the object in emacs and select "Inspect"... at will show you the contents of the hash table
19:42:15
piethesailor
Yes! That does work. I am thinking of how to access those data points with code. So far jackdaniels suggestion of maphash prints first level information like: ' "ticker" :: "AAPL" "queryCount" :: 1 "results" :: (#<HASH-TABLE :TEST EQUAL :COUNT 9 {10045A70F3}>) '
19:43:25
piethesailor
but I suppose I want to get information in "results" which is i guess another hash table
20:04:59
paulapatience
piethesailor: you may be interested in https://github.com/AccelerationNet/access to faciliate access to elements in nested hash tables (and other data structures)
2:23:54
patrix
ok so I haven't built anything with CL in over 2 years, so I don't really remember *why* I disliked all the json libraries back then.. but I tried shasht yesterday and it was so smooth.. thanks to whoever made it :) (yitzi?)
2:54:36
Josh_2
I rewrote a critical part of my software system and it seems to have come together nicely. There was a lot of deleting and rewriting :joy:
3:39:56
patrix
Nice. I’m about to embark on some refactoring as well, though my project is only 2 weeks old haha