freenode/#lisp - IRC Chatlog
Search
21:24:51
moldybits
ah, setting *print-radix* to t gets me a #b prefix. that's nice. i presume the pretty printer will allow me to get something like 5 => 5 (#b101)
21:26:27
jasom
moldybits: yes you could install a pretty print dispatch entry for type rational (or maybe integer) to do that
21:26:55
specbot
Pretty Print Dispatch Tables: http://www.lispworks.com/reference/HyperSpec/Body/22_bad.htm
21:56:09
moldybits
hm, slime keeps crashing for when i try to set-pprint-dispatch 'integer to whatever, while 'float works fine.
21:58:35
moldybits
*print-base* and *print-radix* will have to do for now. thanks, jasom and LdBeth!
22:03:40
moldybits
does this seem like a reasonable thing to do? (take-bits 3 #b10101111) => #b101 and (discard-bits 3 #b10101111) => #b1111
22:05:42
emaczen
Do we have to use eval-when for reader macros in a file? Or is there a way to make it implicit?
22:10:20
jasom
something like: (defun take-bits (n x &optional (byte-size *byte-size)) (ldb (byte (- byte-size n) 0) x))
22:13:13
jasom
with typo correction, seems to work: (defun take-bits (n x &optional (byte-size *byte-size*)) (ldb (byte (- byte-size n) 0) x))
22:17:32
moldybits
yes, that is much simpler than my original implementation. not sure if it's worth naming, then ...
22:17:34
jasom
though if you want it to be fast; I suggest using a constant named +byte-size+ rather than a variable named *byte-size*
22:19:10
jasom
ldb is one of those things that is implemented many times (often poorly) as a preprocessor macro in C, so it's nice to have it in the lisp spec.
22:27:13
moldybits
i'm translating some C into Lisp in order to understand and refactor it. later i might translate it back into C.
1:56:53
Ukari
(defparameter th (bt:make-thread (lambda () (sleep 5) (print "runs")))) (bt:interrupt-thread th (lambda nil)), why i can't interrupt the thread from sleep?
2:07:39
Ukari
(defparameter th (bt:make-thread (lambda () (catch 'wake (sleep 5)) (print "runs")))) (bt:interrupt-thread th (lambda () (throw 'wake nil)))
2:12:54
White_Flame
an interrupt is just pause, run externally-provided lambda, resume. If you want to wake up from a timeout, you should use locks/waits/etc with timeouts
3:05:37
fiddlerwoaroof
minion: memo for emaczen: I've looked into Obj-C exceptions, but I don't think there's anything you can really do about them
3:06:07
fiddlerwoaroof
minion: memor for emaczen: see the recent-ish comments in #ccl from eschatologist
3:06:11
fiddlerwoaroof
minion: memo for emaczen: see the recent-ish comments in #ccl from eschatologist
4:34:19
Ukari
is there a test framework which could run assert asynchronously? like (test test-foo (bt:make-thread (lambda () (is (eq 1 1)))))
4:36:47
Ukari
because some of my test will run in another thread, and if the test framework support assert asyncly it will be more easy to write tests