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)
3:57:11
reepca
hm, now I'm trying to replace a (dotimes (i n) (format t "+--")) with (format t "~v@{+--~}" n), but then there needs to be a dummy argument, otherwise it doesn't enter the loop at all. Is there a way to change the format string to make this dummy argument unnecessary?
4:26:35
verisimilitude
You could use ~0* in the main loop of the FORMAT statement, but chances are that would result in suboptimal code.
5:51:16
emaczen
For some reason my keyword arguments to make-instance aren't being passed along to an after method I defined on initialize-instance -- I've never had this happen before.
5:51:16
minion
emaczen, memo from stassats: don't leave the main thread, execute it there from the beginning
5:52:25
emaczen
the metaclass only overrides validate-superclass and adds an after method on ensure-class-using-class
6:00:14
emaczen
Lycurgus: stassats memo doesn't bring to memory my exact question. When you execute code from the repl, you have already left the main thread?
9:01:36
beach
Spaceman77: Sure. However, CLOS is even more powerful because you can distribute methods physically across modules and you can have auxiliary methods, alternative method combinations, and more.
9:08:56
jackdaniel
I think that brilliance of this enlightenment comes from the simplicity of the implementation
9:09:36
jackdaniel
(and that hardly can be said about clos) - that said if you look for the OOP abstraction clos is definetely better than ad-hoc closures
9:15:22
beach
shka__: By that, I meant that two different methods on the same generic function can be in two different files.
9:30:40
Spaceman77
jackdaniel: speaking of enlightenment, i've observed multiple people claiming that reading SICP/learning LISP grants you some enlightnment. I am curious about this.
9:31:49
Spaceman77
I have to agree that i find lisp-like syntax very ergonomic when writing programs
9:32:38
beach
LdBeth: No, because it would call read-char and read-char doesn't work on binary streams.
9:33:53
verisimilitude
It could have a LOAD-FASL function defined in machine code using, say, mmap, if it wanted to.
9:33:57
shka__
verisimilitude: it is probabbly very good approximation of actual state of the implementations ;-)
9:34:42
Spaceman77
beach: Well, i'm curious if you have experienced this `enlightnment`, and if so, how did it manifest? :)
9:35:16
verisimilitude
That makes me think about how WWW browsers have a ``webextensions'' API; defining something such as this is pointless, as it completely removes the ability for different approaches.
9:39:32
heisig
Spaceman77: For me, the enlightenment was 1. how little you actually need in a powerful language (functions + a few special forms) and 2. how treating data and code interchangeably solves A LOT of real-world problems.
9:42:53
schweers
Spaceman77: Also, having the language available at all times can be really great. Or put differently: not having the whole language available at all times seems to be seriously broken to me.
9:44:34
phoe
(with-lispcafe verisimilitude: there are worse ones - see http://bit.do/eeeeeeeeeeeeeeeee for example)
9:51:10
jackdaniel
Spaceman77: the most enlightening part would be the fact, that computers are just dumb devices manifesting programmer mistakes and lacks of cognitive abilities, but it is not directly related to lisp as a language
9:53:44
verisimilitude
I'll add my opinions, then. Lisp is a good programming language for when you don't know what you're doing, Spaceman77. If you only have a vague idea of the program you're writing, Lisp is a nice language that lets you delay lasting decisions rather far.
9:54:10
verisimilitude
If you later have a very good idea of what you're writing, Lisp can still be a good language, but isn't necessarily the best.
9:55:06
verisimilitude
Garbage collection lets you ignore memory management almost entirely, but it may become the case that you understand the memory model very well and so you gain from simply writing it out specifically, but you never must.
9:55:35
verisimilitude
Other languages do require you to do this, but this isn't a hindrance if you know what you're doing, of course.