freenode/#lisp - IRC Chatlog
Search
18:25:13
Josh_2
How do I abs two values? Or in C++ a complex like so http://www.cplusplus.com/reference/complex/abs/ I just made my "complex" a list of two numbers, not sure if I'm doing it right
18:28:02
White_Flame
if you're injecting complex literals into your code, use #c. Otherwise, any math that returns complex numbers should return complex numbers on their own
18:28:34
White_Flame
if you have 2 numbers from which you want to construct a complex number, then it's (complex <real> <imag>)
18:41:28
Josh_2
although I wouldn't mind experimenting with a library that lets me plot pixels to the screen
18:52:25
francogrex
i defined my class (defclass my-class () ...) later on if i want to use it as (make-array length :element-type (vector my-class *)) << is this right (vector my-class *) ?
19:00:09
francogrex
it's a little bit disconcerting that the REPL prints the array with zeros as such #(0 0 0 0 0 0 0 0 0 0) no sense to what i defined it to be
19:01:08
kenanb
I was able to get much better timing with initially allocating 4 and multiplying the allocated size by 16 when required. I tried with various string lengths and it was always the best score.
19:06:18
Bike
francogrex: element type is the type of the ELEMENTS of the array. (make-array length :element-type 'integer) is a vector of integers
19:12:17
francogrex
yes that (make-array 5 :element-type 'integer) returns an array with #(0 0 0 0 0) but when you do (make-array 5 :element-type '(vector integer 3)) why #(0 0 0 0 0) is also returned?
19:13:55
Bike
Okay, so under the hood your lisp implementation probably only has special vectors for a few things.
19:14:36
Bike
it doesn't know about your particular class, or store vectors specially, or anything. So it "upgrades" that type specification to something it does know about, which is probably T.
19:14:53
Bike
If you do (array-element-type (make-array 5 :element-type '(vector integer 3))) you'll probably get T
19:17:28
Fare
Select D took me to the documentation and Show Candidates Backtrace told me that c-B would show the backtrace
19:18:44
francogrex
ok so (make-array 5 :element-type 'character) is fine, (make-array 5 :element-type 'bit) is fine (i mean shows what expected ... but that's just it the rest is T
19:20:27
Bicyclidine
When you try to make a vector of (vector integer 3), it makes a vector of T. It picks 0 as an initial element, which is fine, because 0 is a T.
19:21:27
Bicyclidine
Because your implementation has special character arrays, and picked a different element for them.
19:21:46
Bicyclidine
If you did (make-array 5 :element-type '(vector character)) you'd probably get #(0 0 0 0 0) again.
19:23:22
Bicyclidine
If you want the vector to be filled with strings you can specify a string it can be filled with.
19:23:54
Bicyclidine
Lisp does not actually know how to take a type and make a valid "zero" object of that type anyway.
19:25:35
francogrex
so where do those 0s come as default? Bicyclidine yes but in that case, the :element-type is irrelevant then
19:26:09
Bicyclidine
Not when you want your element type to be a vector type, no. I think that was established by my explanation of upgrading.
19:26:48
Bicyclidine
The implementation can't really do anything special if it knows that an array is only going to hold vectors, because vectors are complicated objects. So it just uses its basic complicated object type, T
19:27:23
Bicyclidine
The 0 is probably just the default initial element for arrays specialized to hold general objects.
20:00:08
stylewarning
PuercoPop: I found an issue with the recent FIASCO change to use synonym streams
20:26:45
PuercoPop
stylewarning: in retrospect it was a bad proposal on my part. If we use synonym streams we should just write the the *test-run-standard-output* instead
20:30:07
PuercoPop
I'm not sure I understand the purpose of defining a stream for testing and then binding *standard-output* to it and write to *standard-ouput* instead of writing the stream directly
20:51:28
PuercoPop
stylewarning: I'm under the impression that this bind to the eval *standard-output* was done by atilia to mimick what make-synonym stream accomplishes
5:05:18
Guthur
Is there a CL implementation that allows setting processor affinity for a given thread?