POV-Ray : Newsgroups : povray.off-topic : 10 things to use a Min Heap for Server Time
7 Sep 2024 23:27:42 EDT (-0400)
  10 things to use a Min Heap for (Message 61 to 70 of 108)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Darren New
Subject: Re: (Tainted)
Date: 20 Jun 2008 16:56:18
Message: <485c1972$1@news.povray.org>
Orchid XP v8 wrote:
> I meant that you could write the loop and the processing logic as a 
> single function, if you really wanted to. 

I've done that, by declaring a lambda that I then pass somehere else. 
It's uglier in Erlang, is all.

> True, but there shouldn't be very many of those.

It's still bad engineering. :-)

>> I.e., since looping requires recursion, every time you change what 
>> data persists between iterations, you have to change all the recursive 
>> calls. Maybe the state monad helps, and you could probably do the same 
>> thing by wrapping your stuff in a record in Erlang, but that's just 
>> really covering up the problem, in some ways.
> 
> Not sure what gave you that idea... Add a field to the data structure, 
> and only the places that use that new field have to care about it. It's 
> a lot less work than passing lots of parameters individually.

For one, you wind up passing everything in the record to every function, 
whether it needs it or not.

Say I want a counter for how many times I call X. That goes in the 
record, and X increments it.  But it also gets passed to Y and Z.

> Parsec allows you to write parsers without needing to explicitly build 
> state machines. 

Yeah. Erlang has the same sort of thing, called gen_fsm.

It's still not obvious when you're actually using the control flow 
(i.e., the program counter) as part of your state how the control flows. 
That's probably my problem - still used to using the PC as part of the 
program state.

> Hmm, let's see:
> 
>   word <- untilM valid_word ask_for_word
>   numb <- untilM valid_numb ask_for_numb
> 
> (Haskell has a function called "until", but there is no untilM function 
> for some reason. However, it is not hard to implement.)
> 
> Depending on how complex the validity and requesting code is, 

Part of the problem is that you're supposed to crash out in Erlang if 
you get an error. So saying "did you read an integer" at all is a mess.

> Well... I guess it depends on just how complex your flow control is. 

Yeah. I actually even wrote up the control flow, somewhere.  Anyway, 
just saying, that's the problem right now. Every choice winds up being 
nested and nested, unless i'm just doing something wrong. </rant>

-- 
Darren New / San Diego, CA, USA (PST)
  Helpful housekeeping hints:
   Check your feather pillows for holes
    before putting them in the washing machine.


Post a reply to this message

From: Mueen Nawaz
Subject: Re: 10 things to use a Min Heap for
Date: 20 Jun 2008 17:41:18
Message: <485c23fe$1@news.povray.org>
Invisible wrote:
>>> Er... last time I checked, Google doesn't even *employ* people in the 
>>> UK! :-P
>>
>> http://www.google.co.uk/intl/en/jobs/index.html
> 
> Damnit, I'm *sure* I looked into th- oh, wait. London.
> 
> I wouldn't work in London if you *paid* me for it! :-P

	Well, no one was suggesting you work for free...

-- 
recursion, n.: see recursion.


                     /\  /\               /\  /
                    /  \/  \ u e e n     /  \/  a w a z
                        >>>>>>mue### [at] nawazorg<<<<<<
                                    anl


Post a reply to this message

From: Orchid XP v8
Subject: Re: 10 things to use a Min Heap for
Date: 21 Jun 2008 04:09:59
Message: <485cb757$1@news.povray.org>
>> going over TCP/IP, and the subject of class-A/class-B/class-C networks 
>> came up. 
> 
> Did anyone point out that nobody uses class-A, class-B, or class-C 
> routing any more? :-)

No. ;-)

Well, I suppose you could argue that virtually every network you're ever 
likely to touch in your entire life will be a class-C network... Unless 
you work for a Tier-1 carrier anyway.

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Doctor John
Subject: Re: 10 things to use a Min Heap for
Date: 21 Jun 2008 08:11:19
Message: <485cefe7$1@news.povray.org>
Invisible wrote:
>>> Er... last time I checked, Google doesn't even *employ* people in the
>>> UK! :-P
>>
>> http://www.google.co.uk/intl/en/jobs/index.html
> 
> Damnit, I'm *sure* I looked into th- oh, wait. London.
> 
> I wouldn't work in London if you *paid* me for it! :-P
> 
...and what's wrong with London (apart from the fact that Stephen and I
both live here)?
Incidentally, I live literally five minutes walk from Belgrave House.
I'm sure I mentioned it when we met in Sin City ;-)

John

-- 
I will be brief but not nearly so brief as Salvador Dali, who gave the
world's shortest speech. He said, "I will be so brief I am already
finished," then he sat down.


Post a reply to this message

From: Darren New
Subject: Re: 10 things to use a Min Heap for
Date: 21 Jun 2008 13:50:12
Message: <485d3f54@news.povray.org>
Orchid XP v8 wrote:
> Well, I suppose you could argue that virtually every network you're ever 
> likely to touch in your entire life will be a class-C network... 

Or smaller. Or unless you have an internal network at a corporation, say.

-- 
Darren New / San Diego, CA, USA (PST)
  Helpful housekeeping hints:
   Check your feather pillows for holes
    before putting them in the washing machine.


Post a reply to this message

From: Invisible
Subject: Re: 10 things to use a Min Heap for
Date: 23 Jun 2008 04:07:27
Message: <485f59bf$1@news.povray.org>
>> I wouldn't work in London if you *paid* me for it! :-P
>>
> ...and what's wrong with London?

Heh. Where to start?

It's old, dirty, overcrowded, expensive, and it looks like the decaying 
ruins of a fallen civilisation. What's to like?

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Invisible
Subject: Re: (Tainted)
Date: 23 Jun 2008 04:10:51
Message: <485f5a8b$1@news.povray.org>
>> True, but there shouldn't be very many of those.
> 
> It's still bad engineering. :-)

Abstract it out then. Make it a seperate function.

>> Not sure what gave you that idea... Add a field to the data structure, 
>> and only the places that use that new field have to care about it. 
>> It's a lot less work than passing lots of parameters individually.
> 
> For one, you wind up passing everything in the record to every function, 
> whether it needs it or not.
> 
> Say I want a counter for how many times I call X. That goes in the 
> record, and X increments it.  But it also gets passed to Y and Z.

And this is bad because...?

> It's still not obvious when you're actually using the control flow 
> (i.e., the program counter) as part of your state how the control flows. 
> That's probably my problem - still used to using the PC as part of the 
> program state.

OK - well that's a fairly low-level way of thinking about flow control.

> Part of the problem is that you're supposed to crash out in Erlang if 
> you get an error. So saying "did you read an integer" at all is a mess.

Yeah, Haskell's default compiler-generated stuff for parsing expressions 
assumes the program will just crash if the string isn't valid. (There is 
a hack - you can ask it to parse a list of values, and if it's not 
parsable you'll get an empty list. But now how do you tell the 
difference between a parser error and an empty list?)

Fortunately, you can use Parsec to do "real" parsing with actual error 
messages and so forth if necessary.

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Stephen
Subject: Re: 10 things to use a Min Heap for
Date: 23 Jun 2008 05:05:36
Message: <aqpu54hfsl4gqd32314vhf20kli7eim5dn@4ax.com>
On Mon, 23 Jun 2008 09:07:27 +0100, Invisible <voi### [at] devnull> wrote:

>>> I wouldn't work in London if you *paid* me for it! :-P
>>>
>> ...and what's wrong with London?
>
>Heh. Where to start?
>
>It's old, dirty, overcrowded, expensive, and it looks like the decaying 
>ruins of a fallen civilisation. What's to like?

It's got character, it's exciting and the streets are paved with gold.
It is also bad form, old chap to slag off in public, where people
live. (Social etiquette rule #10)

-- 

Regards
     Stephen


Post a reply to this message

From: Doctor John
Subject: Re: 10 things to use a Min Heap for
Date: 23 Jun 2008 05:15:27
Message: <485f69af@news.povray.org>
Invisible wrote:
>>> I wouldn't work in London if you *paid* me for it! :-P
>>>
>> ...and what's wrong with London?
> 
> Heh. Where to start?
> 
> It's old, dirty, overcrowded, expensive, and it looks like the decaying
> ruins of a fallen civilisation. What's to like?
> 
Woah, there! Be careful of what you speak!
I agree that London's old - that means it's got over 2000 years of
history behind it and that is fascinating in itself. I've lived here
most of my life and I'm still finding new places to visit.
Dirty? Only in the same way that many large cities are dirty. We have a
problem with clearing litter especially in the main tourist
thoroughfares but part of that is down to the tourists themselves;
residential areas are a totally different ballgame.
Overcrowded? Less than 8M people in an urban area that is 32km north to
south and 50km west to east. That is _not_ crowded.
Expensive? I'll give you that. We are the second most expensive in the
world (after Moscow). Of course that means that salaries have to be
commensurately higher to compensate :-)
Your final comment I will treat with the contempt it deserves. If you
had travelled on any scale you would have encountered many places that
would scare the s**t out of you and cause you to seek immediate medical
attention for the multiple infections you would be scared you had caught
whilst visiting them. London is not one of them.
I liked meeting you, Andrew, but please don't lower my opinion of you by
ill-informed mocking of a city that I love.

John (feeling well p***ed-off)

-- 
I will be brief but not nearly so brief as Salvador Dali, who gave the
world's shortest speech. He said, "I will be so brief I am already
finished," then he sat down.


Post a reply to this message

From: Invisible
Subject: Re: 10 things to use a Min Heap for
Date: 23 Jun 2008 06:06:29
Message: <485f75a5$1@news.povray.org>
>> It's old, dirty, overcrowded, expensive, and it looks like the decaying 
>> ruins of a fallen civilisation. What's to like?
> 
> It's got character, it's exciting and the streets are paved with gold.

I never did quite get that - surely gold is the worst possible material 
to pave streets with, no? ;-)

> It is also bad form, old chap to slag off in public, where people
> live. (Social etiquette rule #10)

Really? Nobody seems to have the slightest problem with repeatedly 
telling me that Milton Keynes is a dump that should never have been 
built, etc.

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.