libera/#commonlisp - IRC Chatlog
Search
6:50:43
contrapunctus
I'm working on a code browser which displays code as trees, which have directories, files, and top-level Lisp forms as nodes.
6:50:53
contrapunctus
Currently, the constructor for file nodes takes a pathname and checks whether the file type is supported, by calling `(compute-applicable-methods #'parse-file (list pathname ... <file extension as a keyword>))` ...but I'm not sure I like this approach.
6:59:34
contrapunctus
Probably because it would error if there is no applicable method, and I haven't yet figured out how to add a method to `no-applicable-method`...
8:17:50
lisp123
and the subtraction of these two numbers will give you the direction to go from 1 to A
8:18:14
lisp123
And subtraction may not achieve this, but any sort of binary operation can be used in its place
8:19:29
pjb
powers of 2 for position in the toplevel list. Powers of 3 for positions in sublists of level 1. Powers of 5 for positions in sublists of level 2, etc.
8:22:50
lisp123
pjb: Have you ever used this in your own code or seen it somewhere in lisp code as a way to navigate within lists?
8:23:32
lisp123
I was thinking more of the Zipper algorithm (which represents the path from the top to the final element), so something like DRDR or DRR (where d = down, r = right)
8:23:58
lisp123
And was seeing if I could convert this 'string' view of element positions into a numerical equivalent
8:24:58
lisp123
rotateq: Connections like this between (C)Lisp and mathematical concepts really does seem to drive home the point that Lisp is the most natural language
12:18:11
lisp123
contrapunctus: re code browser, why worry about directories and files? better do based on packages and how functions depend on other functions
12:19:55
lisp123
an object browser for CLOS objects would be good - believe its already implemented in various forms, but worthwhile adding to any 'code browser'
12:20:53
lisp123
it would be good to read a function and automatically browser to the applicable method
12:21:45
lisp123
then it would be good to have a documentation browser and potentially some type inference
12:53:11
contrapunctus
lisp123: thanks for the input. Have a look at https://codeberg.org/contrapunctus/dryad#explanation to understand the reasons for it.
12:53:22
contrapunctus
«better do based on packages and how functions depend on other functions» I'm working on a view which does something similar, but using system definitions rather than packages.
12:54:27
contrapunctus
«it would be good to have a documentation browser» One part of this will be done when I implement source comment display. Another aspect is customizable views of source code, e.g. displaying any combination of code, [and wherever applicable] definition name, definition type, docstring, arglists, etc...the parsing for this is in place, but needs a UI.
13:32:03
jeosol
I am using SBCL primarily and currently investigating two different representation options for some data. Is there a function to find out (in the repl) the size of the object created?
13:34:07
beach
I don't think so, but you can make an educated guess. Are you sure your application requires you to optimize for space?
13:34:48
jeosol
To give some context, I am trying to refactor some code that does binary genetic algorithm and I have to store the genes as array of the bits #(1 0 1 0 ...). I am thinking of saving it in the objects as str "1010..." then blow it up when I need to use it for GA operations (crossover and mutation), but it's probably too much work as I'll need those
13:35:01
_death
one simple approximation is to traverse the object, summing the sizes of sub-objects.. for the size of "primitive" objects you can use sb-ext:primitive-object-size
13:35:43
jeosol
beach: Good point. I am just thinking about it, I don't think so. It's seem it will just be too much work. I am trying to see if I can store things compactly and see how things the time and space tradeoffs
13:36:38
jeosol
beach: Thanks for that. That resolves my problem. Using array of bits is my current implementation but had someone suggest if I have looked into compressing them.
13:36:39
beach
jeosol: The standard requires the existence of bit vectors, and I am pretty sure SBCL stores a single bit for each element in that case.
13:40:16
jeosol
The arrays are usually sparse. It will contain lots of 0's and 1's. But usually, I am not looking at massive datasets. I do use a some compression elsewhere but for storing things in a file where I store things as 4*1 4*0 5*1 with the first number indicating the count of the second number. It's not related to my bits question but I do process some
13:40:17
jeosol
large arrays in a 3d-grid that are mostly just 1's (have property there) or 0's (property is not there)
13:40:33
hayley
It is worth noting that SBCL can do SIMD-within-a-register for sequence operations on bit vectors, which may be faster than writing out the loop by hand.
13:43:18
hayley
Some time ago I had mentioned that I got marked down substantially for using Lisp/ML-ish pseudocode on an assignment; but I got full marks for writing an algorithm which used such bit vector tricks, so it evened out. I'd highly recommend trying to use such operations.
13:43:25
jeosol
beach: to your question of optimizing for space. I normally sacrifice space for convenience of implementation and clear code - so I often may create more variables especially if I need to track them, than perform computations to get the variables when needed.
13:44:24
jeosol
beach: I think the boosting computation speed is a better use of my time. So I search for bottle necks and see where I can replace some code with better algorithms and/or use appropriate data structures
13:46:05
hayley
Oh, and speaking of SIMD, I got a new processor recently, and all the vectorised scanning stuff in one-more-re-nightmare is much faster than I had anticipated; as the new (Zen 3) processor has a 256-bit ALU and the older processor has a 128-bit ALU. Scanning at 16GB/s with submatches is quite fun.
13:46:22
jeosol
I will try to create a version of the code so I can track the speedup as I make the improvements
13:47:11
jeosol
hayley: wow, that's very nice. I might self will look to get a machine later on, but I have to do some research, since I do some machine learning, thinking of something with GPU
13:49:17
hayley
I see. Last time I checked, the GPU market was in bad shape, but the Ethereum price went down recently, so hopefully fewer miners will inflate demand these days.
13:53:44
jeosol
hayley: good point. I have seen several posts on reddit that said the GPU prices have crashed due to crash in BTC and related coin prices
13:54:27
hayley
Long ago I had decided to only replace computer parts after they've been used for 5 years. The result is that I can't waste too much money at once, and hopefully I would partake in producing less e-waste too. But I decided to spend more money than usual on a CPU, as the cost is amortised over 5 years. That information might or might not help with picking a machine.