http://www.perlmonks.org?node_id=163332

Hey all,

As I awoke this morning to the lovely sound of my alarm clock, it disturbed a dream in which I was doing some code development for my University in Perl. For some odd reason, I found myself wishing I could program my alarm clock - people want weird things when they're sleepy and whatnot.

As much as I hate to admit it, this isn't the first time I've dreamt about the language - but it's the only language that's really gotten into my mind at points aside from C.

Another oddity is that in my dream, I solved a piece of code I'd been fighting the day before - once I got up, I wrote out the code, and have spent part of the day interpreting sleepy scrawl into lovely CGI.

Back in my hardcore MUD developer days, once in awhile I'd dream up a new MUD spell, including a little C code for the MUD's codebase (a mesh of Merc and Diku, available at http://www.dawnoftime.org last I checked).

I'm curious if any other Monks have had sleepy meditations about code, and if so, has it actually been something productive? =)

~Brian

Replies are listed 'Best First'.
Re: Dreaming about Perl
by mojotoad (Monsignor) on May 01, 2002 at 19:00 UTC
    All I can say is be glad that you're dreaming about Perl rather than Tetris. <shudder>

    Back in school I used to dream in code and equations, depending on what I was studying at the moment. I tried my darndest one morning to integrate the alarm clock, knowing for sure that if I concentrated hard enough and figured out that integral, the infernal thing would pipe down.

    It is a weird feeling, that's for sure -- at the time it makes perfect sense, too. You're lucky if the solution you came up with really was lucid.

    Matt

      Back when learning Perl, I was hacking away at a parser for some data generated by someone elses CGI program. I was doing it in my sleep. As the regexes got harrier and harrier I tried harder to beat them down. I found it hard to apply a regex to this one string of data, which was in fact aural, not textual . . .I figured if I could s/\Abeep\E// then the alarm would shut off. It made some much sense, that I continues to deal with the alarm clock as a pattern to match against as I dressed. It wasn't for an hour till I realized I needed to turn it off.

      Cheers,
      Erik
      I dreamed about Tetris, when I was younger. I loved the Tetris i had, because it wasn't too fast. In the highest level it was hard, but not unplayable. But it had a bug, the score was a 16bit signed int, so you could have negative scores, but they were bigger than the positives, so my best score was -6. (The ugly thing was, that you got 100 points, when a line vanished, and more than once i had +100 or so. Back to dreaming: I remember seeing the stones falling down before falling asleep.

      Until now i never dreamt about perl, but i remember dreaming about math. And the ugly way: "This inequality is wrong." (It was right, a very bad thought, if you wake up in the morning and think this about the exercises that are due today.)

Re: Dreaming about Perl
by vladb (Vicar) on May 01, 2002 at 18:59 UTC
    Actually, I too had a share of weird dreams throughout my 'creative' life as a programmer. Since after I started coding Pascal intensively at age 13, I would get those dreams where I would continue hacking away at a piece of code that I didn't quite finish in the day.

    The most weird thing though is that there were many times when I would wake from such a dream, rush back to my computer and type out whatever I did in the dream.. and know what? many times it would work with minimal debugging!! I swear to it! ;-). Further, most of my toughest challenges were solved while I was asleep. Simply amazing.. nothing special, but amazing...

    No wonder some companies are willing or even eager to claim and pay for any coding that takes place outside normal work hours (up to and including dreams!).



    "There is no system but GNU, and Linux is one of its kernels." -- Confession of Faith
      What you have there is a classic example of the problem solving abilities of your subconcious mind. The human mind has two modes of operation. A rapid fire immediate mode and a long-term, slow-burn subconcious mode.
      While the second is ultimately the best problem solver, our society cultures and rewards the first. People are rewarded for quick snap decisions, and punished for "goofing off" when what they are really doing is letting the subconcious weigh facts and solve problems.
      Einstein used to spend days in his office, staring at the window, letting his subconcious work.
      There is a great book on this subject: Hare Brain, Tortoise Mind : How Intelligence Increases When You Think Less. I highly recommend it.
      I have been relying on my tortoise mind for years. Whenever I have a problem that I can't solve, I take a shower. I get the water really hot and shut down my hare brain. Chances are by the end of the shower I have solved the problem with a flash of inspiration. I'm standing there thinking of nothing, or thinking of something completely unrelated to the problem and bam the answer is there.

      -pete
      "Pain heals. Chicks dig scars. Glory lasts forever."
Re: Dreaming about Perl
by dws (Chancellor) on May 01, 2002 at 19:12 UTC
    I'm curious if any other Monks have had sleepy meditations about code, and if so, has it actually been something productive?

    I am not a morning person, and don't wake easily. Sometimes it takes a while for the brains cells to power up, assemble, and complete their morning self-check. In the interim, thinking gets... wacky.

    Who am I? And what am I doing in this regex?

    Need. X10. To. Turn. Off. Alarm. Automatically.

    Ugh. While I was asleep, everyone converted to Perl 6. Gotta learn Perl 6.

        I am not a morning person, and don't wake easily. Sometimes it takes a while for the brains cells to power up, assemble, and complete their morning self-check.

      I can relate to that. I almost never come up with anything while I'm asleep but on many occasions when I'm away from the computer and not thinking about anything computer related, coding solutions will just pop into my head. The solutions are usually correct and come just at about the time I'm ready to throw up my hands.

      Unfortunately I'm the kind of person that once I start coding, I can't stand to stop, particularly if I've run into an obstacle. I think if most people forced themselves to take short breaks from coding, they'd find that their productivity increases.

      BTW, narcoleptic episodes don't count as short breaks do they? ;-)

      --Jim

Re: Dreaming about Perl
by Mr. Muskrat (Canon) on May 01, 2002 at 20:14 UTC

    I tend to dream about things that I spend large amounts of time doing. If I'm putting together a web site, I'll dream of HTML, JavaScript and the like. If I'm programming, I'll dream about whatever language that I'm using.

    On many occasions I have awoken with the solution to a problem that I had been working on the previous day (or month for that matter).

    However, dreaming in code is not always productive...
    I also have a problem of coding myself into an infinite loop. I'll keep dreaming the same sequence of code over and over again until when I finally wake up, I'm exhausted from all of the stress the dream brought on.

    And as for programming the alarm clock...
    Sometime between the alarm going off and my brain waking up, I have a tendency to try to program it. Hitting the buttons in a cryptic sequence that in my dream makes perfect sense. Then one of two things happen.

      1) I wake up and turn the alarm clock off (if it hasn't been silenced by my button pushing).
      2) I wake up several hours later and realize just how late I am!

    Matthew Musgrove
    Who says that programmers can't work in the Marketing Department?
    Or is that who says that Marketing people can't program?
Re: Dreaming about Perl
by Juerd (Abbot) on May 01, 2002 at 19:23 UTC

    I'm curious if any other Monks have had sleepy meditations about code, and if so, has it actually been something productive

    Yes, I have, yes, it has. Related to this is Re: Re: Math::MagicSquare::Generator - a quote: I realised I was thinking in terms of Perl code.

    I have this a lot. Sometimes I wake up and use my laptop to translate my thoughts to ascii immediately, because my memory is terrible. I hate it when people wake me, because I may have been creating a killer-app in my mind, without consciously knowing about it :)

    - Yes, I reinvent wheels.
    - Spam: Visit eurotraQ.
    

Re: Dreaming about Perl
by thraxil (Prior) on May 01, 2002 at 20:31 UTC

    i learned haskell in my sleep. in particular, it was the night before my Programming Languages and Translators final and i had come down with some kind of really nasty cold/flu. i was desperately trying to get a grasp on the concept of lazy evaluation but i couldn't really concentrate for more than about 5 seconds at a time. when i finally gave up and closed my textbooks and went to bed, i was totally lost. over the night, i faded in and out of semi-consciousness as one tends to do when fevered. i have vague memories of bits of haskell and various abstract geometrical and mathematical concepts floating around my head with no real structure or consciousness to direct them. in the morning, everything was perfectly clear. somehow my unconscious had taken all the little bits that i'd read and played around with them till they fit together into something coherent.

    anders pearson

Re: Dreaming about Perl
by chicks (Scribe) on May 02, 2002 at 13:50 UTC

    I've heard geeks recount this sort of thing several times. I found this account interesting. Anyway, geeks are initially shocked that they're dreaming about something other than 3d reality, but when they talk about it they realize it's pretty common and normal. Geek culture is a wonderful thing.

    Still this raises so many interesting questions in my sleep-deprived mind. 1) What are people's favorite languages to dream in? If we eliminate perl as being the obvious choice for everyone around here, what is your second most favoirate language to dream in? 2) I like looking at the psychology of these things, so even more interesting to me would be, what languages have caused you nightmares? 3) What languages cause people to be more depressed? It's a good thing I'm not a tenured psychology professor.

Re: Dreaming about Perl
by Cyrnus (Monk) on May 02, 2002 at 02:48 UTC
    One day last week I was dreaming about tracing code through a loop. All I remember now about the code was that the loop condition was $alarm eq "on" and the first line in the loop was press('snooze'); Needless to say I hit the snooze button at least 20 times that morning, I'm just glad it was a saturday. John
Re: Dreaming about Perl
by Putzfrau (Beadle) on May 03, 2002 at 15:07 UTC
    Although dreaming about programming languages and solutions to various probles occurs frequently, the weirdest thing that every happened to me involved precience(? clairvoyance perhaps) and the worst case of deja vu...

    I am currently doing my comp sci stage at company X. 3 months ago i had an interview there to see if i was the person they required for the position. That night I dreamt that i had been accepted and started working there on a rather difficult problem involving some Perl code.

    Now the odd part of this story is that the problem involved socket programming, a topic we hadn't covered in class and only briefly read about in the camel book. Yet, in the dream i was able to solve said problem...

    On the first day here at stage, about a month ago today, i was introduced, etc. then i was shown my cubicle... which was exactly like the one from my dream. Same view, layout, even the color of the padded walls. Deja Vu. Yet i recalled that i had passed this empty cubicle during my interview so i quickly wrote this off.

    The first few days went by, and on the fourth day i met the resident Perl guy and his little project... a small client/server chat program written in Perl. Odd. Says I. as he showed me the workings of his basic script he explained that the part he was stuck on was the socket manipulation section. Anxiety rising. Which matched the problem in my dream before. At that moment the solution popped in my head and I quickly fixed the problem right there...

    Ever since then ive slept with a pad of paper and pencil on my cardboard box nightstand.. Please excuse the lengthy narative

    "Your baudrate depends on the size of your pipe". -Alex Simonelis
Re: Dreaming about Perl
by pepik_knize (Scribe) on May 03, 2002 at 14:24 UTC
    I'm curious if any other Monks have had sleepy meditations about code, and if so, has it actually been something productive

    Oh, you bet. It's called Perlgolf. I'm currently dreaming about this month's course, and I swear last night I came up with a way to shave ~50 strokes off my score. But then I had to go on tour with Aerosmith, who was only covering Queen songs in West Texas near McDonald Observatory.

A reply falls below the community's threshold of quality. You may see it by logging in.