freenode/#lisp - IRC Chatlog
Search
0:14:07
reepca
eh, I guess it wouldn't be too hard to just use an explicit with-clause and a 'do (incf ...)'
0:16:07
reepca
I was thinking more along the lines of, suppose that I'm iterating over a sublist (tail of some other list), but I'm given the starting index of said sublist in the list it's part of, and I want to keep track of what the index is in the larget list.
0:17:38
verisimilitude
You could always embed a LOOP inside of another LOOP, if that simplifies things, reepca.
0:18:06
reepca
well, the way I would usually go about keeping track of an index in a loop would be 'sum 1 into k' or something like that.
0:21:10
reepca
I guess I hadn't really thought about using multiple FOR clauses. So it would end up looking something like (loop for k from initial-index for x in (nthcdr initial-index list) ...)
0:29:27
reepca
https://paste.debian.net/1068504/ here's what I've got so far (automating some operating systems homework).
0:36:07
verisimilitude
Rather, I'll tell you to look at POSITION, FIND, POSITION-IF, and FIND-IF; these solve half your problem, giving the position or the element, and I've not looked at how you're using FIRST-FIT to see which you actually need; I leave that to you, reepca.
0:39:32
reepca
well, the issue there is that while using FIND followed by POSITION would work for FIRST-FIT, it would involve traversing twice.
0:44:20
verisimilitude
You're just using this to see if a list contains a number or the closest number larger than it, right?
0:46:06
reepca
and to get the position of it in the list. The idea is to then write some code to simulate certain sequences of allocations being made with the various selection methods and generate a nice table.
0:51:31
verisimilitude
Oh, that MAXIMIZE doesn't work, actually, because I unconditionally store the index; in any case, you get the gist of how to approach this.
1:01:19
reepca
well, if the MAXIMIZE clause is never executed, then M is unspecified (I want it to be NIL if no appropriate value is found)