code logs -> 2007 -> Tue, 02 Oct 2007< code.20071001.log - code.20071003.log >
--- Log opened Tue Oct 02 00:00:26 2007
00:07
<@ToxicFrog>
Aie, Haskell has like eight implementations
00:07
<@ToxicFrog>
On the plus side, it compiles to machine code and is mad fast.
00:07
<@McMartin>
GHC is the Real One, IIRC.
00:07
<@McMartin>
Hugs is the Portable One.
00:08 * ToxicFrog nods
00:08
<@ToxicFrog>
Hugs also appears to be the REPL One.
00:08
<@ToxicFrog>
And the Fast One, as far as build time goes.
00:08
<@McMartin>
Always a plus when picking a language up, imo
00:08
<@ToxicFrog>
So presumably one would learn and develop on Hugs, and generate release binaries on GHC.
00:09
<@McMartin>
Yeah, unless you depend on something like SDL bindings in which case you're stuck with GHC all the way through.
00:15 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Quit: Z?]
00:19 You're now known as TheWatcher[T-2]
00:24 You're now known as TheWatcher[zZzZ]
00:54
<@ToxicFrog>
Haskell types are not first class ;.;
01:01
<@McMartin>
Not quite sure what you mean by "first-class type" here.
01:01
<@McMartin>
But if you're using it in the usual sense, neither are ML's.
01:01
<@McMartin>
As in, "int" is not a value.
01:01
<@ToxicFrog>
You can't manipulate abstract types such as Integer as first class values.
01:01
<@ToxicFrog>
And I can't think of anything where they are, but still, it makes me sad.
01:02
<@ToxicFrog>
Smalltalk, maybe?
01:02
<@McMartin>
ML comes close
01:02
<@McMartin>
Functors let you do it
01:02
<@McMartin>
Functors also require you to turn off type inference for the duration, though, because plug-and-play types play merry hell with it. Inference is for within modules.
01:03
<@McMartin>
Haskell has an unusual mechanism called "type classes" that may end up doing something similar.
01:03
<@McMartin>
ISTR that being its approach to modules.
01:04
<@McMartin>
If Haskell is anything like ML, the idea of types being objects is nonsensical because even objects aren't objects.
01:05
<@McMartin>
(Also, Python has first-class types by your definition. You can pass the values int and str around)
01:06
<@ToxicFrog>
...this is fairly cool
01:07
<@ToxicFrog>
data Tree a = Leaf a | Branch (Tree a) (Tree a)
01:07
<@McMartin>
Very yes.
01:07
<@ToxicFrog>
There's your binary tree declaration.
01:07
<@McMartin>
That's straight out of ML.
01:07
<@McMartin>
And which were I'm getting my factor-of-10 compression in my AST-walking code.
01:07
<@McMartin>
http://pql.svn.sourceforge.net/viewvc/pql/trunk/pql/ocaml/Ast.ml?revision=141&vi ew=markup
01:08
<@ToxicFrog>
...and the fringe function, which returns all leaves:
01:08
<@ToxicFrog>
fringe :: Tree a -> [a]
01:08
<@ToxicFrog>
fringe (Leaf x) = [x]
01:08
<@ToxicFrog>
fringe (Branch left right) = fringe left ++ fringe right
01:09
<@ToxicFrog>
Hmm. That AST code is fairly cool, especially in that it looks a lot like the spec would
01:10 * McMartin nods
01:10
<@McMartin>
The other great thing about fringe and related functions is that when they compile down, they are basically computed GOTOs.
01:10
<@McMartin>
Which is typically quite a bit faster than the pair of method calls you need to get the effect in a single-dispatch OO language.
01:11
<@McMartin>
ML's syntax for that is a bit more convoluted, and OCaml's is worse still, but the semantics match up.
01:15
<@ToxicFrog>
...ok, I now intuitively grasp why curry is delicious
01:16
<@ToxicFrog>
add :: Integer -> Integer -> Integer
01:16
<@ToxicFrog>
add x y = x + y
01:16
<@McMartin>
That was where the -> -> -> -> -> -> -> wackiness was coming from in the type signatures I was posting in here last week
01:16
<@ToxicFrog>
map (add 1) [1,2,3]
01:16
<@ToxicFrog>
-> [2,3,4]
01:16
< ReivOut>
...?
01:17
<@ToxicFrog>
ReivOut: we are discussing functional programming languages!
01:17
<@ToxicFrog>
Come, join us!
01:18
< ReivOut>
I am wondering wtf -> does, and why.
01:19
<@McMartin>
The type a -> b is "function that takes a and returns b"
01:19
<@McMartin>
Functional languages tend to eschew having functions take multiple arguments, instead having them take one argument, then return another function that takes the second argument and returns the result.
01:20
<@McMartin>
Hence, the add function he gave with the type int -> int -> int.
01:20
< ReivOut>
...I have a mild headache parsing that.
01:20
< ReivOut>
I suspect part of this is I would benifit from knowing what makes a 'functiona language', per se.
01:20
<@McMartin>
And the reason they like doing this is because it lets you do the make_adder trick for free.
01:20
< ReivOut>
+l
01:20
<@McMartin>
Functions are first-class objects, and the programming philosophy is built around this.
01:21
< ReivOut>
Aha. I think.
01:21
<@McMartin>
In this day and age they are also largely or even entirely stateless.
01:21
<@ToxicFrog>
Well, that's not what makes something functional, per se
01:22 * McMartin considers "functional" a *style* more than a language type.
01:22
<@ToxicFrog>
AIUI, functional languages are based around the idea that you express the program as a tree of expressions of evaluate, rather than as a list of instructions to execute
01:22
<@McMartin>
Yes, but that's been a blurry line since LISP and Algol.
01:22
< ReivOut>
As opposed to procedural languages, where it's a big long list/
01:22
< ReivOut>
?
01:22
<@ToxicFrog>
Although first-class functions are Rather Important
01:23
<@ToxicFrog>
ReivOut: well, here's a simple example I came across earlier today
01:23
<@McMartin>
Whether Procedural is a superset of OO or disjoint from it is still a matter of flamewar, I think.
01:24
<@ToxicFrog>
In an imperative language, to do a quicksort, you say "to quicksort a list x: do this, then this, then this, then this, then this..."
01:24
< ReivOut>
right
01:25
<@ToxicFrog>
In a function language, you say "a quicksorted list [x,everything_else] is: (quicksorted everything less than x), x, (quicksorted everything >= x)
01:26
<@ToxicFrog>
(and "a quicksort of the empty list [] is the empty list")
01:27
<@ToxicFrog>
More fuzzily, in an imperative language you tell it how, in a functional one you tell it what
01:27
<@Vornicus>
SQL and Inform 7 are mostly functional.
01:27
<@McMartin>
I'd map SQL into the Declarative bin.
01:27
<@McMartin>
I7... is a tricky case.
01:27
<@Vornicus>
okay, declarative.
01:27
<@Vornicus>
Which we haven't gotten to.
01:28
<@McMartin>
Especially since it includes a lot of the things very similar to type constructors.
01:28
<@ToxicFrog>
ReivOut: http://www.haskell.org/tutorial/intro.html -- although meant to teach Haskell specifically, I have found this to be useful in wrapping my head around a number of FP concepts
01:28
<@Vornicus>
I7 I don't think there's anything quite like.
01:28
<@ToxicFrog>
SQL I would actually put as functional.
01:29
<@McMartin>
I7 is an odd mix of assertion-based declarative with classic procedural.
01:29
<@ToxicFrog>
You give it an function that defines the set of results you want, and it applies that to the database and returns the result.
01:29
<@McMartin>
TF: True. That distinguishes it from Datalog.
01:36
<@McMartin>
"[Currying] has been credited to Sch?nfinkel, but Sch?nfinkeling has never caught on."
01:39 * Vornicus remembers getting into an interesting argument with his database teacher: what order does SQL execute the elements of a SELECT query, generally?
01:40
<@Vornicus>
and the answer is, as near as I can tell, FROM WHERE GROUP HAVING ORDER SELECT OFFSET LIMIT.
01:42
<@ToxicFrog>
We had, I think, two weeks devoted entirely to query order optimization in database theory last year.
01:42
<@ToxicFrog>
I don't miss it.
01:42
<@Vornicus>
heh
01:43
<@Vornicus>
This was a 10 minute conversation.
01:43
<@ToxicFrog>
...(+1) is a valid expression, and returns a function
01:44
<@ToxicFrog>
Aha! That's where metalua got `infix` from~
01:46
<@ToxicFrog>
Mmm, infinitely sized data structures.
01:50
<@ToxicFrog>
...
01:50
<@ToxicFrog>
Ok, this definition of the fibbonachi sequence makes my head hurt, and I think I'll stick to standard pattern matched definitions unless I really need the performance.
01:52
<@McMartin>
VICTORY
01:52 * McMartin adds another analysis pass, which returns the values he actually wanted to compute in the first place
01:59
<@McMartin>
And now, dinner
02:06
<@ToxicFrog>
Oh fuck
02:06
<@ToxicFrog>
You have got to be kidding me
02:09
<@ToxicFrog>
It
02:09
<@ToxicFrog>
's not kidding me!
02:09
<@ToxicFrog>
AAAAAAAAAAAAAAAAAAAAAAAAAAAARGH
02:10 * ToxicFrog vomits black, acidic bile from his eye sockets
02:12
< ReivOut>
...
02:12
<@ToxicFrog>
Haskell is whitespace sensitive.
02:12
< ReivOut>
ahahahahahaha oh shit.
02:14
<@ToxicFrog>
Yaeh.
02:14
<@ToxicFrog>
Specifically, stuff like let blocks and pattern-matched | guards must be col-aligned, as otherwise they are ambiguous.
02:14
<@ToxicFrog>
You can use {;} instead, but this is ugly.
02:16
< ReivOut>
...wait
02:16
< ReivOut>
You spew black bile from whitespace sensitivity
02:17
< ReivOut>
Yet object to using line delimeters?
02:17
< ReivOut>
What do you expect to use then? :p
02:18
<@ToxicFrog>
Neither. Lua manages it.
02:18
< ReivOut>
How?
02:18
<@ToxicFrog>
Carefully crafted grammar.
02:18
< Kyrre>
Ninjitsu.
02:18
<@ToxicFrog>
Quite so.
02:18
<@ToxicFrog>
Parser ninjitsu.
02:18
< Kyrre>
;)
02:19
<@ToxicFrog>
Furthermore, I am willing to live with using \n as a delimiter.
02:19
<@ToxicFrog>
As long as you have some way of sticking things on the same line when necessary. Bash does this just fine; you can seperate statements with either newlines or with ;.
02:20
<@ToxicFrog>
The issue here is not so much whitespace sensitivity per se as indentation sensitivity.
02:23 KarmaBot [~fark.off@130.227.16.ns-12529] has quit [Ping Timeout]
02:23 Kyrre [~Z@130.227.16.ns-12529] has quit [Ping Timeout]
02:25 ReivOut is now known as ReivClass
02:47 Syloqs-AFH [Syloq@NetAdmin.Nightstar.Net] has quit [Connection reset by peer]
02:48 ReivUni [~82d94c4d@Nightstar-29731.dsl.in-addr.zen.co.uk] has joined #Code
02:51 KarmaBot [~fark.off@87.72.35.ns-26506] has joined #Code
02:51 mode/#code [+v KarmaBot] by ChanServ
02:56 Kyrre [~Z@87.72.35.ns-26506] has joined #Code
03:05 Mischief [~Genesis@Nightstar-7565.hsd1.md.comcast.net] has joined #code
03:05
< Mischief>
...I have a really weird error.
03:06
< Mischief>
I tried to ./configure php5, and it said permission denied, and I'm root. o.o;
03:09
<@ToxicFrog>
chmod a+x configure
03:09
<@ToxicFrog>
Stuff that isn't +x can't be executed even by root
03:09
<@ToxicFrog>
However, root can then set that mode regardless.
03:10
< Mischief>
so wouldn't I want to -x?
03:10
< Mischief>
Nevermind
03:10
< Mischief>
I read it wrong
03:11
< Mischief>
Thank you, Toxic
03:18 * ToxicFrog prods javac
03:18
<@ToxicFrog>
...right. Java doesn't have type-inference.
03:18
<@ToxicFrog>
;.;
03:23
<@McMartin>
ML manages to not be white-space sensitive via lots and lots of extra keywords.
03:23
<@McMartin>
I'm not convinced this is really a win.
03:25
<@McMartin>
Also, at least for generics, I hear Eclipse *does* have type inference, but not enough.
03:31
<@ToxicFrog>
Yeah, I mean stuff like:
03:31
<@ToxicFrog>
double kelvin;
03:31
<@ToxicFrog>
public void setK(K) { kelvin = K; }
03:31
<@ToxicFrog>
Does Not Compute
03:33
<@ToxicFrog>
Hmm. This matches the spec, but I'm not 100% sure it's what they had in mind for this lab.
03:33
<@ToxicFrog>
Aah well, sucks to be them.
03:36
<@ToxicFrog>
It passes the unit tests, so they have no grounds for complaint if it stores everything internally in Kelvin regardless of the scale passed to the ctor~
03:42
<@McMartin>
Heh
03:42
<@McMartin>
That's encapsulation, that is.
03:43
<@ToxicFrog>
Yep.
03:43
<@ToxicFrog>
Makes .equals() nice and trivial, too.
03:43
<@ToxicFrog>
(die Sun die die die die die)
03:44 * Vornicus shoots Sun for the .equals() thing. That dichotomy is the worst of all possible worlds.
03:44 Syloq [Coder@NetAdmin.Nightstar.Net] has joined #code
03:45 * McMartin memq's Vorn.
03:45 * Vornicus blames syloq.
03:45
<@Vornicus>
memq?
03:45 Syloq is now known as Syloqs-AFH
03:46
<@McMartin>
The physical vs. structural equality split goes back to LISP.
03:46
<@McMartin>
memq was a membership test that used what Java would call ==.
03:46
<@ToxicFrog>
At least Lisp just gives you a handful of different operators for them.
03:47
<@McMartin>
member used "equals".
03:47
<@ToxicFrog>
Java uses == to mean is and .equals() to mean equals
03:47
<@ToxicFrog>
Except where == actually means equals!
03:47
<@McMartin>
... isn't that only on primitives?
03:47
<@McMartin>
primitives are eq in LISP, too.
03:47
<@McMartin>
As well as equal.
03:48
<@ToxicFrog>
Yes. The presence of primitives in Java, and the way in which they are used, is like a constant, untiring hate engine.
03:49
<@McMartin>
It helps that in LISP, everything that isn't a cons is a primitive.
03:50 * Vornicus replaces TF's hate engine with a fear engine.
03:50
<@McMartin>
(And in OCaml, you just never use physical equality at all.)
03:50
<@McMartin>
(Though you *can*, it appears to always be an error.)
03:50
<@ToxicFrog>
Vornicus: that's what combining it with Java's no-operator-overloads-for-you-but-we-have-them-so-suck-it does.
03:50 * ToxicFrog opens one of his six mouths, and sings the song that ends the Earth
03:51
<@Vornicus>
yey injokes
03:52
<@Vornicus>
They really should have taken a page from Python on operator overloads.
03:52
< ReivUni>
I never did understand all that stuff.
03:52
< ReivUni>
(.equals vs == vs &etc)
03:53
<@ToxicFrog>
Well, on objects, == is physical equality - do these two variables refer to the same underlying object
03:54
<@ToxicFrog>
So clearly you need some other operation to test whether two objects are equal, but distinct
03:54
<@ToxicFrog>
Which is what .equals() is for
03:54
<@ToxicFrog>
Unless you meant "never did understand what Sun was thinking", in which case, fuck if I know
03:54
<@Vornicus>
.equals : Java's == :: Python's == : is
03:55
<@ToxicFrog>
Yeah.
03:55
<@ToxicFrog>
I much prefer Python's approach.
03:55
<@ToxicFrog>
Makes more intuitive sense and is way more readable.
03:56
<@Vornicus>
If Java had taken Python's route, using is, and allowing operator overloads using named but special functions (as opposed to Ruby or C), I think Java would not be nearly as bad.
03:56
<@Vornicus>
s/C/C++/
03:57
<@Vornicus>
Actually doing some libraries right would help too, but.
03:59 * Vornicus blings
03:59
<@ToxicFrog>
Eliminating primitives automatically fixes a lot of the library wackiness, too.
03:59 * Syloqs-AFH bitchslaps Vornicus into a week from last Sunday.
03:59
<@Vornicus>
ow
04:00
<@ToxicFrog>
Most of the problems I run into are due to method chains coming to a grinding halt because some library function returns int or double rather than Integer or Double
04:00 * Vornicus blames Syloq for that, too.
04:31 Attilla [~The.Attil@194.72.70.ns-11849] has quit [Ping Timeout]
04:38 GeekSoldier|bed is now known as GeekSoldier|work
04:42 Forj [~Forj@Nightstar-10836.ue.woosh.co.nz] has joined #code
04:42 mode/#code [+o Forj] by ChanServ
04:52 * ToxicFrog flails at Haskell
04:54
<@ToxicFrog>
typeclasses are confusing ;.;
04:55
<@ToxicFrog>
(and I can write (+) 1 2, or (+ 1) 2, but (+ 1 2) is an error)
04:55
<@McMartin>
FP module systems are all Seriously Wacky.
04:56
<@McMartin>
I suspect the struct/sig/functor model doesn't map
04:56
<@ToxicFrog>
I haven't even gotten into modules yet
04:56
<@ToxicFrog>
Haskell appears to have three distinct levels of type declarations - data, type and class
04:56
<@ToxicFrog>
None of which I grok
04:56
<@McMartin>
data sounds a lot like ML type constructors.
04:57
<@McMartin>
I have no idea about the other ones
05:04 ReivUni [~82d94c4d@Nightstar-29731.dsl.in-addr.zen.co.uk] has quit [Quit: Hometiem]
05:06
< Mischief>
Lovely new error.
05:06
< Mischief>
"Make: execvp: /home*/Desktop/php/buld/shtool: Permission Denied
05:11
< Mischief>
AH, I knew the problem
05:12
< Mischief>
My kernal was updated, I bet the security levels are still raised.
05:12
<@McMartin>
"kernel".
05:12
<@McMartin>
The KERNAL is the Commodore 8-bit BIOS.
05:12
< Mischief>
Don't mind my spelling, I'm not paying attention, really
05:12
<@ToxicFrog>
Ok, type I think I actually grok; it's a typedef
05:13
<@ToxicFrog>
So, eg, type PersonName = (String,String)
05:13
< Mischief>
Is it safe to KILL a make test?
05:13
<@McMartin>
Mmm. Yeah, ML merges those with its "data" construct.
05:14
<@ToxicFrog>
Data appears to be for generics, so eg: data Tree t = Leaf t | Branch (Tree t) (Tree t)
05:14
<@ToxicFrog>
But that's tied up in stuff about type constructors that I don't yet understand.
05:15
<@McMartin>
Generics aren't the way they are in java.
05:15
<@McMartin>
In ML (Sorry for the continual context switches, but I haven't read the haskell stuff), you've got types like that of the function List.length
05:15
<@McMartin>
Which is type 'a list -> int
05:15
<@McMartin>
That's a generic.
05:15
<@McMartin>
Data -- at least, what you're quoting, is a type constructor in ML terms, and is basically a type-safe tagged union.
05:16
<@McMartin>
type looks like simple aliasing.
05:16
<@McMartin>
In OCaml:
05:16
<@McMartin>
type intpair = int * int;;
05:17
<@McMartin>
type inttree = Leaf of int | Branch of (inttree * inttree);;
05:17
<@McMartin>
type 'a tree = Leaf of 'a | Branch of 'a tree * 'a tree;;
05:17
<@McMartin>
Leaf 3 then has the type "int tree".
05:18
<@ToxicFrog>
Yeah, so ML's type covers both Haskell's type and data
05:18
<@ToxicFrog>
Although data puts it backwards; it would be "tree int" in HS
05:18
<@McMartin>
ML also has records, which look wildly different in OCaml in Real ML.
05:18
<@McMartin>
In OCaml it's type query = { name: string; args: string list };; say.
05:18
<@McMartin>
Then you have "a" of type query, and you can refer to a.name and a.args.
05:20
<@ToxicFrog>
I still don't fully grok how you use type constructors, though...
05:20 * ToxicFrog fiddles with ghci
05:21
<@McMartin>
Think of it like SDL_Event.
05:21
<@ToxicFrog>
Hmm. So having declared data Tree, I can then go something like: Branch (Leaf 3) (Leaf 4)
05:21
<@McMartin>
Yeah.
05:21
<@ToxicFrog>
And this evaluates to something of type Tree Integer
05:21
<@McMartin>
Sounds right.
05:22
<@McMartin>
And that, in C, would be struct Tree { enum { LEAF, BRANCH } tag; union { int leaf; struct { tree *left, *right } branch; } data };
05:22
<@ToxicFrog>
Ok. This stillYeahg.
05:23
<@ToxicFrog>
Yeah.
05:23 * ToxicFrog fiddles with getting the data back out
05:23
<@McMartin>
In ML, that's usually with the match bit.
05:24
<@McMartin>
Leftmost (x) = case x of Leaf i -> i | Branch (l, _) -> Leftmost l;
05:24
<@McMartin>
Real ML also has a Haskell-like multiple-definition thing, but OCaml only has case (and calls it match x with instead of case x of).
05:25
<@ToxicFrog>
Yeah, looks like that here
05:25
<@ToxicFrog>
payload :: Tree t -> [t]
05:25
<@ToxicFrog>
payload (Leaf v) = [v]
05:26
<@ToxicFrog>
payload (Branch left right) = leaves left ++ leaves right
05:26
<@McMartin>
Shouldn't those leaves be "payload" calls?
05:26
<@ToxicFrog>
Er, yes
05:26
<@ToxicFrog>
> payload (Branch (Branch (Leaf 2) (Leaf 1)) (Leaf 3))
05:26
<@ToxicFrog>
-> [2,1,3]
05:27
<@ToxicFrog>
Ok, so I believe I have a handle on data now.
05:27
<@ToxicFrog>
This leaves class and newtype.
05:27
<@McMartin>
Of course, for a useful tree, it strikes me that what you really want is Leaf | Branch of 'a * tree * tree.
05:27
<@McMartin>
So that you can actually have binary search and stuff.
05:29
<@ToxicFrog>
Yeah.
05:30
<@ToxicFrog>
Let's keep it simple for now, though~
05:31
<@ToxicFrog>
Ok, a type class appears to be a set of types for which some operation is defined
05:31
<@ToxicFrog>
For example, anything for which == is defined is of type class Eq
05:32
<@ToxicFrog>
So if we want to make Tree part of that set, we do something like:
05:33
<@ToxicFrog>
instance (Eq t) => Eq (Tree t) where
05:33
<@ToxicFrog>
Leaf a == Leaf b = a == b
05:33 Chalcedon is now known as ChalcyAFK
05:33
<@McMartin>
OK, that doesn't have a direct ML equivalent.
05:33
<@ToxicFrog>
Branch la ra == Branch lb rb = la == lb && ra == rb
05:34
<@ToxicFrog>
Thus indicating that as long as t == t is defined, Tree t == Tree t is defined, and this is how you do it
05:35
<@McMartin>
I don't fully follow, but I'm not paying the proper level of attention
05:36
<@ToxicFrog>
Basically, this defines the == operator on the Tree type, but only for t's for which == is already valid
05:36
<@ToxicFrog>
That's the (Eq t) bit
05:37
<@ToxicFrog>
So, for example, this makes Tree Integer ==able
05:37
<@McMartin>
Nice
05:37
<@ToxicFrog>
But Tree SomeWackyNonComparableType is not.
05:37
<@McMartin>
Yeah, so, SML97 ("Real ML") has Magic Equality Types, and OCaml seems to handle structural equality purely by black magic.
05:37
<@ToxicFrog>
Because SomeWackyNonComparableType isn't in Eq, as it doesn't have a pattern match on ==.
05:37
<@McMartin>
I have a vague understanding
05:38
<@McMartin>
Let me know if you work out how monads work.
05:38
<@ToxicFrog>
Haven't even touched on monads yet.
05:39
<@McMartin>
It's how they do I/O while staying stateless, and it's a concept in abstract algebra, but that's the extent of my knowledge.
05:39
<@ToxicFrog>
I'm still trying to figure out the Show type class (the set of all types which can be toString'd, in short)
05:39
<@ToxicFrog>
Because I want to define it for my trees, and I can't figure out the exact incantations I need
05:42
<@ToxicFrog>
Awesome!
05:43
<@ToxicFrog>
instance (Show t) => Show (Tree t) where
05:43
<@ToxicFrog>
show (Leaf v) = show v
05:43
<@ToxicFrog>
show (Branch l r) = show l ++ " " ++ show r
05:43
<@ToxicFrog>
Which means the REPL can now actually print trees rather than showing an exception, although they show up as lists.
05:44
<@ToxicFrog>
The Haskell standards for these names clash with my own sensibilities; I would have called Show, for example, Showable
05:44
<@ToxicFrog>
("the set of all types on which you can call show")
05:45
<@McMartin>
"Equitable"?
05:45
<@McMartin>
Coffeeshop is closing, so I'm out of here. Back later.
05:47
<@ToxicFrog>
That's a good adjective, I'll go with that. Thankye.
05:52
<@ToxicFrog>
Ok, and it seems there's a fourth one, newtype
05:52
<@ToxicFrog>
Which is largely a convenience wrapper around data to make declaring new types, with their own operations and whatnot, that are actually old types
05:54
<@ToxicFrog>
Eg, a Natural type that is stored as an Integer, but raises errors if you try to take it below 0.
06:00 ChalcyAFK is now known as Chalcedon
06:12
<@McMartin>
Aha
06:20
<@Chalain>
Okay, long live the rule of visualization.
06:20
<@McMartin>
Hm?
06:21
<@Chalain>
I've had a real head-scratching math problem to solve. I knew in my gut that it had a simple solution (simple as in not complicated; simple here may well include dang hard to solve) but I could NOT for the life of me (or of jerith or Vornicus, heh) figger it out.
06:21
<@Chalain>
So I wrote a tool to render it by brute force so I could SEE what the stupid curve looks like.
06:22
<@McMartin>
And it's nice and clean?
06:22
<@Chalain>
Oh yes.
06:22
<@McMartin>
Woot for that, then.
06:22
<@Chalain>
So, the original problem: Tower Defense game. You're in a tower and shoot bullets of a constant speed. Monsters walk past at a constant speed.
06:23
<@Chalain>
You know their exact position and heading, and need to know how much to "lead" them so your bullet arrives where they are when they get there.
06:23
<@McMartin>
That sounds like it ought to be linear, or possibly even constant.
06:23
<@Chalain>
Taken as a triangle problem, you have one side, one angle, and the ratio of the other two sides.
06:23
<@McMartin>
Though that depends on their vector, I suppose.
06:24
<@Vornicus>
The aim direction relative to straight on depends on 1. the ratio of speeds, and 2. the direction relative to the turret the critter is walking.
06:24
<@Chalain>
Well, it's assumed that the bullet travels faster than they do. That way, even if they're moving dead away from you, the problem has a solution.
06:24
<@Chalain>
Vornicus: Yes.
06:24
<@Chalain>
So.
06:24
<@Chalain>
You wanna see some awesome cool geometry?
06:24
<@McMartin>
Yeah, part 2 was what I meant
06:24
<@McMartin>
Sounds good to me
06:24
<@Chalain>
http://www.shinybit.com/flash/scratch/dragdot.html
06:24
<@Chalain>
You can drag the big dots.
06:24
<@Chalain>
The green dot is the bug.
06:25
<@Chalain>
The yellow dot is the tower.
06:25
<@Chalain>
The red dot sets the offset angle and the ratio of green-red : red-yellow
06:25
<@Vornicus>
...holy shit, I never would have expected that one.
06:25
<@Chalain>
Yeah
06:25
<@Chalain>
Me either
06:25
<@Chalain>
...until I saw it.
06:25
<@Vornicus>
Can you calculate the center?
06:25
<@Chalain>
The little red dots are just an angular halo cast out from the bug.
06:26
<@Chalain>
Vornicus: eventually. :-)
06:27
<@Chalain>
I doodled that one in my journal today and realized that I had a captive curve from angle 0 to angle PI and realized it was some ellipsoid.
06:27 * Vornicus tries to divide by zero, get's a sound. Heee.
06:27
<@Chalain>
HAHAHAA
06:27
<@Chalain>
I put that in there for you bastards.
06:28
<@Chalain>
I made this programe because I was afraid it was an ovoid, and was hopeful it would at least be an ellipse.
06:28
<@Chalain>
I think I can figger out the center now using straight up trig.
06:28
<@Chalain>
OH!
06:28
<@Chalain>
The line between bug and tower passes through the center.
06:29
<@Chalain>
And finding the ratio along that line gives me one point on the circumference.
06:29
<@Vornicus>
Right.
06:29
<@Chalain>
I can then project a ratio through the bug to the other side, get the other circumference point.
06:29
<@Vornicus>
...and finding the other location of that ratio gives you the other.
06:29
<@Chalain>
BAM, instant center.
06:29
<@Chalain>
Yeah
06:30
<@Vornicus>
Never, ever would have thought of that.
06:30
<@Chalain>
I may not be good at math, but dammit, if I can SEE it, I can solve it. :-)
06:30
<@Chalain>
Me either.
06:30
<@Vornicus>
Ten bucks this has not only been figured out before, but that it has a name.
06:31
<@Chalain>
Vornicus: did I ever tell you about the time I made a drawing on the whiteboard, and Don Leaver spent 3 days turning it into math that got our company a engineering patent?
06:31
<@Chalain>
Vornicus: no bet.
06:31
<@Vornicus>
Several times.
06:32
<@Chalain>
But I'll GIVE you those ten bucks if you can find whoever failed to put this anywhere useful, like Google, and then beat their knees with a lead pipe.
06:32
<@Chalain>
Well, I won't tell it again, then. :-)
06:33
<@Vornicus>
all right then.
06:35
<@Chalain>
So, yeah.
06:35 * Chalain does the jommetry happy dance, and toddles off to bed.
06:36 * Vornicus actually puts money on finding it in The Elements.
06:37 ReivClass is now known as Reiver
06:38 * Vornicus eyes.
06:39
<@Chalain>
Vornicus: I wonder if this isn't a degenerate case of the focal plane/point of a parabola or hyperbola.
06:40
<@Vornicus>
Okay, that... actually seems to be about where we're headed. Sorta.
06:40
<@Vornicus>
No, no
06:40
<@Vornicus>
The circle that you get
06:40
<@Vornicus>
is the "inversion circle" of the two points.
06:40
<@Vornicus>
or, an inversion circle.
06:40
<@Vornicus>
I think.
06:42 * Vornicus examines. Are these circles coaxial?
06:42
<@Chalain>
?
06:42
<@Chalain>
define?
06:43
<@Vornicus>
Coaxial circles are a set of circles which: 1. all the circles have their centers on a single axis, and 2. all the circles share a common radical line.
06:43
< Reiver>
Chalain!
06:44
<@Chalain>
Heyas Reiv
06:44
< Reiver>
Wanna hire me for summer?
06:44
< Reiver>
:p
06:44
<@Chalain>
I'd love to! I sort of don't have a company to do that from, though....
06:44
<@Vornicus>
(the radical line of two circles is the line that, if the two circles intersect, goes through both intersection points. Note that it still exists if the circles do not intersect, but it's a bit more complicated)
06:44
< Reiver>
Darn shame, that.
06:45
<@Vornicus>
in this case the circles do not, in fact, intersect.
06:45
<@Chalain>
Vornicus: I am confused. Any two overlapping circles are by definition coaxial, no?
06:46
<@Vornicus>
Any two circles /period/ are by definition coaxial. It's when you get many circles that you start having a problem. :)
06:46
<@Chalain>
Ah, okay, and you're considering the non-concentric circles drawn at center bugDot through the red halo dots?
06:46 * Vornicus is wandering Mathworld.
06:47
<@Vornicus>
Yes.
06:47
<@Chalain>
k
06:47
<@Chalain>
Then, no
06:47
<@Vornicus>
http://mathworld.wolfram.com/CoaxalCircles.html
06:47
<@Chalain>
Because the halo dots ARE the radical line points
06:47
<@Vornicus>
No, no
06:47
<@Vornicus>
The /result/ circles, those might be coaxial to each other.
06:48
<@Chalain>
They'd form a series of lines perpendicular to the green line.
06:48
<@Chalain>
The what circles?
06:48
<@Vornicus>
The red halo.
06:48
<@Vornicus>
That's a circle.
06:48
<@Vornicus>
You move the red dot, and you get a different circle.
06:48
<@Chalain>
Ah, k.
06:49
<@Vornicus>
The more I investigate though the less likely it seems.
06:49
<@Chalain>
Well, they are all centered on a common axis, but I'm pretty sure the radical line moves.
06:49
<@Chalain>
Actually, I'm not
06:50
<@Chalain>
Hah! The common radical line passes through the yellow dot.
06:50
<@Vornicus>
That's the thinking.
06:50
<@Chalain>
Or possibly the halfway point.
06:50
<@Chalain>
But there's a limit approach there; as the line approaches the halfway point, radius -> INF
06:51
<@Vornicus>
...a true thing.
06:51
<@Chalain>
Oh
06:51
<@Vornicus>
And of course the dots would disappear as that happens.
06:52
<@Chalain>
Okay, this is me being a nonmathy visual geek, but yes, I believe they are coaxial.
06:52
<@Chalain>
Unless both sides of the circle groups are necessary.
06:52
<@Chalain>
Because, as you surmise, they do not intersect.
06:53
<@Vornicus>
They are necessary, and they do exist
06:53
<@Vornicus>
here, try this: instead of showing just one set of halo points, draw /both/, from each focus.
06:53
<@Chalain>
Ahhh, okay.
06:53
<@Chalain>
THen yes.
06:54
<@Chalain>
My renderer can't do that. It raytraces angles out from bugDot.
06:54
<@Chalain>
I can add that feature by tracing from flowerDot; By "can't do that" I mean the raytracing is why it breaks when you pass the halfway point
06:55
<@Vornicus>
Right, try raytracing angles from flowerDot too. The reason it breaks is the same reason the moon doesn't take up the whole sky.
06:56
<@Chalain>
The moon bails out after 30 iterations of Newton's approximation?
06:56
<@Chalain>
THE UNIVERSE IS SUCH A HACK!
06:56
<@Vornicus>
No, it breaks because it doesn't exist in all directions.
06:57
<@Chalain>
Oh. Well that's okay then.
07:01 * Vornicus takes a couple stabs at it.
07:03 * Vornicus does some fiddling with it, trying to find the radius and center point of circles other than the two infinitesimals.
07:06
<@Vornicus>
...yeah, they definitely /look/ coaxial.
07:08
<@Vornicus>
Yes. They are. Of course they are, we're determining the circle location by circle power, and that means of course we're dealing with radical lines, and that means of course that they're coaxial.
07:09
<@Vornicus>
Doesn't do us any good, really, but there you are.
07:15
<@Vornicus>
(the circle power of a point, for a given circle, is the product of the lengths of a line to a point on the circle, and to the other point on the circle along that same line)
07:30 GeekSoldier|work [~Rob@Nightstar-5167.pools.arcor-ip.net] has quit [Ping Timeout]
08:40 Vornicus is now known as Vornicus-Latens
08:48 Raif [~corvusign@Nightstar-25074.hsd1.wa.comcast.net] has quit [Ping Timeout]
08:51 You're now known as TheWatcher
09:28 Attilla [~The.Attil@194.72.70.ns-11849] has joined #code
10:34 Raif [~corvusign@Nightstar-25074.hsd1.wa.comcast.net] has joined #Code
10:58 GeekSoldier|work [~Rob@Nightstar-4489.pools.arcor-ip.net] has joined #code
10:59 Forj [~Forj@Nightstar-10836.ue.woosh.co.nz] has quit [Quit: Gone]
10:59 Chalcedon [~Chalcedon@Nightstar-10836.ue.woosh.co.nz] has quit [Quit: Gone]
13:05 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code
13:05 mode/#code [+o gnolam] by ChanServ
13:05 KarmaBot [~fark.off@87.72.35.ns-26506] has quit [Quit: KarmaBot manual quit.]
13:47 Thaqui [~Thaqui@Nightstar-26516.jetstream.xtra.co.nz] has quit [Quit: This computer has gone to sleep]
14:30 Reiver is now known as ReivZzz
15:59 GeekSoldier|work is now known as GeekSoldier
17:12 You're now known as TheWatcher[afk]
18:11 AnnoDomini [AnnoDomini@Nightstar-29035.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
18:11 Attilla [~The.Attil@194.72.70.ns-11849] has quit [Ping Timeout]
18:14 You're now known as TheWatcher
18:17 AnnoDomini [AnnoDomini@Nightstar-29547.neoplus.adsl.tpnet.pl] has joined #Code
18:17 mode/#code [+o AnnoDomini] by ChanServ
18:18 Attilla [~The.Attil@194.72.70.ns-11849] has joined #code
18:26 Forj [~Forj@202.74.197.ns-22410] has joined #code
18:26 mode/#code [+o Forj] by ChanServ
18:26
<@ToxicFrog>
Why did I show up for class today?
18:27
<@ToxicFrog>
This is meant to be distributed systems, not first-year networking: introduction to HTTP headers
18:27
< Attilla>
You must really like HTTP headers
18:28
<@ToxicFrog>
No.
18:28
<@ToxicFrog>
The prof apparently does, though.
18:28
<@ToxicFrog>
Since he's teaching that rather than the actual course material.
18:29
< Attilla>
Either he needs or has drunken some liquid courage!
18:52 Forj [~Forj@202.74.197.ns-22410] has quit [Quit: Gone]
18:56 Zemyla [~nsJChat@168.53.172.ns-21683] has joined #code
18:57
<@ToxicFrog>
Oh man.
18:57
<@ToxicFrog>
So the prof is going on about how we should use an array to implement the cache metadata, and people are asking, well, why can't we use a vector, or an arraylist, or an ordered dictionary, etc
18:58
<@ToxicFrog>
And he basically says "so you have practice implementing these things"
18:58
<@ToxicFrog>
ME: Excuse me.
18:58
< Zemyla>
Because he hates you and wants to see you leak memory.
18:58
<@ToxicFrog>
PROF: Yes?
18:58
<@ToxicFrog>
ME: Isn't this *Distributed Systems*, not *Introductory Data Structures*?
18:58
<@ToxicFrog>
CLASS: Ooooooooooooooo
18:59
<@Vornicus-Latens>
evil
18:59
<@ToxicFrog>
(it's Java, so memory leaks at least are not a worry)
18:59
<@ToxicFrog>
(however, the fact that he mandates Java is proof enough that he is evil)
19:00
<@ToxicFrog>
So, yeah, between this and sending out the assignments he refuses to scan to the ML, I am now pretty much in open opposition to the prof
19:01
<@ToxicFrog>
This is going to be an interesting semester
19:11
< Zemyla>
ToxicFrog: Hey! I like Java!
19:15
<@ToxicFrog>
I hate it, and personal feelings aside, telling a fourth year class that they must use Java for every assignment "because I said so"?
19:16
< Zemyla>
Okay. Eesh.
19:17
< Attilla>
Your prof sounds like a dick. My lecturers or profs seem fairly competent about telling me what needs to be known
19:17
< Attilla>
But I hear it's totally different for other courses, like Philosophy, where each lecturer or prof has separate styles for everything and so you should only consult one specific one.
19:18
< Attilla>
(At least for the purposes of coursework)
19:24
< Zemyla>
But yeah, the requirement for arrays is kind of lame.
19:26 Vornicus-Latens is now known as Vornicus
19:40 AnnoDomini is now known as Brendon
20:01
< Zemyla>
I have to go, bye everyone.
20:02 Zemyla [~nsJChat@168.53.172.ns-21683] has quit [Connection reset by peer]
20:08 Zemyla [~nsJChat@168.53.172.ns-21683] has joined #code
20:13 Brendon is now known as AnnoDomini
20:57 Thaqui [~Thaqui@Nightstar-26516.jetstream.xtra.co.nz] has joined #code
20:57 mode/#code [+o Thaqui] by ChanServ
21:24 Attilla [~The.Attil@194.72.70.ns-11849] has quit [Ping Timeout]
21:24 Thaqui [~Thaqui@Nightstar-26516.jetstream.xtra.co.nz] has quit [Ping Timeout]
21:26 Attilla [~The.Attil@194.72.70.ns-11849] has joined #code
21:31 Thaqui [~Thaqui@Nightstar-26516.jetstream.xtra.co.nz] has joined #code
21:31 mode/#code [+o Thaqui] by ChanServ
21:31 Thaqui [~Thaqui@Nightstar-26516.jetstream.xtra.co.nz] has quit [Connection reset by peer]
21:35 Chalcedon [~Chalcedon@Nightstar-10836.ue.woosh.co.nz] has joined #code
21:35 mode/#code [+o Chalcedon] by ChanServ
21:59 You're now known as TheWatcher[T-2]
22:00
< Zemyla>
Anyways, I have to go, bye everyone.
22:01 Zemyla [~nsJChat@168.53.172.ns-21683] has quit [Connection reset by peer]
22:02 You're now known as TheWatcher[zZzZ]
22:06 Zemyla [~nsJChat@168.53.172.ns-21683] has joined #code
22:26
< Zemyla>
Are any of you familiar with any form of artificial intelligence for turn-based strategy games?
22:34
<@McMartin>
I implemented an A* search about eight years ago once.
22:36
< Zemyla>
I was actually thinking more along the lines of strategic planning.
22:40 Mischief [~Genesis@Nightstar-7565.hsd1.md.comcast.net] has quit [Connection reset by peer]
23:07 Chalcedon is now known as ChalcyAFK
23:25 Zemyla [~nsJChat@168.53.172.ns-21683] has quit [Connection reset by peer]
23:26 ChalcyAFK is now known as Chalcedon
--- Log closed Wed Oct 03 00:00:33 2007
code logs -> 2007 -> Tue, 02 Oct 2007< code.20071001.log - code.20071003.log >