code logs -> 2007 -> Tue, 16 Oct 2007< code.20071015.log - code.20071017.log >
--- Log opened Tue Oct 16 00:00:29 2007
--- Day changed Tue Oct 16 2007
00:00
<@ToxicFrog>
In the "sweet bubbling death, how do I combine the State a b monad type with the Population Int [Chromosome] data type"
00:00
<@ToxicFrog>
way.
00:00
<@ToxicFrog>
liftM is involved, but not in a way I find intuitive, and I no longer have time to figure it out.
00:09
<@McMartin>
Right
00:09 * McMartin will play with it when he gets a chance, but will be doing the functional thing with it first.
00:11 * ToxicFrog nods
00:11 * ToxicFrog plays with Chromosome.crossover()
00:20
<@ToxicFrog>
It occurs to me that this would work better if I were seeding the random number generator.
00:28
<@MyCatVerbs>
Yes, this *does* involve passing the random number generator all the way down to the bottom and all the way back up again.
00:28
<@MyCatVerbs>
There are a couple of elegant ways to do that, which generally come down to either using the state monad or, uh, not using Haskell.
00:29
<@MyCatVerbs>
There's no way to implement things like pmap in Haskell without passing the RNG all the way down to the bottom and then back again, so I'd actually seriously consider Lisp or ML in your position.
00:30
<@MyCatVerbs>
(OTOH, it's not actually particularly difficult for someone sufficiently comfortable with monads and the language in general to get that organised so that it's more or less automatic, by either using or implementing a monad that carries the RNG state around for you instead of making you do it manually.)
00:31
<@McMartin>
MCV: I'm wondering if you could have the top level pull out Enough Random Numbers for you and then feed them as a list with indices down below.
00:31
<@McMartin>
Basically, simply using a stream
00:31
<@McMartin>
And you pass the random stream around, tailing as necessary.
00:32 * McMartin clearly still hasn't grasped lazy evaluation intuitively
00:32
<@MyCatVerbs>
McMartin: yes, but you'd have to keep track of *where* in the list you are, which involves just as much parameter-chucking from top to bottom again as passing the RNG around does - admittedly it'll be less painful though (the RNG library in Haskell isn't pleasant, I agree).
00:33
<@McMartin>
My point is, by taking the tail of the list after using your randomness, the "index" is always zero.
00:33
<@MyCatVerbs>
It's not a lazy evaluation issue here so much as a referential transparency issue. But lazy evaluation is what *makes* the referential transparency neccessary in practice, though.
00:33
<@MyCatVerbs>
McMartin: and you'd have to pass that tail back up again in order that you don't keep using the same few dozen random numbers from the top of the list over and over.
00:34
<@McMartin>
Yeah
00:34
<@McMartin>
But, well, tuples.
00:34
<@McMartin>
And I tend to use a lot of tail calls.
00:34
<@MyCatVerbs>
OTOH, if the exact quantity of random numbers generated for each procedure is fixed...
00:34
<@McMartin>
Then you can prepartition and Just Win, yeah.
00:35
<@McMartin>
Or even make it a map operation of some kind.
00:35
<@McMartin>
But this is now all wildly speculative, assuming things about the system design that clearly aren't general.
00:35
<@MyCatVerbs>
Then you could just break the random number list up at the top, IO level, where mutability is not a problem, then hand bits down to the GA calls.
00:35
<@McMartin>
That was pretty much what I was envisioning.
00:35
<@McMartin>
I am, however, still a novice in the ways of Haskell, and doing anything even semi-serious with it is at *most* #3 on my list.
00:36
<@MyCatVerbs>
I think he's writing a genetic algorithm. Eighteen to the dozen, it's not a messy GA, because those are a real bastard to write in *any* language. Most non-messy GAs have fixed RNG requirements in practice.
00:38
<@MyCatVerbs>
McMartin: I'm a total fanboy for Haskell, and finding something fun and useful to do with it is somewhere around #2 on my list. I am looking for an *excuse* to use Haskell myself, and even I think that ML is probably more suited to this particular problem. :/
00:38
<@McMartin>
Heh
00:38
<@McMartin>
Haskell seems to have better generic libraries, I'm noticing.
00:38
<@MyCatVerbs>
Besides, ML gets you around two-thirds of the really important things that're in Haskell *in practice* anyway.
00:38
<@McMartin>
Yeah
00:39
<@McMartin>
And both GHC and OCaml seem to be Seriously Efficient.
00:39
<@McMartin>
By which I mean "Faster than everything except C and C-like C++".
00:39
<@McMartin>
STL C++ is, after all, only slightly faster than Java~
00:40
<@Vornicus>
Java is pretty fast, when you get down to it.
00:40
<@McMartin>
Yeah
00:40
<@MyCatVerbs>
Lazy evaluation, OCaML has sometimes, it's just not switched on by default. Plus you can simulate it by hand trivially in any language that doesn't suck, by passing a continuation along for the "get next element" field of your data structure.
00:40
<@McMartin>
It's the slowest of the Application Languages, but Application Languages are pretty fast.
00:40 * MyCatVerbs nods.
00:40
<@McMartin>
And Java tends to operate in places where most people are using scripting languages, so it can smoke by comparison.
00:40
<@Vornicus>
Though I personally think it could do with a complete stomping of libraries.
00:41
<@McMartin>
I go back and forth about that.
00:41
<@McMartin>
I'd like a Minimal Library and then a Large Standard One.
00:41
< Mischief]>
Smoke?
00:41
<@McMartin>
But, well, Scheme vs. Common Lisp, and since Java is trying explicitly to be the new COBOL, Common Lisp wins.
00:41
< Mischief]>
*just made a steam particle script*
00:41
<@McMartin>
Mischief: "go really fast."
00:41
< Mischief]>
Ah.
00:41
<@McMartin>
As in, Tomcat's application server tends to blow the shit out of standard, say, Python CGI.
00:41
< Mischief]>
I didn't read the whole statement, Forgive
00:42
<@MyCatVerbs>
Far as I can gather, Java hits about .99 of C's runtime running absolutely at-peak, OCaML is about ~2-ish, Haskell is around ~5-ish and scripting languges start at about 25x.
00:42
<@McMartin>
Yeah. Java's a weird case, though.
00:42
<@MyCatVerbs>
Depends how much RAM you have handy, indeed. :)
00:42
<@McMartin>
There are certain kinds of loads where Sun's managed to make Java beat any statically compiled language, period.
00:43
<@McMartin>
Because the HotSpot compiler will notice load patterns and re-optimize as necessary.
00:43
<@MyCatVerbs>
Which reminds me of a rather important question.
00:43
<@MyCatVerbs>
Does Lua have first-class functions and continuations?
00:43
<@McMartin>
It has the first. I don't know about the second.
00:43
<@McMartin>
By "continuations" here, do "generalized tail calls" count?
00:43
<@MyCatVerbs>
Yes, in practice, I think.
00:44
<@Vornicus>
It has, quite frankly, way too many libraries that don't quite right; the mess that is swing vs awt, and io vs nio, and types vs classes, and the 48-bit random number generator that you can ask to give you 64-bit numbers (never mind that it gets 0.0015% of numbers when you ask), the container classes with no synchronized atomic operations.
00:44
<@MyCatVerbs>
Besides, I brainfarted and asked the wrong question. I actually meant to ask about closures, oops.
00:44
<@MyCatVerbs>
Because I've heard awesome things about Lua's performance under a current JIT-ing VM.
00:45
<@McMartin>
I can believe it
00:45
<@McMartin>
Lua itself is not shabby on its own, though.
00:45
<@MyCatVerbs>
Vornicus: that's totally redundant to bother mentioning. *Nobody* with any intact braincells can use Java for more than ten days without learning to hate every single Java API on the planet.
00:45
<@MyCatVerbs>
Vornicus: though I'll admit it probably had some value as catharsis. :)
00:46
<@McMartin>
The Servlet API has made my life easier multiple times.
00:46
<@McMartin>
But I've never had to write to it.
00:46
<@McMartin>
Just read from it.
00:46
<@MyCatVerbs>
McMartin: oh, I didn't know. How's it shoot out compared to, say, Python?
00:46
<@MyCatVerbs>
Huh? What, as a source of ideas to steal from?
00:46
<@McMartin>
No, as a testbed.
00:46
<@McMartin>
I'm a program analyst, as you may recall
00:46
<@McMartin>
Java web apps are very conveniently structured for my purposes.
00:47
<@MyCatVerbs>
I... see.
00:47
<@McMartin>
As in, last week, I gave a talk on my most recent work, which involved taking 80,000-line Java webapps and feeding them into a program verifier and actually getting results, because the data was so clearly partitioned.
00:48
<@MyCatVerbs>
Oh, wow.
00:48
<@McMartin>
It was very easy to say "OK, these six variables are really the only ones that count, and the entry points are these 40 methods. Model-check, ho!"
00:48
<@MyCatVerbs>
Is that tied in to the work you were doing with graphs of pointers' possible values, and clever methods to solve the pointer aliasing problem?
00:49
<@McMartin>
Only very vaguely. And that wasn't my work; it was work by other people in my lab.
00:49
<@McMartin>
I'm just exploiting their results, and found a cute hack to use alias information to sort effects by HTTP request.
00:49
<@MyCatVerbs>
Sweet! Yeah, servlet is *almost* a gem of an API.
00:49
<@McMartin>
The ServletContext vs. ServletSession vs. one other thing I forgot is the main ugly point.
00:50
<@McMartin>
And Servlets are really too low-level for anything Truly Serious.
00:50
<@ToxicFrog>
MyCatVerbs: re Lua: yes first class functions, yes lexically scoped closures, yes proper tail recursion. It doesn't have continuations in the sense of call/cc, but does have something kind of like an exception throw.
00:50
<@McMartin>
But can take the Serious Approach (Struts, Swing) and have them wrap servlets.
00:50
<@MyCatVerbs>
(Except that HTTPServlet will do absolutely everything *except* recieve a file by HTTP POST. You have to do that manually, if you need that functionality - i.e. like (100 - epsilon)% of practical webapps. Fuckdammit.)
00:50
<@McMartin>
(It's also not MVC.)
00:51
<@ToxicFrog>
Performance wise, it's one of the fastest scripting languages (possibly the fastest), but still considerably slower than *ML, Haskell or C.
00:51
<@MyCatVerbs>
ToxicFrog: doesn't matter, I don't think I've ever actually done anything scary enough to need call/cc yet. :)
00:51
<@ToxicFrog>
(it is, I think, definitely the smallest general purpose language)
00:51
<@MyCatVerbs>
Should I be thinking 10x-15x-ish from C?
00:51
<@ToxicFrog>
10x, I think.
00:51
<@MyCatVerbs>
Are you including Scheme in that comparison, heh?
00:52
<@ToxicFrog>
You can speed that up some with luaJIT, but not by all that much.
00:52
<@MyCatVerbs>
What, within ~2x of Haskell?
00:52
<@McMartin>
My Scheme compiles. =)
00:52
<@ToxicFrog>
I thought haskell was much faster than 5x C.
00:53
<@MyCatVerbs>
ToxicFrog: that's more or less a worst-case.
00:53
<@ToxicFrog>
Anyways, the performance tests I've seen generally put Lua around 10-12x C.
00:53
<@MyCatVerbs>
ToxicFrog: I'd rather understate the speed of my favourite language than end up with egg on my chin by pushing it in a position where it wouldn't make it in practice.
00:53
<@McMartin>
Heh, well, you can do that in C, too
00:53
<@McMartin>
setjmp() is awful on MIPS.
00:54
<@McMartin>
Since it involves shoving all the registers onto the stack and such.
00:54
<@ToxicFrog>
And MIPS has a assload of registers.
00:54
<@MyCatVerbs>
Plus, that's really only a guesstimate. The Haskell *I* write will be withing about 5x-ish of the C that *I* write. I know a few dozen people for whom that number would be 2x. And a few intimidatingly clever people for whom that figure is 0.8 :)
00:55 * ToxicFrog nods
00:56
<@ToxicFrog>
In practice, my Lua is probably around 15x or even worse, because I'm doing a lot of behind the scenes stuff with metatables.
00:56
<@MyCatVerbs>
That is taking into account the finite time effect - namely that the time I save in getting the program to *work* at all in Haskell rather than C, I can put to use tuning the Haskell program for speed.
00:56
<@ToxicFrog>
OTOH, it's way more concise than the C equivalent.
00:56
<@ToxicFrog>
Yeah.
00:57
<@MyCatVerbs>
That'll be how C blows assembler out of the water in practice, and OCaML smokes C++ by exactly the same method. Heh.
00:58
<@McMartin>
OCaML also has, AIUI, acceptable C bindings.
00:58 * ToxicFrog plays with high-order functions some
00:59
<@MyCatVerbs>
McMartin: for including OCaML into C projects, or for including C into OCaML projects?
01:00
<@MyCatVerbs>
Haskell's FFI is standardised (in the Haskell98 report itself, I think), but I understand that it's still enough legwork in practice that nobody wants to actually do it, so instead they write tools to automatically generate the stubs for both languages.
01:01
<@McMartin>
C into OCaML.
01:01
<@McMartin>
I know OCaML's got SDL bindings, for instance.
01:01
<@McMartin>
I think Haskell does, too, but.
01:02
<@MyCatVerbs>
Indeed it does, but I don't think the project for that is on Hackage (Haskell's equivalent of CPAN/Cheese Shop/Whatever). I could be wrong, though.
01:05 * MyCatVerbs browses Debian's language shootout page.
01:07
<@MyCatVerbs>
Annoying thing about this is one never has any clue how good/bad/idiomatic the particular implementations of each program in each language might be. Wouldn't really be fair to compare a CMUCL savant to a SBCL retard. :/
01:09
<@MyCatVerbs>
OTOH, at least the code's there in plain sight to read. Not that I know enough languages well enough to make a good quality assessment, though.
01:09
<@McMartin>
That's the trick, isn't it~
01:10
<@McMartin>
Also, automatically generating stubs is fine, AFAIC.
01:10
<@McMartin>
I essentially did that myself, in a limited way, for Lua.
01:10
<@McMartin>
Though I believe TF took it much further.
01:11 * MyCatVerbs nods.
01:11
<@McMartin>
Java ships with a stub generator for its native interface, IIRC.
01:11
<@MyCatVerbs>
Code you don't have to write is code you don't have to debug, after all. Just the generator needs a damn thorough reading-through. :)
01:12
<@MyCatVerbs>
Haskell doesn't by default, but it's really trivial to install from Hackage.
01:12 You're now known as TheWatcher[t-2]
01:12 * McMartin nods
01:13
<@ToxicFrog>
Lua is pretty easy to write interface generators for, the trick is instructing the generator.
01:13 * MyCatVerbs experiences an ohnosecond.
01:13
<@ToxicFrog>
tolua++ will read cleaned up C and C++ headers, but I have yet to see something you can just feed your C include dir to and have a binding module fall out.
01:13
<@McMartin>
Yeah. That's why my version was limited.
01:13
<@MyCatVerbs>
Don't grep the entire contents of /sys on Linux, it's scary (even if harmless).
01:14
<@ToxicFrog>
You speak of blcgen? Yeah. I have since decided that the C->Lua binding part of that was rather pointless, as there are existing tools that Do It Better.
01:14
<@McMartin>
Yeah.
01:14
<@McMartin>
The Freeze bit was handy but presumably also has Real Tools for it too.
01:15
<@ToxicFrog>
Remind me, which part was Freeze?
01:15
<@McMartin>
The one that compiled the script and embedded it as a byte array to be invoked by a C main program.
01:15
<@McMartin>
Giving you a statically-linkable binary.
01:16
<@ToxicFrog>
Aah. Yes. Actually, there aren't existing tools for that; there's bin2c, but that just generates static array declarations, no interface code.
01:16
<@ToxicFrog>
At least, none that I've seen.
01:17
<@ToxicFrog>
The bit I was working on was extending freeze so that you could take a stub (generated by freeze or predefined) and an arbitrary number of Lua scripts or bytecode chunks and glue them together into a single static binary
01:17 You're now known as TheWatcher[zZzZ]
01:17
<@ToxicFrog>
But this means (1) messing with the require() loader chain so that it examines the attached Lua code before examining the filesystem and (2) working in C.
01:19
<@McMartin>
HSDL is at Pre-Alpha stages, I see.
01:19
<@MyCatVerbs>
McMartin: don't touch that with a bargepole.
01:19
<@McMartin>
Yeah.
01:19 * ToxicFrog works on a suitably general specification of Chromosome
01:19
<@ToxicFrog>
The bit about Haskell that I love is its typeclass system.
01:19
<@MyCatVerbs>
McMartin: there's one hosted on Haskell.org itself which is rather better. For some reason Google picks HSDL up instead of that, which is annoying and stupid and, frankly, disappointing. Ah, well.
01:20
<@MyCatVerbs>
ToxicFrog: all ML-alikes have that, though. :)
01:20
<@ToxicFrog>
So does Java, for that matter~
01:20
<@ToxicFrog>
Well, sort of.
01:21
<@MyCatVerbs>
Only for values of "sort of" that happen to include "not really".
01:21
<@McMartin>
Modules and Functors seem to be a bit clunkier than typeclasses, from what little I know of typeclasses.
01:21
<@McMartin>
I've managed some decent experience with Modules and Functors, though.
01:21
<@McMartin>
Google picks up HSDL because it's the one linked from libsdl.org itself, which was how I found it.
01:23
<@MyCatVerbs>
http://darcs.haskell.org/~lemmih/hsSDL/ <-- that's the one I'd use in practice.
01:23
<@MyCatVerbs>
HsSDL. No clue if it has a nicer webpage somewhere, though.
01:23
<@MyCatVerbs>
OTOH, the author does frequent the haskell-cafe@ mailing-list, and is frighteningly quick to respond to queries for help in using his baby. :)
01:25
<@McMartin>
Heh
01:25 * McMartin makes a note
01:25
<@McMartin>
I've got a half-written C++-based SDL application that only kind of works.
01:26
<@McMartin>
If I wanted to do something Serious with Haskell that might be a worthy use of it.
01:26
<@MyCatVerbs>
In addition to which, he also frequents #haskell on freenode, and is in there right now, too. :)
01:26
<@McMartin>
Heh
01:26
<@McMartin>
Again, not until I get the free time
01:26
<@McMartin>
And I need to learn the base language first~
01:26
<@MyCatVerbs>
(One of the rather handy things about having a language with such a tiny, pointy-headed userbase, I guess.)
01:27
<@MyCatVerbs>
Point-headed or propellerheaded? I'm not sure which would be more appropriate.
01:27
<@ToxicFrog>
MyCatVerbs: well, Java has Interfaces, which are roughly equivalent to Haskell typeclasses.
01:27
<@ToxicFrog>
As far as I understand it.
01:28
<@MyCatVerbs>
ToxicFrog: indeed. Just that Java doesn't have nice composition.
01:28
<@McMartin>
Propeller-headed.
01:28
<@McMartin>
Pointy-headed means "pinhead".
01:28
<@MyCatVerbs>
e.g. in Haskell I can say, data Either a b = Left a | Right b
01:28
<@MyCatVerbs>
McMartin: ah, propellerheaded it is.
01:28
<@ToxicFrog>
Not the same thing.
01:28
<@ToxicFrog>
I'm talking about stuff like Ord and Show
01:28
<@MyCatVerbs>
ToxicFrog: hang on a second, I'll get to the meat now.
01:29
<@McMartin>
data is "tagged unions"
01:29
<@McMartin>
Which Java, and, indeed, OO in general, is terrible at.
01:29
<@ToxicFrog>
Java's aren't nearly as useful, largely because Java isn't fully OO, so in the places where they would be useful, you can't use them effectively.
01:29
<@ToxicFrog>
But they try to do the same thing.
01:30
<@MyCatVerbs>
Then I can define, say, that all instances of Either are also instances of, say, Foo, provided that the type of the variable 'a' in the instance of Either is an instance of some particular class Bar, and the type 'b' is an instance of some class Baz.
01:30 * ToxicFrog nods
01:31
<@MyCatVerbs>
e.g. want lexical ordering on your custom linked list class? instance Ord a => Ord MyLinkedList a where ...
01:31
<@ToxicFrog>
What I'm saying is, fundamentally typeclasses are going "this is an interface. Anything declared as instance of this supports this interface, and you can use this interface as a type for pattern matching and the like"
01:31
<@ToxicFrog>
Thus allowing you to write sort :: (Ord a) => [a] -> [a]
01:31
<@MyCatVerbs>
ToxicFrog: oh yes. I really do like that.
01:31 * MyCatVerbs nods.
01:32
<@ToxicFrog>
Which is roughly analogous to the use in Java, eg, sort(Comparable[] a, Comparable[] b)
01:32
<@MyCatVerbs>
That'd be Haskell's "sexy types", heh. And AFAIK most ML-likes have that, though I'm not actually certain.
01:32
<@ToxicFrog>
The difference being that in Java, numbers are, umm, not comparable.
01:32
<@ToxicFrog>
Etc.
01:32 * MyCatVerbs nods.
01:33
<@ToxicFrog>
I must grocery. Back in 30 or so.
01:33
<@MyCatVerbs>
Have fun. Buy sugar.
01:33
<@ToxicFrog>
I already have sugar.
01:33
<@MyCatVerbs>
Deconstruct all rational thought while you're at it.
01:33
<@ToxicFrog>
It's drinkables I'm low on.
01:33
<@MyCatVerbs>
In that case, you have better willpower than I.
01:33
<@ToxicFrog>
Well, drinkables and dinner.
01:34 * MyCatVerbs can keep booze in the fridge for months, but can't make a packet of wine gums last five minutes. :/
01:34
<@ToxicFrog>
(indeed, I have several different kinds of sugar; white, brown, confectioner's, chocolate chips, cinnamon sugar, cinnamon honey butter, Italian chocolates...)
01:34
<@ToxicFrog>
Anyways. BBIAB.
01:35
<@MyCatVerbs>
I meant confectionary, not raw sugar, but same principle. Have fun! ^_^
01:39 * MyCatVerbs is thinking of doing his next coursework project on the JVM... but wondering if he might be able to get away with using Scala instead of Java.
01:39
<@MyCatVerbs>
Almost certainly not, heh. To Hell with teamwork. :)
01:41 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Quit: ]
01:58
<@ToxicFrog>
You'd think that they'd sell soymilk in lots larger than 1L.
01:58
<@ToxicFrog>
Anyways. Chromosome interface.
01:58
<@ToxicFrog>
sub :: Chromosome -> Int -> Int -> Chromosome -- return a subsequence
01:58
<@MyCatVerbs>
I wouldn't.
01:58
<@ToxicFrog>
splice :: Chromosome -> Int -> Chromosome -> Chromosome -- splice another sequence in at the given index
01:58
<@MyCatVerbs>
I'd rather be selling soymilk than buying it, though. Not my cup of tea, so to speak.
01:59
<@MyCatVerbs>
ToxicFrog: you're making Chromosome sound like a list. :)
01:59
<@ToxicFrog>
fitness :: Chromosome -> Num -- return a scalar representation of this Chromosome's fitness
01:59
<@ToxicFrog>
solution :: Chromosome -> a -- return a problem-domain-specific data structure encoded by the Chromosome
02:00
<@ToxicFrog>
And they are instances of Ord and possibly Eq and definitely Show.
02:00
<@ToxicFrog>
And, well, they basically are.
02:00
<@ToxicFrog>
A chromosome is a list of bits + some problem-specific functions for intepreting them
02:01
<@ToxicFrog>
Re: soymilk: vanilla soymilk + orange juice produces something delicious, not unlike a drinkable Creamsicle.
02:02
<@ToxicFrog>
However, I buy orange juice 4L at a time.
02:02
<@ToxicFrog>
Anyways. Do I need any other operations?
02:02
<@ToxicFrog>
Ord is of couse implementable in terms of Fitness.
02:03
<@ToxicFrog>
Crossover breeding and random mutation can be performed in terms of sub and splice.
02:03
<@ToxicFrog>
Oh right. I also need new :: Int -> Chromosome, to create a new random chromosome with the given number of bits.
02:05
<@MyCatVerbs>
What are you ordering them on? Fitness, or...?
02:06
<@MyCatVerbs>
That might have to be Int -> IO Chromosome in practice.
02:06
<@ToxicFrog>
Fitness.
02:06
<@ToxicFrog>
And I'm implementing it in Lua.
02:06
<@ToxicFrog>
I'm just still thinking in Haskell type signatures.
02:07
<@ToxicFrog>
So, no monad wackiness.
02:15 * MyCatVerbs nods.
02:16
<@MyCatVerbs>
Good plan. The GA may be fun to write, but it isn't really the computationally intensive bit anyway. I presume you're using the FFI to have the fitness evaluation done in C? Or is the fitness evaluation cheap?
02:17
<@ToxicFrog>
Fitness evaluation is cheap.
02:17
<@ToxicFrog>
Decode chromosome from grey code to one or more numbers; evaluate simple function.
02:19
<@MyCatVerbs>
Oh. I always thought GAs were mainly for when fitness evaluation was really expensive, or when you wanted more parallelism than you can get out of simulated annealing? Or are you building the simple version first to get the platform right, then replacing the fitness function with something intensive and useful later?
02:21
<@ToxicFrog>
The latter.
02:22
<@ToxicFrog>
First I'm building something that can solve a 50-bit maximization problem (ie, the solution is a string of 50 1 bits)
02:22
<@ToxicFrog>
Then I replace the chromosome module with something that can solve simple 2- and 3-dimensional equations.
02:22
<@ToxicFrog>
Once I'm confident that's working, I need to solve the iterated prisoner's dillema with it.
02:27
<@ToxicFrog>
splice = (dst:sub(1,at-1)..src..dst:sub(at+#src)):sub(1,#dst)
02:28
<@McMartin>
OK, that still looks like line noise to me~
02:28
<@ToxicFrog>
There are more readable ways to write that, but I was bored.
02:29
<@ToxicFrog>
string.sub(destination, 1, at - 1) .. source .. string.sub(destination, at + #source)
02:29
<@ToxicFrog>
And the final :sub(1,#dst) at the end truncates the whole thing to the original length of destination.
02:34
<@MyCatVerbs>
Have a nice night. G'luck with your project, since I'm pretty certain you don't need it. :)
02:34
<@ToxicFrog>
Oh, I most certainly do.
02:34
<@ToxicFrog>
It is, after all, due on friday. And I've never written a GA before. And I'm not 100% solid on how to do IPD in it.
02:35
<@ToxicFrog>
...and once I'm done this, I have to do ant colony optimization.
03:50 Bob_work [~c6b3e33b@207.250.49.ns-12382] has joined #Code
03:50
< Bob_work>
yo
03:51 * Bob_work is looking for assistance in determing how to go about doing something.
03:51 Bob_work is now known as NSGuest-1662
03:52
< NSGuest-1662>
And now I'm looking for a name, apparently.
03:52 NSGuest-1662 is now known as Bobsentme
03:53
< Bobsentme>
halp?
03:53
<@ToxicFrog>
What is the something you are attempting to determine how to go about?
03:53
<@ToxicFrog>
Don't ask to ask, just ask.
03:53
< Bobsentme>
ok.
03:54
< Bobsentme>
I'm looking to write an application to condense all the shell scripts I use. Something menu driven that I could choose the server, then have all the options/scripts available for that server show up on the menu.
03:54
< Bobsentme>
Problem is, I have no idea what language would be best.
03:55
<@ToxicFrog>
...start from the top?
03:55
<@Vornicus>
Gui, or console?
03:55
<@ToxicFrog>
How do you map servers to sets of shell scripts in the first place?
03:55
< Bobsentme>
Gui, preferably.
03:55
<@ToxicFrog>
bash + gtk-server >.>
03:56 * ToxicFrog dinners
03:56
< Bobsentme>
I was thinking Python could do it, but now I've got doubts.
03:57
<@ToxicFrog>
Python could almost certainly do it, but I still don't really know what "it" is.
03:57
< Bobsentme>
Well, Python with Easygui
03:57
<@ToxicFrog>
You have a local collection of shell scripts, and a remote collection of servers, and some means of determining which scripts are relevant to which server?
03:57
<@ToxicFrog>
You have a set of remote servers, and each one has some set of shell scripts installed on it?
03:57
< Bobsentme>
Yes, yes I do.
03:57
< Bobsentme>
Sorry.
03:58
<@ToxicFrog>
Ok, what is this means? Comments in the scripts? A file somewhere maintaining server -> [script] mappings? What
03:58
<@ToxicFrog>
?
03:58
< Bobsentme>
I have shell scripts, on my local machine that I would like to run from here to the server.
03:58
<@ToxicFrog>
by "from here to the server", you mean execute the local script on the server?
03:58
< Bobsentme>
Some scripts RCMD into the intel servers, some scripts parse data from Unix Boxes.
03:59
<@ToxicFrog>
Ie, copy it over the network to the server, then execute it?
03:59
<@ToxicFrog>
Or do you mean run it locally with the server as (a/the) argument?
03:59
< Bobsentme>
Yes, run locally with the server as the arguement.
03:59
<@ToxicFrog>
Clear specifications are an important part of programming~
04:00
< Bobsentme>
Lesson learned, thanks.
04:00
<@ToxicFrog>
Ok. And the mapping from servers to scripts is accomplished by...?
04:01
< Bobsentme>
Well, most of them get pushed down to the server by the RCMD or the Telnet command, then executed on the server.
04:03
< Bobsentme>
for instance, My Services.bat runs RCMD %server%, runs sclist -r, then pauses the window so I can see what's running, and closes out once a key is hit. (I know, VERY basic)
04:06
<@ToxicFrog>
That's not what I asked.
04:06
<@ToxicFrog>
You have a server name foo.
04:06
<@ToxicFrog>
How do you determine the list of scripts which is relevant to it?
04:06
<@ToxicFrog>
...also, what OS are you doing this on?
04:08
< Bobsentme>
Server names are specific as to what OS is running on it, so I can usually determine what scripts are relevant on it just by eyeballing it. For instance, RCMD isn't going to work on a unix box.
04:09
< Bobsentme>
(Or maybe it will, but not the way I intend it to on the Intel server)
04:09
< Bobsentme>
OS that I would like to run it on is XP
04:15 Bobsentme [~c6b3e33b@207.250.49.ns-12382] has quit [Quit: CGI:IRC]
04:16
<@ToxicFrog>
Hmm. Point here is, if you want the program to give you a list of relevant scripts when a server is selected, you need some way of determining which scripts are relevant that the program is capable of performing.
04:30 GeekSoldier|bed [~Rob@Nightstar-5322.pools.arcor-ip.net] has joined #code
04:37 GeekSoldier|bed is now known as GeekSoldier|work
05:44 Thaqui [~Thaqui@Nightstar-26433.jetstream.xtra.co.nz] has joined #code
05:44 mode/#code [+o Thaqui] by ChanServ
07:23
<@McMartin>
Yay, retro skillz
07:32 Chalcedon is now known as ChalcyAFK
07:33 * McMartin independently controls 8 sprites with the same set of methods.
07:34
<@McMartin>
437 bytes of code!
07:35
<@McMartin>
I think this can be abstracted into a more general sprite-control engine.
07:37
<@Vornicus>
bitchrod.
07:38
<@McMartin>
The main problem is that 8 sprites just isn't enough to give me the kind of firepower a shooter requires.
07:38
<@McMartin>
I may have to go the Crazy Comets route and have the enemies be trying to ram you.
07:40
<@Vornicus>
...yeah, 8 sprites isn't much. I think I know how you'd do Galaxian or Space Invaders, but others are... well, I don't know how you'd do it, without hblank-level control.
07:40
<@McMartin>
Oh, you can use hblank level control.
07:40
<@McMartin>
I just don't want to do it.
07:40
<@McMartin>
You can also do frame-level flicker.
07:40 * McMartin is in fact using hblank level control to get his vblank control.
07:40
<@McMartin>
The VIC-II has a register you read that gives you the currently active scanline.
07:41
<@Vornicus>
Use sixteen sprites and alternate between them at half the framerate?
07:41
<@McMartin>
That's pretty horrific; it's nicer to use less than sixteen and rotate quickly.
07:41
<@McMartin>
(See also how NES Life Force handles the Laser.)
07:42
<@McMartin>
(NES has 8 physical sprites, but 64 logical ones. The hardware handles the swapping, but if you have more than 8 on a scanline, it truncates. Wise NES programmers rotate the sprite memory to ensure everything gets a turn.)
07:44
<@McMartin>
http://www.stanford.edu/~mcmartin/misc/spritetest.prg
07:44
<@Vornicus>
(which is why some games - TMNT2 comes to mind, but only in specific places - have characters disappearing when there's a lot going on...)
07:44
<@McMartin>
Yup.
07:46
<@McMartin>
There are other tricks you can pull, like ensure that the player's sprite always "comes to rest" at the right point that you can use the character cells to render shots.
07:46
<@McMartin>
IIRC, R-Type did that.
07:46
<@Vornicus>
What do you mean?
07:46
<@McMartin>
So, the C64 has two layers: background and sprite layer.
07:47
<@McMartin>
(Actually, each sprite is its own layer, but ignore that for now)
07:47
<@Vornicus>
Align the shots with the 40x25 char grid?
07:47
<@McMartin>
Yeah.
07:47
<@McMartin>
If you make it so that the player's ship moves smoothly but always comes to rest at char boundaries, the shots will line up.
07:49
<@Vornicus>
aha!
07:49
<@Vornicus>
that's what you mean...
07:49
<@McMartin>
The '64 lets you reprogram the character set.
07:49
<@McMartin>
Which is not all that uncommon, really.
07:50
<@McMartin>
In fact, sufficiently not uncommon that its big selling point was that you could use an actual bitmapped display.
07:50 * Vornicus knew that, and took advantage of it a few times.
07:50
<@McMartin>
Hard as Hell to use, though.
07:50
<@McMartin>
After I got my Master's degree I implemented some graphics primitives~
07:51
<@Vornicus>
And there was a program that showed off the bitmapped display thingy - it showed a black & white picture of some woman.
07:51
<@Vornicus>
Except the lips were read.
07:51
<@Vornicus>
red*
07:52
<@Vornicus>
I did always wonder at the odd dimensions of the sprite on the C64 though
07:52
<@McMartin>
24x21?
07:52
<@Vornicus>
yes
07:52
<@McMartin>
That's how many bits you can cram into 64 bytes and still have something vaguely square.
07:52
<@Vornicus>
oh, duh. 3*21 = 63
07:53
<@McMartin>
Furthermore, 64 * 256 = 16K, the addressing capability of the VIC-II
07:53
<@McMartin>
So a 64-byte sprite means that you can juuuust use all of the sprite pointer capability and reach the VIC-II's whole address range.
07:53
<@Vornicus>
aha
07:56 * McMartin did some math to see how much you could get away with if you managed to point the VIC-II at a block of Nothing But RAM.
07:56
<@McMartin>
The Bitmapped display ends up eating half the address space, so that option gets thrown out fast.
07:57
<@Vornicus>
Does the Vic-II handle sprite swapping the way the NES does?
07:57
<@McMartin>
Be more specific.
07:57
<@Vornicus>
<McMartin> (NES has 8 physical sprites, but 64 logical ones. The hardware handles the swapping, but if you have more than 8 on a scanline, it truncates. Wise NES programmers rotate the sprite memory to ensure everything gets a turn.)
07:57
<@McMartin>
What do you mean by "sprite swapping", and "the way the NES does"?
07:57
<@McMartin>
Oh. No it does not.
07:58
<@McMartin>
It does, however, use indirection to let you redefine sprite patterns and such.
07:58
<@McMartin>
And unlike the NES, sprite control registers are read/write instead of write-only.
07:58
<@McMartin>
In any event, with 1K for screen memory and 2K for your tileset, that leaves space for 208 sprite patterns.
07:59
<@McMartin>
The other issue with NES sprites is that they are 8 pixels wide.
07:59
<@McMartin>
More precise color control, though.
08:00
<@Vornicus>
Much - you only get three + transparent on both machines, but the C64 has less colors and to get multicolored sprites (and characters!) your texels have to be doublewide.
08:00
<@McMartin>
In all honesty, both are more trouble than they're worth, and anyone who isn't on a L33T R3TR0 SK1LLZ kick is infinitely better off using SDL and having pixel-level control of everything, along with no size restrictions on blits.
08:01
<@McMartin>
Yeah, the C64's only real advantages are auto-magnification (though it doesn't have reflection, which the NES does have), larger object blocks (also kind of a wash), and hardware collision detection across the board.
08:02
<@McMartin>
Well. For sprites.
08:02
<@McMartin>
The NES's handling of tiles is comically awful.
08:02 * Vornicus never dealt with that.
08:02 ChalcyAFK is now known as Chalcedon
08:02 * Vornicus also never did too much with the VIC-II - not directly, anyway
08:03
<@McMartin>
So, the 64 gives you a 1K block of RAM that you write values to. This lets you change what's in the display. And you can read it to see if you've got something there.
08:04
<@McMartin>
On the NES, the tile data is in a completely separate address space.
08:04
<@McMartin>
You have three registers that let you jam values into it, and you can read out of it, but the reads are time-desynchronized.
08:04
<@Vornicus>
08:04
<@Vornicus>
:(
08:04
<@McMartin>
Also, you'd better do it fast, because the addressing registers for writing or reading are modified by the hardware during the screen refresh and you can't safely touch it.
08:04
<@McMartin>
You've only got time to write about 32 blocks per frame.
08:04
<@McMartin>
After that, you'll just start scribbling all over the place.
08:05
<@McMartin>
Forcing the address registers into non-default configurations at the end of your updates is how you do panning.
08:05
<@Vornicus>
...so that's why some NES TASes start to, uh, catch up to themselves.
08:05
<@McMartin>
Sort of.
08:05
<@McMartin>
That's because there's two screens of memory.
08:06
<@McMartin>
Actually, four, but two are mirrored. Which two are mirrored is a function of how the cart is soldered.
08:06
<@Vornicus>
...heh
08:06
<@McMartin>
(Not counting games like Zelda that can swap them, or much later ones that supply extra ram to use all four and do free scrolling)
08:07
<@McMartin>
If you scroll fast enough, you'll hit the original screen before they've finished writing it, because they'll only be writing eight pixels a frame, tops.
08:07 * Vornicus doesn't think he'd ever want to work with the NES like that.
08:07
<@McMartin>
Usually many less.
08:07 * McMartin managed it for a text-scroller, and that was enough.
08:07
<@McMartin>
Galaxy Patrol just looped two screens of data veeeery slllllowly and used sprites for the "real" scrolling.
08:07
<@McMartin>
Parallax!
08:09
<@Vornicus>
So, the stars and fuel were all sprites, and then the background was the char data?
08:10
<@McMartin>
The fuel meter was also sprites.
08:10
<@McMartin>
The Diffusion Chamber demo is notable mainly for being an Animated Background.
08:12
<@Vornicus>
heh
08:12
<@McMartin>
Hmm.
08:13
<@McMartin>
If I make ships move at a decent clip, three on screen at once is enough.
08:13
<@McMartin>
Then I can reserve four sprites to blink through all shots.
08:13
<@McMartin>
Or just say "Player and Enemies each get two on screen at once, period"
08:51 You're now known as TheWatcher
09:03 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code
09:03 mode/#code [+o gnolam] by ChanServ
10:32 Chalcedon [~Chalcedon@Nightstar-2310.ue.woosh.co.nz] has quit [Quit: Gone]
11:32 GeekSoldier|work [~Rob@Nightstar-5322.pools.arcor-ip.net] has quit [Ping Timeout]
11:34 GeekSoldier|work [~Rob@Nightstar-5322.pools.arcor-ip.net] has joined #code
11:49 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Quit: Reboot]
12:16 ReivOut is now known as ReivZzz
12:31 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code
12:32 mode/#code [+o gnolam] by ChanServ
13:01 Thaqui [~Thaqui@Nightstar-26433.jetstream.xtra.co.nz] has left #code [Leaving]
13:41 You're now known as TheWatcher[afk]
14:23 MyCatVerbs [~mycatverb@Nightstar-13709.lurkingfox.co.uk] has quit [Quit: viva UTF-8]
14:25 MyCatVerbs [~mycatverb@Nightstar-13709.lurkingfox.co.uk] has joined #code
15:04
<@ToxicFrog>
Hmm.
15:05
<@ToxicFrog>
Conveniently, the code I wrote for lab exam 1 is a few s///g patterns away from being the code for lab 5.
15:05
<@ToxicFrog>
Inconveniently, I have to be physically on campus to demonstrate it.
15:20
< Mischief]>
"There's this thing called being so open-minded your brain drops out." - Richard Dawkins
15:21
<@gnolam>
Mischief]: heh. From what?
15:22
< Mischief]>
Being open minded.
15:22
< Mischief]>
Get it? :P
15:22 * Mischief] will get rid of the bracket, finally.
15:22 Mischief] is now known as Mischief
15:38 GeekSoldier|work is now known as GeekSoldier
15:51
<@gnolam>
Mischief: ...
15:51
<@gnolam>
I meant "What work was the quotation from".
15:51
<@gnolam>
+?
15:53
<@ToxicFrog>
<Tela> Heh, haskell type errors don't resemble type errors as much as they resemble page 30 of a thesis on category theory.
16:40 * Attilla tests
16:41 Zemyla [~nsJChat@168.53.174.ns-23174] has joined #code
16:49 * ToxicFrog grabs Java and shakes it until introspective capabilities that aren't a pain in the ass to use fall out
16:53
< Zemyla>
System.eval(whatever)?
16:53
< Zemyla>
Is that what you want?
16:53
<@ToxicFrog>
Actually, Enum.valueOf()
16:54
<@ToxicFrog>
Which despite what the documentation says, you actually use as MyEnum.valueOf(foo), rather than Enum.valueOf(MyEnum, foo)
17:23 GeekSoldier [~Rob@Nightstar-5322.pools.arcor-ip.net] has quit [Ping Timeout]
17:26 GeekSoldier [~Rob@Nightstar-5322.pools.arcor-ip.net] has joined #code
18:13 AnnoDomini [AnnoDomini@Nightstar-28848.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
18:15 AnnoDomini [AnnoDomini@Nightstar-28906.neoplus.adsl.tpnet.pl] has joined #Code
18:15 mode/#code [+o AnnoDomini] by ChanServ
18:43 You're now known as TheWatcher
20:20 wiredoptix [~wiredopti@Nightstar-693.ok.shawcable.net] has joined #Code
20:42 Chalcedon [~Chalcedon@Nightstar-2310.ue.woosh.co.nz] has joined #code
20:42 mode/#code [+o Chalcedon] by ChanServ
20:50 ReivZzz [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout]
20:53 nick_ [~nick@Nightstar-23600.hsd1.fl.comcast.net] has joined #code
20:54 Doctor_Nick [~nick@Nightstar-23600.hsd1.fl.comcast.net] has quit [Ping Timeout]
21:28 GeekSoldier [~Rob@Nightstar-5322.pools.arcor-ip.net] has quit [Ping Timeout]
21:31 GeekSoldier [~Rob@Nightstar-5322.pools.arcor-ip.net] has joined #code
21:43 GeekSoldier [~Rob@Nightstar-5322.pools.arcor-ip.net] has quit [Ping Timeout]
21:45 GeekSoldier [~Rob@Nightstar-5322.pools.arcor-ip.net] has joined #code
21:49 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Ping Timeout]
21:52 gnolam [~lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code
21:52 mode/#code [+o gnolam] by ChanServ
22:00 Zemyla [~nsJChat@168.53.174.ns-23174] has quit [Connection reset by peer]
22:00 GeekSoldier_ [~Rob@Nightstar-5322.pools.arcor-ip.net] has joined #code
22:02 GeekSoldier [~Rob@Nightstar-5322.pools.arcor-ip.net] has quit [Ping Timeout]
22:14 GeekSoldier_ [~Rob@Nightstar-5322.pools.arcor-ip.net] has quit [Ping Timeout]
22:17 GeekSoldier_ [~Rob@Nightstar-5322.pools.arcor-ip.net] has joined #code
22:25 nick_ is now known as Doctor_Nick
22:29 wiredoptix [~wiredopti@Nightstar-693.ok.shawcable.net] has quit [Quit: Leaving]
22:29 GeekSoldier_ [~Rob@Nightstar-5322.pools.arcor-ip.net] has quit [Ping Timeout]
22:31 GeekSoldier_ [~Rob@Nightstar-5322.pools.arcor-ip.net] has joined #code
22:46 GeekSoldier_ [~Rob@Nightstar-5322.pools.arcor-ip.net] has quit [Ping Timeout]
22:47 GeekSoldier_ [~Rob@Nightstar-5322.pools.arcor-ip.net] has joined #code
22:54 GeekSoldier_ [~Rob@Nightstar-5322.pools.arcor-ip.net] has quit [Ping Timeout]
22:58 GeekSoldier_ [~Rob@Nightstar-5322.pools.arcor-ip.net] has joined #code
23:01 GeekSoldier_ [~Rob@Nightstar-5322.pools.arcor-ip.net] has quit [Ping Timeout]
23:03 GeekSoldier_ [~Rob@Nightstar-5322.pools.arcor-ip.net] has joined #code
23:08 GeekSoldier_ [~Rob@Nightstar-5322.pools.arcor-ip.net] has quit [Ping Timeout]
23:09 GeekSoldier_ [~Rob@Nightstar-5322.pools.arcor-ip.net] has joined #code
23:17 Attilla [~The.Attil@194.72.70.ns-11849] has quit [Ping Timeout]
23:19 Attilla [~The.Attil@194.72.70.ns-11849] has joined #code
23:24 GeekSoldier_ [~Rob@Nightstar-5322.pools.arcor-ip.net] has quit [Ping Timeout]
23:26 GeekSoldier_ [~Rob@Nightstar-5322.pools.arcor-ip.net] has joined #code
23:32 GeekSoldier_ [~Rob@Nightstar-5322.pools.arcor-ip.net] has quit [Ping Timeout]
23:33 GeekSoldier_ [~Rob@Nightstar-5322.pools.arcor-ip.net] has joined #code
23:43 GeekSoldier_ [~Rob@Nightstar-5322.pools.arcor-ip.net] has quit [Ping Timeout]
23:48 GeekSoldier_ [~Rob@Nightstar-5322.pools.arcor-ip.net] has joined #code
23:56 Forj [~Forj@Nightstar-2310.ue.woosh.co.nz] has joined #code
23:56 mode/#code [+o Forj] by ChanServ
23:58 GeekSoldier_ [~Rob@Nightstar-5322.pools.arcor-ip.net] has quit [Ping Timeout]
--- Log closed Wed Oct 17 00:00:05 2007
code logs -> 2007 -> Tue, 16 Oct 2007< code.20071015.log - code.20071017.log >