freenode/#lisp - IRC Chatlog
Search
1:11:11
aeth
no-defun-allowed: (1) Because you have non-earmuffed globals with the name x, y, and w, you're using slow dynamic variables every time you have a local named x, y, or w
1:11:37
sjl
at least the actual problem solving code is nice now that I have the gross iterate driver to do the hard work https://github.com/sjl/rosalind/blob/master/src/problems/gc.lisp#L38-L51
1:11:50
aeth
no-defun-allowed: (2) Inline heavily! Disassemble it, and if its disassemble is small enough, inline it! It makes it a bit painful to redefine functions (you have to remember to redefine the whole file) but it can greatly optimize array-related code because it removes a ton of bounds checks
1:13:14
aeth
no-defun-allowed: (3) Make sure your arrays have a valid numeric :element-type (for this sort of thing you might want single-float, double-float, (complex single-float), or (complex double-float)) unless your as-matrix macro is taking care of that.
1:14:15
aeth
If it's a T array, then you should be writing a(n inline) helper function that takes in an initial list and outputs the correct type
1:17:41
no-defun-allowed
hmm, sometimes petalisp passes REFERENCEs and APPLICATIONs to the functions
1:19:22
aeth
If correctly written, this sort of thing should be 30x to 50x faster than non-Numpy Python.
2:16:37
no-defun-allowed
#+ checks if the next keyword is in features, and #- checks that it isn't in there
12:42:24
jarindyk
if I have a list such as '((foo . 1) (bar . 2)), is there a way to get "foo" from 1, "bar" from 2, and 1 from "foo", 2 from "bar"? or what would be the best way to do something like this? I could create two lists too but I'm a noob so I thought I'd ask
12:45:19
jarindyk
pfdietz: well I'm not sure if that's the right way to go about this, as the list is a constant, I'll just need a way to associate a string to an integer and be able to look up the key and value from value and key respectively
12:46:29
pfdietz
Also, consider using symbols instead of strings, when you are not actually doing stringy stuff to them.
12:47:44
pfdietz
Keyword symbols are useful where you might use enums in C (if you're not converting them to actual ints).
12:49:22
pfdietz
If this is all compile time constant stuff, then if they foo, bar are symbols you can use CASE and the like (can't do that with strings, since it does EQL comparison).
12:50:23
pfdietz
To make it extensible, you could use a generic function, and use EQL method parameter specifiers.