freenode/#lisp - IRC Chatlog
Search
16:29:27
therik
if I want to run timer in a separate thread, what do I use as function for that thread?
16:40:08
phoe_krk
therik: I think you can use an ordinary counter using GET-INTERNAL-TIME or something, and BT's INTERRUPT-THREAD for making that thread evaluate something that e.g. prints something to the screen.
16:44:24
phoe_krk
I shouldn't Lisp when I'm doing elsethings. I counted three somethings in my previous post.
17:44:08
drmeister
Lets say I have a file containing a list of strings that I want to read at compile-time and I need to compile it into a file as a load-time-value.
17:55:02
drmeister
How do I make a value available at load-time from a file available at compile-time and that I want to embed in the compiled file.
17:57:03
drmeister
The info that I need to compile into the FASL file is a list of strings that I can read at compile time.
18:09:32
rumbler31
i have a function that I'm too stupid to debug. so instead I used an already working program to precompute the correct output for each 16 bit integer input and read the results into an array, and it works
18:10:31
rumbler31
if I want to be able to recreate lisp images with this array, would it be better to have a build step that reads the input and output files and rebuilds the array, or get a printable representation that will be loaded from a code file instead?
18:18:02
flip214
Is there a way to get one of a class' :INITARG to be passed through a function before being stored? Ie. like defining a SETF accessor? The only idea I had was to override SHARED-INSTANCE, and to filter that one argument out before calling NEXT-METHOD. Is there a simpler way?
18:24:57
flip214
alternatively, would instance access get much slower for all slots if I renamed the slot and provided a custom SLOT-VALUE-USING-CLASS for the original slot-name?
18:27:12
rumbler31
i've tried to mimic a few different implementation examples in other languages and on the surface it seems easy but
18:28:09
rumbler31
i ended up making an input file I passed to audacity, then used audacity to convert the file to ulaw, and then just read in the values and stored the corresponding output value
18:29:21
rumbler31
no, it probably doesn't matter, its just that after trying it a few different ways i realized I could simply precompute it with a known good tool
18:29:46
rumbler31
i'd rather know I can code it, and I haven't come up against something like this that I haven't been able to debug, so its frustrating
18:40:53
Grue`
also, if you don't want to redefine the default accessor, you can add an :around method
19:01:55
rumbler31
pierpa: the first function is an attempt to parrot this :http://opensource.apple.com//source/tcl/tcl-20/tcl_ext/snack/snack/generic/g711.c
19:14:58
rumbler31
when managing threads, is it an appropriate idiom to pass back a closure after a thread has ben created, wherein the loop in the thread is checking on the state of some variable in the closure to change, that variable being changed by a function call returned with the closure?
19:15:57
rumbler31
like I need a thread to loop, pulling or pushing data through streams, and to stop when the application decides to stop.
19:46:41
rumbler31
well so you're saying if I had a few of these, i'd have to index into an array or keep separate globals to manage their state?
19:52:23
rumbler31
well at some point it has to see state that is changed from outside the thread, right?
19:55:08
Grue`
what is "it"? if something is stored in a lexical variable, or non-local dynamic variable other threads can't see it
19:58:54
Grue`
also this might be actually implementation-dependent because threading is not specified in the standard
19:59:59
rumbler31
well isn't that the idea behind a closure? that things lexically related inside a closure can see the closure "state" or variables and such defined within, and if you invoke a function from a closure it will be able to see/modify the variables inside it?
20:03:34
Grue`
the idea of closure capturing variables in its lexical environment was conceived wrt single-threaded environment. implementing multi-threaded variable capture is probably difficult, and would just make threads perform slower than they could be
20:44:58
pierpa
I transliterated to CL this one http://www.speech.cs.cmu.edu/comp.speech/Section2/Q2.7.htmland get the same results as your last 2
20:50:26
rumbler31
pierpa: I look at the sound file in audacity, my last two attemps appear to produce correct positive ulaw values and not negative ones
20:51:47
rumbler31
since I know have a known good mapping I can directly test but I still just don't understand what correct output is supposed to be. I need to really study the spec, because it seems like the wiki page for the discretized ulaw mapping and the apple c code file example differ, assuming I can still read C code
21:03:12
rumbler31
ok that one I was following along from the itu reference code sample, let me pull it up again
21:10:23
rumbler31
you do the same, but with logand, I guess if the high bits are all 0 then it doesn't matter
21:20:53
rumbler31
phoe_krk: I wrote 3 different versions of a pcm linear to pcm ulaw conversion function trying to simply parrot existing code examples
21:21:24
rumbler31
pierpa wrote a version that is correct. I dunno if that's what you mean about 4 and 5
21:26:32
rumbler31
and thank you for doing this, i'm really embarrassed at how long it took me to fail at it
21:28:27
rumbler31
if I logxor against #xf instead, all of my positive values are correct, but with logand, won't 1 bits remain 1?
21:32:35
rumbler31
i compressed a few steps on that one, I guess my misunderstanding is that complementing a negative value /= the positive value
21:35:13
rumbler31
I don't mean to sound argumentative, I know i wrote it wrong, i'm just trying to figure out exactly where
21:36:26
rumbler31
so i figured that the if sign != 0 then linear = -linear is the same thing as saying "take the absolute value"
21:37:13
rumbler31
so therefore if I simply take the absolute value of linear, no matter positive or negative, it will produce the same effect
21:41:45
rumbler31
what confuses me about what you just said, is that we're storing the leftmost bit value
21:42:25
rumbler31
if this value is 1, assuming twos complement binary, we're dealing with a negative number, right? that this bit is also the msb?
21:58:23
rumbler31
or assuming two's complement, it could be part of the leading 1's for small negative values, otherwise represent a bit in the magnitude for larger values, right?
22:01:35
pierpa
sign is in bit 15, that is the MSB of the sample. Not sure I understood the question, though
22:09:39
rumbler31
so wouldn't that be taking the #x08 bit in the sample and simply storing its result in the #x80 bit?
22:24:06
sjl
basically a built in versoin of (loop for el across source-array for addr from start (setf (aref dest addr) el))
22:25:34
pierpa
I said: btw, I don't understand why they do it in this way / (logand sample #x8000) would have the same effect, methinks
22:26:23
rumbler31
pierpa: yes this seems odd, if you've already reconstructed the 16 bit value prior to calling this function, it seems like they are explicitly taking the high bit from the low byte
22:26:44
rumbler31
the promotion seems to serve simply that it will be writted back in the high bit of the high byte
22:28:08
rumbler31
and it makes even less sense, right shift the sample, but then take the high bit of the high byte
22:28:51
rumbler31
if the implementation performs an arithmetic shift (inserts 1's if the number is twos complement and negative) then you'll read a 1 in the high bit
22:31:53
rumbler31
so the result is that the high bit is moved down to #x0080 then stored as a 1 byte value
22:32:31
rumbler31
and it seems that my problem was that a byte value read as negative when treated like a two
22:35:04
rumbler31
i'm not sure why this wasn't clear to me before. I seemed to think that negating the value wouldn't work for this reason, because it would simply be stored as a sign and magnitude cl integer value, where further bit manipulations would be ignorant of the sign
22:35:26
rumbler31
so if I thought that was the case I have no idea why I would have thought that checking the absolute value would work either
22:44:17
pierpa
me? never used them. Actually, I just returned to write CL after several years of exile
23:33:29
sharkteeth
is there a type of (and) that doesn't stop evaluating arguments even if it encounters nil?
23:43:18
Bike
or abstract a bit, (defun and-always (&rest values) (every #'identity values)), and then define check and multi-check in terms of that
23:47:32
sharkteeth
write it without backquote so it's easier to transliterate it into backquote or avoid backquote when possible?
23:49:32
sharkteeth
pillton i figure you guys get a lot of the same questions over and over again but this is the only place i can go for lisp related questions without spamming stackexchange or quora or whatever's hot now
23:50:56
pillton
sharkteeth: I have no problems with questions. I have problems with blog posts advertising another common lisp test framework. :)
0:09:44
sharkteeth
looks like most/all of it is online on his website as well: http://www.gigamonkeys.com/book/
0:13:34
pillton
Thanks. I wanted to see if it covered an issue with minimal compilation and your check/multi-check macros. It is a bit early in the book to bring it up.
0:44:52
Xach
luis: for some reason, the rss version of your article loses close tags. at least in feedly, anyway.