This is topic I'm cashing in one of my two free sympathy threads a year cards from Hatrack in forum Books, Films, Food and Culture at Hatrack River Forum.


To visit this topic, use this URL:
http://www.hatrack.com/ubb/main/ultimatebb.php?ubb=get_topic;f=2;t=022829

Posted by katharina (Member # 827) on :
 
[Frown] Please, I need a hug.

My parents are in town, and my dad makes me laugh, makes me think, makes me crazy, and always, always makes me cry. [Frown] And thinks it's funny. Stupid bully. Sorry to interrupt the celebrations here, but please, I need a hug. [Frown]
 
Posted by Synesthesia (Member # 4774) on :
 
ok
*hugs you*
 
Posted by Olivet (Member # 1104) on :
 
(((((((((((((((katie))))))))))))))))))
 
Posted by Dagonee (Member # 5818) on :
 
(((kat)))
 
Posted by ElJay (Member # 6358) on :
 
((katharina))

I understand completely. I love my father, and pretty much came to terms with him several years back... but I still want to strangle him on at least a semi-annual basis. Have strength for the rest of the visit.
 
Posted by Annie (Member # 295) on :
 
((katie))

Glad to cash it in for you sister [Smile]
 
Posted by Kama (Member # 3022) on :
 
((((kat))))

I love you, sweetie.

[Group Hug]
 
Posted by Zevlag (Member # 1405) on :
 
(((((Katie)))))

Always a shoulder here to cry on when needed.

[ March 27, 2004, 10:46 AM: Message edited by: Zevlag ]
 
Posted by Elizabeth (Member # 5218) on :
 
Hugs and warm thoughts to you, Kat.
 
Posted by Raia (Member # 4700) on :
 
((((((Kat)))))) [Frown] I'm sorry, sweetie.
 
Posted by Papa Moose (Member # 1992) on :
 
10 Print "(((kat)))"
20 Goto 10
Run

My mother-in-law is visiting this weekend, so I can empathize a little bit. Not fully, but enough to give hugs with reckless abandon.

--Pop
 
Posted by fugu13 (Member # 2859) on :
 
In the spirit of Pop's post . . .

kathugs = "(((kat)))" : kathugs

main = map putStrLn kathugs
 
Posted by LadyDove (Member # 3000) on :
 
::hugs kat::

::goes to kat's dad and attaches a whoopy cushion to his pants that expels to the tune of Jingle Bells::

::winks at kat and hugs her again::
 
Posted by Shan (Member # 4550) on :
 
Ouch. I'm sorry, sweetie. (((kat)))
 
Posted by Storm Saxon (Member # 3101) on :
 
(((kat))) [Kiss]
 
Posted by Hobbes (Member # 433) on :
 
code:
Person Kat = new Person ("Kat");
for (int i = 0; i < Kat.NumHugsNeeded (); i++) {
Kat.GiveHobbesHug ();
}

Hobbes [Smile]
 
Posted by Kama (Member # 3022) on :
 
Leto can't hug?
 
Posted by fugu13 (Member # 2859) on :
 
tch, tch, Hobbes, using a method like GiveHobbesHug. How about GiveHugFrom(Hobbes) (with Hobbes created as a person -- Person Hobbes = new Person("Hobbes");
 
Posted by saxon75 (Member # 4589) on :
 
(((kat)))
 
Posted by BYuCnslr (Member # 1857) on :
 
:: huggle ::
I understand completely
 
Posted by Jon Boy (Member # 4284) on :
 
(((Katie)))

Any time, sis.
 
Posted by fugu13 (Member # 2859) on :
 
((((Kat))))

(oh, and to save my sanity I'm going to assume those variables are all nicely encased in a block of some kind, Leto, and are thus not contaminating the global namespace -- I'm already traumatized by writing php code because of all sorts of awful practices it makes necessary).
 
Posted by fugu13 (Member # 2859) on :
 
Uh, Leto, my program was in Haskell. Namespaces don't work the same way (in fact, the language as a whole doesn't work the same was as most any language you've used, I think). And Hobbes's was preventing contamination (effectively) by using objects.

What I wrote was a complete program, btw [Big Grin]

and many more ((((((((kat)))))))) hugs.
 
Posted by Hobbes (Member # 433) on :
 
code:
#include <string.h>
#include <fstream.h>

class Person {
public:
Person () : Name (NULL), FileName (NULL), HugsNeeded (0), Hugs (0) {}

Person (char *GivenName) : Name (new char [strlen (GivenName) + 1]),
FileName (new char [strlen (Name)+5]) ,Hugs (0) {
strcpy (Name, GivenName);
strcpy (FileName, Name);
strcat (FileName, ".hug");

ifstream in (FileName);
in >> HugsNeeded;
in.close ();

out.open (FileName);
}

~Person () {out.close ();}

void GiveHug (char *Hugger) {
out << Name << " recieved a hug from " << Hugger << ", " << Hugs << " total hugs." << endl;
Hugs++;
}

void GiveHug (Person &Hugger) {
GiveHug (Hugger.Name);
}

int GetHugsNeeded () inline {return HugsNeeded;}

private:
char *Name;
char *FileName;
ofstream out;
int HugsNeeded;
int Hugs;
};

int main (int argc, char **argv) {
Person Kat ("Kat");

for (int i = 0; i < Kat.GetHugsNeeded (); i++) {
Kat.GiveHug ("Hobbes");
}

return 0;
}

Hobbes [Smile]
 
Posted by Derrell (Member # 6062) on :
 
(((kat)))
 
Posted by Hobbes (Member # 433) on :
 
(((((Kat)))))

By the way, my code compiles and works properly, I ran it. [Cool]

Let's assume a file exists in the director nameed "Kat.hug" and looks something like this:
code:
32

Hobbes [Smile]
 
Posted by Ayelar (Member # 183) on :
 
You know.... my respect for ((name)) as a form of empathy has been immeasurably lessened by seeing so many different ways of... automating it.

[Razz]

I'm sorry your family sucks, kat. Maybe a good screaming wedgie or two would get them listen.
 
Posted by fugu13 (Member # 2859) on :
 
I still say you should make the argument of giveHug a Person argument. That would open up a lot of possibilities for extension -- for isntance, you could increment in the function the number of hugs that person had given out, or maybe have an associative array as a member with keys being the names (or better, some form of unique identifier autogenerated through a Person metaclass) of people Hugs are given to so you knew who had been hugged.

I love being a geek.

((((((Kat))))))

[ March 27, 2004, 01:43 PM: Message edited by: fugu13 ]
 
Posted by blacwolve (Member # 2972) on :
 
((((Kat)))) I'm so sorry. [Frown]
 
Posted by fugu13 (Member # 2859) on :
 
(btw, Hobbes, you better hope that function actually does inline [Wink] . And I wouldn't count on it, unless you're really turning up the optimization flags. However, I definitely support writing it that way, because the number of hugs needed might change with time (which would of course be accomodated by changing the gethugsneeded method to calculate the ones currently needed at any given time).

Though in that case it would probably be better to move all hug counting logic into the Person class, and use a while loop. Actually, that would be good even now. So whenever a hug was given you internally tally up another hug, and make the loop something like this (also including my shtick about the argument of giveHug:
Person Hobbes = new Person("Hobbes");
while(Kat.needsHugs()){
Kat.giveHug(Hobbes);
}

((((((((Kat))))))))

[ March 27, 2004, 01:51 PM: Message edited by: fugu13 ]
 
Posted by Zotto! (Member # 4689) on :
 
(((Kat))) [Kiss]
 
Posted by Rakeesh (Member # 2001) on :
 
I'm sorry the benefits of having your family around come with so much baggage, Katie [Frown] You certainly deserve better, as demonstrated by your putting up with them so long (and let me tell you, that's far better than I would do)

Hope it's over quick, and that it goes with minimum jerkiness by your old man. Drop me an email if you'd like an ear to lease [Wink] (Low, low rates!)
 
Posted by fugu13 (Member # 2859) on :
 
considering you just wrote a semantically 'while' construct with a for loop, you shouldn't be talkin' on loops, Leto [Wink] .

Also, while his code is more complicated, it is also significantly more reusable, and could be incorporated, with relatively minor changes, into a number of systems. If you just want a once off solution, fine, but its often better to take a little time in the beginning and write something semantically rich, reusable, and extensible. If you tried to write a major program in the style you're writing in, it would be a very hairy undertaking. Hobbes's code would fit in just fine. (Note, this is not intended as a criticism, or even really a response to your previous comment, just an observation of the differences, as I observe the difference with mine below).

Mine was just for the sheer pleasure of mapping a print function onto an infinite list (I love lazy evaluation) [Big Grin] .

((((((((Kat))))))))

[ March 27, 2004, 02:32 PM: Message edited by: fugu13 ]
 
Posted by katharina (Member # 827) on :
 
Oh my stars, y'all are adorable.

*hugs everybody*

Thanks.

*crosses fingers, goes back in*

[ March 27, 2004, 02:39 PM: Message edited by: katharina ]
 
Posted by Hobbes (Member # 433) on :
 
I went to a lot fo steps to do it for two reasons, one is, as Fugu mentions, reuseability. I don't reuse code all that much, but I've gotten in the habit of writting code that at least can be. I feel like it's a good habit. [Smile]

Second, is that I feel that this implementation is relfective of the physcial meaning. Two people, I started off sending the function in the for loop a Person class that had been constructed with "Hobbes" because that would be even more explict representation, however I realizied that would cause file problems so I left it at sending a charecter array (though you'll notice class Person is capable of excepting a Person class when giving a hug).

Also, as a programmer, the infinite loop, while cute, struck me as overkill, and probably would kill Kat from over-hugging. [Wink] [Cool]

((((((Kat)))))) Kat's a groovy girl. [Big Grin]

Hobbes [Smile]
 
Posted by fugu13 (Member # 2859) on :
 
He did have a condition . . .

And I ran in circles, but I ran in circles intentionally [Razz] .

In fact, your for loop is the one that would run forever, you put the conditional in the wrong place. That first bit only evaluates once, and it doesn't do anything at all (its supposed to hold initialization procedures, and by its nature requires side effects for anything to happen. Your operation has no side effects). You have no conditional, and no iteration step.

So all that would happen is your for loop would call hug(Kat) forever (I'm assuming Kat is assigned a value somewhere).
 
Posted by fugu13 (Member # 2859) on :
 
Ha! Didn't even notice that overloaded method before. Nice, Hobbes.
 
Posted by fugu13 (Member # 2859) on :
 
((((((((Kat))))))))

Just to comment some more on Haskell, and break down what my program did:
code:
kathugs = "(((kat)))" : kathugs

main = map putStrLn kathugs

The first line assigns kathugs (not really a variable in the sense of a C program) a list which consists of the value "(((kat)))" followed by . . . . itself. This constructs an infinite list. In a non-lazy language, this would be a problem, because in the attempt to evaluate itself the structure would keep cycling forever. However, in a lazy language this is not problem -- I could then say something like takeFirst kathugs and it would return the first element of kathugs -- "(((kat)))", despite that there were infinitely more elements there it wouldn't bother Haskell one bit, because it ignored them, not needing them to find the first element.

The second line assigns to the variable main. Main is a special value for Haskell compilers -- its the entry point of the program, like the function main in c. The value of main must always be a function (of type IO) that takes no arguments. However, Haskell has a really, really good type inference system, so in most programs you never need to write out a type signature.

the value of main is map putStrLn kathugs. This just maps the function putStrLn (which outputs a string with a newline) to the list kathugs. Since Haskell is lazy, it does it to one element after the other, not caring what all the elements afterwards are until it gets to them. As such it keeps going forever down the infinite list.

Its worth pointing out that while my program used recursion, it did not use any loops.
 
Posted by Corwin (Member # 5705) on :
 
((((Katie)))) Don't worry, be happy ! (always works...)
 
Posted by T_Smith (Member # 3734) on :
 
::shakes head solemly at Fugu and Hobbes::

Heya Katie! Sorry thats happening to you, and sorry theres not much I can do about it, otherwise I would. Also, sorry that I have no advice, or silly little code to put here. But hey, you're totally awesome and cool!

(((((katie)))))
 
Posted by larisse (Member # 2221) on :
 
{{{{Kat}}}} <-- Those were freely given. [Smile] No cashing of any sympathy thread a year card here.

I know it can be a difficult thing when family can make you feel horrible. It seems to go against all logic. People who are family -- blood -- should know how not to hurt you, but more often than not the opposite is true. Just remember that family is a not only a word defined by genetics but by the spirit, and you definitely have some family here.

Keep your spirit up.
 
Posted by Farmgirl (Member # 5567) on :
 
((Kat))

But, you know -- if you want, you can send your dad over here. He can pretend to be MY dad for awhile..

..because somedays I would love to just have a dad, for one more day -- my dad, your dad, any dad... just have a dad again....

Farmgirl
 
Posted by karen.elizabeth (Member # 6345) on :
 
((kat))
 
Posted by Ryuko (Member # 5125) on :
 
I only laughed when I saw Pop's code. I can actually understand that code!!!

Anyhow, I'm sorry kat. (hugs kat) My dad sometimes comes close to that... he usually steps back before I get REALLY upset.
 
Posted by ClaudiaTherese (Member # 923) on :
 
(((katharina)))

If I were there, I'd hide out in the bathroom with you. Or we could sneak out the back door and grouch about life together. *smile

Just remember, it will be over eventually. It may be awful meanwhile, but it will be over, and you will have your own space to yourself. I'd suggest some milk & cookies and a LM Bujold book myself, but you can figure out what's best for you.

I'm sorry you have to go through with this. Don't worry, you get all the sympathy cards you want.
 
Posted by amira tharani (Member # 182) on :
 
*sends Kat a transatlantic hug*
 
Posted by tonguetied&twisted (Member # 5159) on :
 
(((((kat)))))
 
Posted by aka (Member # 139) on :
 
code:
 
| |
| KatSad HugKat |
+----| |---------------( )---+
| |
| HugKat DadBad KatSad |
+----|\|-----| |-------( )---+
| |
| |

I'm implementing mine in hardware.

Kat, you got you some good geeklovin in this here thread.
 
Posted by rivka (Member # 4859) on :
 
(((((kat))))) I'm sorry the much-anticipated visit is causing you pain. [Frown] Family is complicated!!! Good luck, sweetie -- and hugs whenever you need 'em!

(((((((((((((((kat)))))))))))))))
 
Posted by Trogdor the Burninator (Member # 4894) on :
 
**burninates kat's Dad**

**hugs kat**
 
Posted by Ela (Member # 1365) on :
 
((((Hugs Kat))))
 
Posted by Sopwith (Member # 4640) on :
 
(((Kat)))
 
Posted by Bokonon (Member # 480) on :
 
For the record, I prefer fugu's way, but with a change. The giveHug() method should be receiveHug(), or even receiveHugFrom().

Otherwise it is unclear which Person object is being modified.
--

You'll be alright, kat.

-Bok
 
Posted by Ralphie (Member # 1565) on :
 
[Frown]

You have my free sympathy. But you have to stop saying "oh my stars."
 
Posted by Kama (Member # 3022) on :
 
<-- likes when kat says "oh my stars"

[Razz]
 
Posted by Ralphie (Member # 1565) on :
 
Okay... bought milk... vaccuumed office... caught up on world events... no, no "ask Kama what her opinion is on anything" here.

I'm afraid you're not on the list, Kama.
 
Posted by Kama (Member # 3022) on :
 
whatever. I'm still sexier than you.
 
Posted by Ralphie (Member # 1565) on :
 
Damn.

True. [Frown]
 
Posted by Kama (Member # 3022) on :
 
*pat pat*
 
Posted by Noemon (Member # 1115) on :
 
((katharina))

::sits companionably with kat::

::Would be very disappointed if she stopped saying "oh my stars"::

You know, ever since the thread where we cast various hatrackers as LOTR characters, and kat was tapped as Lobelia Sacksville Baggins, I've had this image of someone saying something that she found shocking, and kat saying "Oh my stars!", and whomping them over the head with her umbrella (for the complete mental image, imaging Scarlett Johansson as a hobbit wielding the umbrella, and you'll see it much as I have been for years, long before I was aware of Johnasson's existance.
 
Posted by BannaOj (Member # 3206) on :
 
*hugs kat*

hope things are going ok.

AJ
 
Posted by katharina (Member # 827) on :
 
*happy for this thread* [Smile]

The oh my stars is not going to stop. I'm sorry, Ralphie. On the list of positive things from this weekend, however, is hearing my dad say it. Whether I got it from him or he got it from me, I don't know, but it is definitely in the family.

Y'all have no idea how much this helps. I simply love Hatrack. Thank you. [Smile]

[ March 30, 2004, 01:05 PM: Message edited by: katharina ]
 
Posted by Hobbes (Member # 433) on :
 
((((((((((((((Kat))))))))))))))

I don't really have any advice except to say we all love you here... and you're darn groovy. [Big Grin]

Hobbes [Smile]
 


Copyright © 2008 Hatrack River Enterprises Inc. All rights reserved.
Reproduction in whole or in part without permission is prohibited.


Powered by Infopop Corporation
UBB.classic™ 6.7.2