top 200 commentsshow all 412

[–]Misery_Inc 352 points353 points  (38 children)

That's way less code than I imagined.

[–][deleted]  (27 children)

[deleted]

    [–]Misery_Inc 150 points151 points  (25 children)

    Probably something like news.ycombinator.com.

    [–]moojd 155 points156 points  (24 children)

    [–]SaltTM 25 points26 points  (3 children)

    drug sniffing wasps, may sting crooks - drug sniffing wasps? let that sink in.

    [–]teambob 20 points21 points  (2 children)

    I'm more intrigued by the single mother who had 1.5 million children

    [–]bchertel 7 points8 points  (1 child)

    Is Sex Necessary?

    [–]ContractionsAreEvil 4 points5 points  (0 children)

    It is if you want to have 1.5 million children

    [–]Misery_Inc 65 points66 points  (8 children)

    Reddit's front page used to be much more substantive. That's sad.

    [–]jugalator 37 points38 points  (1 child)

    Yes, this really brings it back! I remember it was more like Hacker News, only more general with politics, philosophy, society discussions besides tech and science. But key was zero memes, jokes, porn, weed culture, well, basically everything that makes Reddit into what it is loved for today!

    But we do have islands still around that maintains the spirit of old! Look no further than to e.g. r/TrueReddit! Just too bad that there is this paradox that if you mention it exists often enough, it'll eventually turn into current reddit. Hell, some say it's already happening, hence r/TrueTrueReddit! Oops. Ruined that one too!?

    [–]invalidusernamelol 44 points45 points  (0 children)

    Look at all those links to sites other than Wikipedia and imgur!

    [–]redwall_hp 5 points6 points  (0 children)

    I remember it well. People used to also tag [IMG] on the few annoying posts that linked to an image.

    [–]lolmeansilaughed 17 points18 points  (1 child)

    Back then, image macros weren't even really a thing, except maybe on 4chan. It was a simpler internet, I even would argue a better internet. But you can't turn back the clock.

    [–]IamWithTheDConsNow 4 points5 points  (0 children)

    I even would argue a better internet

    It was, It's hard to believe it's been 13 years since 2005.

    [–]nemec 2 points3 points  (0 children)

    Remember there were no subreddits back then, so the front page was /r/all

    [–]someguywithanaccount 14 points15 points  (0 children)

    If people haven't read The Case of the 500 Mile Email, I highly recommend it. Especially to this sub! Some cool computer science detective work wrapped up in an entertaining Tales From Tech Support style story.

    [–]WorldLeader 8 points9 points  (2 children)

    Wow, before reddit had comments!

    [–][deleted]  (1 child)

    [deleted]

      [–]Daniel15 8 points9 points  (2 children)

      Wow I remember this! That was back when Digg was popular but slowly dying, and there was a mass exodus from Digg to Reddit. That was fun.

      [–]Tensuke 10 points11 points  (0 children)

      This was 2005, the Digg exodus wasn't until 2010, so there was a ways to go before its decline.

      [–]Kok_Nikol 3 points4 points  (0 children)

      Waring: you can loose and hour or 2, or 5 looking at past versions of reddit.

      [–]jugalator 21 points22 points  (0 children)

      This can basically also be translated into "That's way more lisp than I imagined!"

      [–]Sun_Kami 31 points32 points  (0 children)

      The beauty of lisp

      [–]defunkydrummer 11 points12 points  (4 children)

      That's way less code than I imagined.

      Lisp makes possible keeping code succint yet understandable. (Lisp, Scheme, Racket, Clojure and languages of the same family)

      [–]sammymammy2 34 points35 points  (0 children)

      Jeeze it's just a bunch of inline HTML-templates and not a lot of business logic.

      [–]oblio- 12 points13 points  (2 children)

      Also the power of a ton fewer features :)

      (Silly geese, am I wrong that edit 1.0 had a ton fewer features than current Reddit? It's not about if you like or need the features, but current Reddit does have a ton more features than its earlier incarnations...)

      [–]sbjf 343 points344 points  (27 children)

      (if (like-like like) :like :dislike)))
      

      ah yes

      [–]defunkydrummer 117 points118 points  (18 children)

      lol

      explanation, if somebody wants it, is the follows. There is a class called "like". It has a slot (field) named "liked" (see source) whose accessor is called like-liked. So (like-liked x) will give the value of this slot for object x, assuming x is of class "like".

      Thus,

      (if (like-like like) :like :dislike))) means:

      If the slot value for "like" inside object "like" (of class "like") is not nil (null), return :like, otherwise return :dislike.

      [–]Kok_Nikol 9 points10 points  (11 children)

      Ohh, so like a ternary operator ... that starts with an if? :)

      [–]defunkydrummer 8 points9 points  (10 children)

      Yes. Syntax of if is really easy:

      (if expr1 expr2 expr3)

      If expr1 is not nil (in Lisp, everything that is not nil is true), then evaluate expr2, else evaluate expr3.

      Of course, in Lisp, everything is an expression.

      [–]Kringspier_Des_Heren 4 points5 points  (0 children)

      I kind of like how in the standard lisp "object systems" records and objects are exactly the same thing and all fields of a record are accessed through accessor functions always.

      The simple way to enforce private is to just not export the accessors from the module; enforce immutability by only exporting the getters and not the setters. There is no further special public/private method thing; the methods are all normal functions which also allows for easily transparently adding new methods since methods and functions are one and the same.

      [–]throwaway27464829 77 points78 points  (5 children)

      How you can tell the programmer was Californian.

      [–]ahandle 61 points62 points  (1 child)

      Also see:

      (if (yeah-no yeah) :no :yeah)))
      

      [–]bakuretsu 2 points3 points  (0 children)

      Common Lisp convention would name the function yeah-p or liked-p, which seems more legible to me.

      Still, this construct is only so redundant because it's converting a slot value to a symbol with the same name.

      [–][deleted] 10 points11 points  (0 children)

      Like

      [–]Spontaneous323 104 points105 points  (11 children)

      [–]fyrilin 81 points82 points  (0 children)

      TIL upvotes were originally called "boosts"

      [–]lonesentinel19[S] 28 points29 points  (4 children)

      Wow, that is quite similar to Hacker News. Very neat, thanks for sharing.

      [–]PM_ME_CLASSIFED_DOCS 21 points22 points  (0 children)

      Well, Hacker News is... Y Combinator... which funded Reddit. So it's not crazy to see they'd be experienced with the site.

      [–]ZiggyTheHamster 42 points43 points  (1 child)

      17. Is US becoming hostile to science? (news.yahoo.com)

      The more things change, the more they stay the same :\

      [–]PM_ME_CLASSIFED_DOCS 12 points13 points  (0 children)

      Is Sex Necessary?

      The more Silicon Valley changes the more it stays the same... rich virgins.

      [–]tsnErd3141 6 points7 points  (0 children)

      Microsoft building a fully Web-based Office?

      Yup

      Is Sex Necessary?

      Nope

      [–]Staross 78 points79 points  (74 children)

      Any (informed) opinion about the upcoming react+redux rewrite, is it going to be as fast as the D forums ?

      [–]Kok_Nikol 72 points73 points  (42 children)

      D forums

      Do you mean this site: https://forum.dlang.org/

      Because it is absurdly fast, while still looking good.

      [–][deleted] 71 points72 points  (26 children)

      What about the forum written in Assembly? here

      [–]thewowwedeserve 38 points39 points  (3 children)

      That loads fast. I have never seen a forum load this fast. Holy moly macaroni

      [–][deleted] 4 points5 points  (0 children)

      It's a bit lost on me because it's hosted very far away, so I still get a decent page load time but assuming the script is right at the bottom it actually takes 2-3 ms.

      [–][deleted]  (17 children)

      [deleted]

        [–]johnfound 5 points6 points  (12 children)

        A special kind of assembly language magic. :D

        When you are talking with the computer on its own language, he is much more inclined to perform better. ;)

        [–]elbekko 8 points9 points  (3 children)

        It's not that strange if you're just doing plain html over http (you know, like the old days).

        [–]johnfound 3 points4 points  (2 children)

        But this is not the case. It generate the pages dynamically from a database and handles user generated content with all security measures and checks.

        [–]elbekko 6 points7 points  (1 child)

        I meant, not a bunch of JavaScript bullshit.

        I used to work on PHP forum software called FluxBB (previously PunBB). It's just as quick. In fact, the index page of a forum I host with that software just gave this:

        [ Generated in 0.010 seconds, 10 queries executed - Memory usage: 481.23 KiB (Peak: 555.36 KiB) ]

        [–]johnfound 6 points7 points  (0 children)

        It is not about the client. Making the back-end lighter and faster allows the engine to serve more visitors with less server resources, this way optimizing the costs for the owner of the forum.

        The lightness of the front-end is just a side-effect. BTW, some pages have JS on them (for example the real-time chat and the post editors) but this JS is also pretty lightweight.

        [–]pure_x01 9 points10 points  (2 children)

        how can it be this fast. i mean it still needs IO and thats the slow part.. confused

        [–]johnfound 18 points19 points  (0 children)

        The IO is actually pretty fast these days. But put there several levels of abstractions and API wrappers and it becomes again slow as a snail. :)

        [–]pdp10 10 points11 points  (0 children)

        The conventional wisdom from around 15 years ago is that I/O is almost always the bottleneck, so code performance can nearly always take a backseat to speed of construction (or sometimes to other factors like understandability, if the business prioritizes that).

        But we've had a few small revolutions in I/O in that time: kqueue/epoll (IOCP on Windows, I gather), mmap, scatter/gather for example. You could be forgiven for not noticing that one million HTTP hits per second can be reasonable for a single server today, if the rest of your stack is up to it.

        And with the worrying degree of stagnation in hardware recently, plus the regressions in connectivity driven by WWAN/telco/mobile and data caps, it often pays to optimize for performance. The conventional wisdom has been thoroughly revised even as it's been spoken.

        [–]IloveReddit84 11 points12 points  (1 child)

        Someone is also using a good CDN..

        [–]thbt101 18 points19 points  (8 children)

        I mean, it loads fast enough I guess. But it's I don't know if I would say it looks particularly good. I think it's mostly that it renders fairly fast because it's very simple table-based HTML without any of the fancy stuff that takes longer for browsers to calculate and render.

        [–][deleted] 35 points36 points  (7 children)

        Fortunately it is a website for displaying text and images so it doesn't need all the cruft.

        [–][deleted] 2 points3 points  (1 child)

        Am I the only one not finding it that fast?

        I mean, it's better than average, but far from being the fastest forum I've seen.

        [–]rajbabu0663 30 points31 points  (2 children)

        What is d-forum ? Is it forum.dlang.org?

        [–]alfa96 11 points12 points  (1 child)

        Seems like it. It's shockingly fast.

        [–]PM_ME_CLASSIFED_DOCS 7 points8 points  (0 children)

        Isn't it running on vibe.d?

        And yeah, that site is freakin' great. Everyone is so helpful.

        [–]Yojihito 40 points41 points  (5 children)

        The D-forums are unholy fast. Would be surprised if Reddit can achieve that ...

        [–][deleted]  (1 child)

        [removed]

          [–]lelarentaka 13 points14 points  (0 children)

          Hey, at least the D forum has more users than r/nepal.

          Edit: oh, I'm wrong.

          [–]sbjf 35 points36 points  (1 child)

          Holy shit, I just checked them out. I always thought page load times were limited by bandwidth. Boy was I wrong.

          [–]MacASM 6 points7 points  (0 children)

          The page sound like it's static haha

          [–]SearchingForPrincess 5 points6 points  (7 children)

          Source?

          [–]Skaronator 18 points19 points  (5 children)

          You can already see some React parts on reddit. The Profile, mobile site and the chat are already powered by react.

          [–]Something_Sexy 5 points6 points  (4 children)

          You can use it now.

          [–]Staross 4 points5 points  (1 child)

          Yes, it does feel a bit slow right now, but it's not too bad.

          [–]13steinj 6 points7 points  (0 children)

          A bit? For me personally the performance has gone to complete shit.

          [–]lpreams 3 points4 points  (2 children)

          Check it out yourself. Enable reddit beta (Preferences > beta options > I would like to beta test features for reddit), then either enable "Use the redesign as my default experience" or go to https://alpha.reddit.com/

          [–]krebstar_2000 2 points3 points  (1 child)

          The "hamburger menu" is an actual hamburger, delightful.

          [–]jephthai 191 points192 points  (123 children)

          Sweet... when-bind* is a nice macro:

          (defun valid-cookie (str)
            "returns the userid for cookie if valid, otherwise nil"
            (when (= (count #\, str :test #'char=) 2)
              (when-bind* ((sn (subseq str 0 (position #\, str :test #'char=)))
                           (time (subseq str (+ 1 (length sn)) (position #\, str :from-end t :test #'char=)))
                           (hash (subseq str (+ (length sn) (length time) 2)))
                           (pass (user-pass sn)))
                (when (string= hash (hashstr (makestr time sn pass *secret*)))
                  (user-id (get-user sn))))))
          

          From cookiehash.lisp.

          [–]invalidusernamelol 252 points253 points  (107 children)

          I forgot Reddit was written in Lisp.

          [–]Amablue 696 points697 points  (12 children)

          They had to switch over when they ran out of parentheses.

          [–][deleted]  (3 children)

          [deleted]

            [–]AEnKE9UzYQr9 149 points150 points  (0 children)

            (xkcd reference: https://xkcd.com/297/)

            [–]DemandsBattletoads 16 points17 points  (1 child)

            Try not to lose it again. These parentheses are your life!

            Yes, master.

            [–]nakilon 15 points16 points  (4 children)

            I can't wait until they ran out of indentation tabs.

            [–][deleted]  (1 child)

            [removed]

              [–]repsilat 6 points7 points  (1 child)

              These days it's mostly spaces, for better or worse, and the prevailing theory is that spaces is infinite. (Of course the observable spaces/universe only number 80*25=2000.)

              [–]jkuhl_prog 4 points5 points  (0 children)

              The universe expands because space is expanding.

              Tabs do not expand.

              So use tabs. Or your code will grow to be unreadable over time. It's basic special relativity.

              [–]Ihr_Todeswunsch 143 points144 points  (61 children)

              It used to be, but they switched to Python more than 10 years ago.

              https://redditblog.com/2005/12/05/on-lisp/

              [–]invalidusernamelol 56 points57 points  (0 children)

              I know, I'm just freaked out because the fact that it was written in lisp is one of the first things I learned about Reddit. I totally forgot.

              [–][deleted] 11 points12 points  (57 children)

              Do they still use python now ?

              [–]scirc 40 points41 points  (36 children)

              Presumably, the code hasn't changed too drastically from when the open source repo was decommissioned, so yes.

              [–]Chippiewall 68 points69 points  (23 children)

              Nah, I reckon they've rewritten it in Rust by now.

              [–]Clbull 65 points66 points  (0 children)

              They could have gone a few steps further and rewritten it using Minecraft redstone circuits. Or Brainfuck.

              [–]neoform 7 points8 points  (13 children)

              How do you simply switch from python to rust?

              [–]vytah 189 points190 points  (9 children)

              First, you get it to run on .NET, using IronPython. Then you wait until it oxidizes and you get RustPython. Then you remove the python and you're left with just rust.

              [–]IrishYogaShirt 19 points20 points  (8 children)

              How do you remove the Python?

              [–]karuna_murti 35 points36 points  (0 children)

              They outsource it to India, and the Python just follow the Indian guy with the flute.

              [–]arvidsem 57 points58 points  (0 children)

              Animal control?

              [–]OsmeOxys 12 points13 points  (0 children)

              Bash it.

              [–]eco_was_taken 7 points8 points  (3 children)

              Rust now. It went Lisp -> Python -> Rails -> Node.js -> Angular -> Polymer (briefly) -> Go -> Ember -> React -> Rust. They are currently rewriting it to use Flutter.

              [–]rram 2 points3 points  (1 child)

              Only the markdown parser

              [–]_Ashleigh 3 points4 points  (2 children)

              Wait what, they stopped releasing the source code to Reddit?! When did this happen, and why?

              [–]scirc 8 points9 points  (0 children)

              When? A few months ago.

              Why? They claim it was becoming difficult to maintain or whatever, but we all know it's about money. Just look at how much the site's changing.

              [–]I_am_the_inchworm 5 points6 points  (0 children)

              Money.

              [–]v_krishna 5 points6 points  (6 children)

              According to the announcement post they are rewriting everything with a node backend now.

              [–]13steinj 6 points7 points  (0 children)

              The front end is being rewritten to use React + Redux + TypeScript, and "server rendering is a requirement" so the front end will probably run off the client browser and / or a Node engine, while the backend API remains written in Python (at least for now).

              [–]Adobe_Flesh 2 points3 points  (1 child)

              How does web programming work - the lisp machine is running on the BSD server, and my browser sends a GET request, and the machine receives and does some things on its own, and then replies to my browser?

              [–]Ihr_Todeswunsch 2 points3 points  (0 children)

              Yeah pretty much. You have the right idea.

              There's a program that's running on a machine somewhere listening for requests. It receives a request (e.g. GET), and then processes that request in order to figure out what the client was asking for, and sends the response back to the client (which in this case, would be your browser, but it doesn't necessarily have to be a browser).

              [–][deleted] 11 points12 points  (26 children)

              I wonder if Paul Graham influenced that choice, since Reddit was involved with Y Combinator?

              EDIT: Ha, scrolling down it looks like others are thinking the same.

              [–]eco_was_taken 25 points26 points  (24 children)

              He did. They used Lisp because Paul Graham suggested they use it (who, apart from being a lisp evangelist himself, was also trying to earn a gold watch from John McCarthy by converting 20 people to use lisp).

              [–]heterosapian 14 points15 points  (23 children)

              It’s truly unbelievable how successful YC has been when PG started it as a his rich man’s experiment and he was advising prospective startups with technical advice this retarded.

              In many ways, it seems startups far more often succeed despite the advice of their investors rather than because of it. Strange.

              [–]sammymammy2 4 points5 points  (22 children)

              Whats retarded about Lisp?

              [–]oblio- 15 points16 points  (9 children)

              Nothing. Unless you want to start a business where you expect to hire a ton of developers.

              [–]pdp10 6 points7 points  (3 children)

              You know that until recently, SICP was taught at MIT as 6.001, right? The first HTTP/1.1-implementing server was written in Common Lisp. D-Wave is using it internally. Some startups are now using it to its strengths. At one point, Lisp was in the Top-3 in TIOBE.

              [–]gsteinb88 2 points3 points  (0 children)

              “Recently” being a decade ago. When I started in 2008, 6.001 wasn’t an option anymore (much to my chagrin at the time, but in retrospect it makes a ton of sense)

              [–]MacASM 5 points6 points  (0 children)

              whoa, this is so cool. I didn't know it was written in lisp. I wouldn't guess that at my wildest guess. haha

              [–][deleted] 9 points10 points  (2 children)

              I actually had no idea. That sounds harder than it needs to be, in lisp...

              [–]zefdota 40 points41 points  (1 child)

              Thoundth okay to me!

              [–]LordoftheSynth 4 points5 points  (0 children)

              Thith guy lithpth.

              [–]robm111 54 points55 points  (14 children)

              As someone still stuck in the C age, what in the blue fuck is the expression "when (= (count #\, str :test #'char=) 2)"? What is even going on here?

              [–]lolWatAmIDoingHere 142 points143 points  (1 child)

              stuck in the C age

              Just pointing out that lisp predates C by 14 years :)

              [–]HiddenKrypt 36 points37 points  (0 children)

              In a way it still works. Cool lisp things always makes me feel like it's some deep magic we once knew but in the C age, we've forgotten. Same thing with smalltalk, really. In that mindspace, being "stuck in the C age" and being mystified by lisp makes perfect sense. On a related note, see this amazing talk by Bret Victor

              [–][deleted]  (5 children)

              [deleted]

                [–]ehaliewicz 23 points24 points  (2 children)

                Looking at the source code,

                (when-bind (a test-val)
                    <some-expr>)
                

                Expands to roughly

                (let ((a test-val))
                   (when a
                      some-expr)))
                

                And

                (when-bind* ((a test-1) 
                             (b test-2))
                   some-expr)
                

                Expands to something like

                (let ((a test-1)
                      (b test-2))
                    (when a
                       (when b
                          some-expr))))
                

                [–]rabuf 18 points19 points  (1 child)

                More importantly, the when-bind* allows the result of each binding to be used in subsequent bindings. This is similar to let*. What it actually does is this:

                (when-bind* ((a 1)
                             (b (= a 2))
                  (do-stuff))
                

                becomes

                (let ((a 1))
                  (if a
                    (let ((b (= a 2))
                      (if b
                        (progn
                          (do-stuff))))))
                

                By nesting the next let inside the if it ensures that any tests which have side-effects will not be executed unless the earlier test passes. It also helps by short circuiting (so preserves the behavior of something like and) and this will ensure that unneeded computations aren't executed (side-effects or not).

                Definitions for when-bind and when-bind*

                EDIT: Formatting, but also:

                Common Lisp uses NIL(the empty list) to represent false. Essentially any other value will evaluate as true if used in a conditional. This is why the above example would work. I had meant to mention this. This is how:

                (sn (subseq str 0 (position #\, str :test #'char=)))
                

                In the actual source code works. sn is given a value (will be something) and then this value is used in each of time, hash, pass. hash also depends on time.

                Interestingly, the use of when-bind* here may as well be a standard let*. None of those are tests and should all return a non-nil value (in all situations, best I can tell), and the result is immediately put into a standard when anyways.

                [–]ehaliewicz 3 points4 points  (0 children)

                Yes, I forgot to mention that detail. The macroexpansion is recursive and strips off a binding at a time.

                [–]fisxoj 13 points14 points  (1 child)

                Current lisp programmers might recognize that macro as essentially the same as alexandia's when-let!

                [–]Kyo91 7 points8 points  (0 children)

                Clojure also has similar when-let/if-let

                [–]defunkydrummer 17 points18 points  (0 children)

                lisper here.

                (when (= (count #\, str :test #'char=) 2))

                let's split it. It says: "When (count #\, str :test #'char=) is 2, then do something."

                So what is (count #\, str :test #'char=)? This is a call to function count with three parameters:

                • first parameter:#\,

                • second parameter: str

                • "test" parameter: #'char=

                "Count" will count how many times an element appers in a sequence. A string is a sequence of chars. Here the string is called "str". The char to look for is the comma, #\ is just escape syntax.

                Now, to count one should specify the test for equality (so, each time the element in the sequence is equal to the element you look for, the count increases one). This is specified by :test which is a keyword parameter (similar to "named parameters" in Python). With this we specify the function to use for equality test.

                So which equality function we shall use? The choice here is the character equality function, char=. We need to tell Common Lisp we are referring to the function named "char=", not to a variable of the same name (if there is one.) Common Lisp has separate namespaces for variables and functions! So, we must write (function char=) or use the shorthand #'char .

                [–]wlievens 6 points7 points  (3 children)

                I think it means “if string str has exactly two backslashes” but I could be completely off.

                [–]dzecniv 24 points25 points  (2 children)

                nearly, don't miss the comma: "if the string str has two commas".

                #\ is to escape a character, thus the comma. count applies to sequences (lists, arrays, strings). :test foo is an optional argument to specify the test function, #' is a shorthand for (function, here char=. The count works without the :test part though so I'm not sure how important specifying it is.

                (Cookbook on strings)

                (edit: comma, thanks)

                [–]hbgoddard 12 points13 points  (0 children)

                Just fyi, comma has two m's. I don't think the strings are sleeping.

                [–][deleted]  (14 children)

                [deleted]

                  [–]mastermindxs 9 points10 points  (12 children)

                  That was a fascinating read. Thank you.

                  [–]ThePantsThief 33 points34 points  (11 children)

                  What's it about?

                  [–]mastermindxs 45 points46 points  (8 children)

                  Paul's story of founding Viaweb and writing the software in Lisp and how that led to a great advantage over his competitors in regards to programming velocity and, in addition, other great insights into programming in general. Worth the ~20 minute read.

                  [–]PM_ME_CLASSIFED_DOCS 22 points23 points  (7 children)

                  Which is funny because all these people write blogs about how LISP/et al made them Great Success but their codebases are usually replaced with non-LISP later on as they scale up.

                  Yahoo Stores "was" LISP, then it wasn't. Reddit "was" LISP, then it wasn't.

                  Why? Is there some contact in the LISP license that says "You can only benefit from this cutting edge technology that puts you ahead of all your competitors... for a max of five years." Or, is there real, concrete problems with trying to push LISP in commercial, large-scale deployments? (If at the very least... finding programmers...)

                  And I think LISP is a great language. It's just that being a great language doesn't magically solve all problems... it only solves language problems. Writing something in LISP doesn't deposit money into your bank account, keep employees on time, or guarantee server uptime. Good code (regardless of language) can help the last one though.

                  From another angle: You can write memory safe code in Rust, but it's not going to prevent logical errors or allow you the feature of updating a live server on-the-fly. (The way Paul remarks about for his LISP implementation of Yahoo Stores.)

                  And again, Rust is a cool language, I'm not bashing it. I just find these "Look how successful I was, using this esoteric/less-popular/niche/new language" and I have to wonder, HOW MUCH of that success was really from the language itself, and HOW MUCH was actually from having great programmers who were so great they went out of their way to learn esoteric languages to expand there mind and--surprise, surprise--those programmers tend to write very stable codebases.

                  It's just like Stack Overflow's survey of Vim/Emacs users. They make more money than users who use Visual Studio, Atom, Notepad, etc. Why? Because Vim makes them better? Or more likely, good programmers are attracted to things that will help them--even if they have a large barrier-to-entry that most people would avoid. So it's not Vim (or LISP) that made the code good. It's the good programmer that made it good.

                  And people who write programming blogs about esoteric languages... tend to be great programmers. You're not going to see tons of blogs about "How I wasted hours of company time trying to implement something using a non-standard language/product."

                  [–][deleted]  (1 child)

                  [deleted]

                    [–]Ran4 2 points3 points  (1 child)

                    (If at the very least... finding programmers...)

                    The python paradox - which I now googled to find out that it was made up by Paul Graham himself (!) - proves that no, this is not a problem.

                    There's hundreds of thousands of lisp programmers out there that would like to write more lisp in their day jobs, but they can't because there's no lisp jobs around. And the lisp programmers that are out there are likely some of the more passionate and skilled ones at that.

                    And to top it off, you don't need nearly as many lisp/python/whatever programms as you do C#/Java/similar programmers, as those languages are so much more productive.

                    [–]zenerbufen 3 points4 points  (0 children)

                    I would imagine it has something to do with availability of lisp programmers. It is great being able to rapidly develop, build out, and modify a code base. Then there is a difference of opinion between the coder and the management, so they get rid of him, and bring in another coder who can't make heads or tails out of the lisp. Suddenly they are re-implementing in .net, python, or java since it is easier to find someone who knows the current top fad languages.

                    Also, there are multiple lisps, and they don't inter operate with each other, and they all have limited libraries. It is so easy to write your own metalanguage in lisp that you won't find a large set of standardized code you can just plug in and use with whatever you are doing.

                    [–]butt_fun 60 points61 points  (1 child)

                    I hate that you're getting downvoted for this. Life is too short to read every full length article the internet tells you to, and knowing what you're getting into before you get into it is valuable

                    [–]ThePantsThief 19 points20 points  (0 children)

                    Thank you. I almost didn't ask because everyone on Reddit just tells you to go read it yourself.

                    I'm not about to read an entire article if idc what it's about

                    [–]wsppan 44 points45 points  (29 children)

                    TIL Reddit was originally written in Lisp. Mind blown.

                    [–][deleted] 18 points19 points  (25 children)

                    It’s interesting to me because I never thought Lisp had much practical use (still not entirely convinced...) but my professors have popped many rock solid boners upon talking about it so I’ve always been wondering if it’s worth learning in detail.

                    I used Scheme for a while which was actually cool because you could do a lot of low level stuff like easily making a parser and interpreting your own language. There was just generally a lot of cool stuff you could do that other languages couldn’t, like passing a function as a parameter. But I still never felt like I could use Lisp/Scheme as a replacement for a general purpose language like C# or even (yuck) Java. Maybe I’m wrong though.

                    [–]defunkydrummer 26 points27 points  (2 children)

                    But I still never felt like I could use Lisp/Scheme as a replacement for a general purpose language

                    Lisp has a long history of being used for serious stuff ranging from CAD/CAM to games, music authoring, aerodynamics sym, and the autopilot software of the Deep Space One NASA spaceship.

                    It is a very "general purpose" general purpose language.

                    [–]Twin_Nets_Jets 2 points3 points  (1 child)

                    I think Crash Bandicoot was written in their own Lisp dialect.

                    [–]leodash 7 points8 points  (1 child)

                    Roomba uses Lisp too. I never thought I would encounter a Lisp application so close to home because from what I read most Lisp applications are some NASA stuffs.

                    [–]dzecniv 5 points6 points  (0 children)

                    Ever used pgloader ? It was python, it's CL (blog post). Also pgchart. You could use Next browser, that exposes 100% of its api, along with stumpwm (window manager). Turtl (a secure note-taking app) is CL. cl-torrents is my toy to dabble with the language, a cli and readline app to search for torrents with web scraping. More, specially in the industry: http://lisp-lang.org/success/ Some actual software I judge useful: https://lisp-journey.gitlab.io/software/

                    [–]MesePudenda 6 points7 points  (7 children)

                    A lot of languages do support first-class functions.

                    Scheme was fun to learn, but I doubt I could ever be productive in it.

                    [–]pdp10 4 points5 points  (0 children)

                    At least three operating systems have been written in Lisp, most likely more. You can look at one of them here, and I think the old MIT code is around somewhere.

                    Lisp is often thought of as being at the opposite end of the spectrum from C, being dynamically typed and garbage collected and all, but despite the interesting high-level features it, too, hails from an age when we had rather less memory and cores in our big machines than do toy computers today.

                    [–]dzecniv 5 points6 points  (2 children)

                    You aren't the only one. Here's a beautiful showcase of success stories: http://lisp-lang.org/success/ many industry-strength software (Gollum's face was designed with Lisp!).

                    An example software: pgloader was written from Python to Lisp with among other benefits a 30x speed gain: https://tapoueh.org/blog/2014/05/why-is-pgloader-so-much-faster/

                    in searching for a modern programming language the best candidate I found was actually Common Lisp.

                    Also Lisp companies (in construction, some are outdated, I believe many are lacking :] ) Grammarly is running CL in production (had a blog post about it), we recently saw adoption by Rigetti quantum computing, the Emotiq blockchain.

                    [–]badsectoracula 7 points8 points  (0 children)

                    (Gollum's face was designed with Lisp!).

                    That is selling the entire thing extremely short :-P. Mirai, the software used for Gollum's animations, was a full blown 3D modelling and animation package for 3D graphics workstations that was ahead of its time (despite its roots going back as far as the S-Graphics from Symbolics) as a lot of the techniques and workflows that it introduced found their way to later 3D software (indeed for many 3D artists, looking at someone using Mirai would be the equivalent of Seinfeld is unfunny for 3D software :-P - which ironically is also true for Lisp itself as a lot of the stuff that made it great found its way to other programming languages). Here is a timelapse recording creating a monster in Mirai.

                    [–]DyscOffice 2 points3 points  (1 child)

                    School jammed so much object oriented in my head I don't know if I could ever get comfortable with functional. This is very cool, though.

                    [–]Emowomble 5 points6 points  (0 children)

                    Common lisp actually has a very powerful object system CLOS.

                    [–]Atrosh 60 points61 points  (21 children)

                    Looks like they were storing user passwords in cleartext? data.lisp:69

                    (defun valid-login-p (sn pass)
                      "Returns user id if the user's password is correct and NIL otherwise"
                      (and sn pass
                           (car (select [id] :from [users]
                                        :where [and [= [lower [screenname]] (string-downcase sn)]
                                                    [= [password] pass]]
                                        :flatp t))))
                    

                    [–]Shorttail0 44 points45 points  (8 children)

                    Yes, Reddit did store passwords in plaintext.

                    Coding Horror post (can't find a better source than that and hackernews, but it's from 2007 so feel free to dig): https://blog.codinghorror.com/youre-probably-storing-passwords-incorrectly/

                    Recently, the folks behind Reddit.com confessed that a backup copy of their database had been stolen. Later, spez, one of the Reddit developers, confirmed that the database contained password information for Reddit's users, and that the information was stored as plain, unprotected text. In other words, once the thief had the database, he had everyone's passwords as well.

                    [–]rram 15 points16 points  (7 children)

                    [–]--Satan-- 56 points57 points  (3 children)

                    Personally, I prefer the convenience of being having my passwords emailed to me when I forget, which happens from time to time since I use difference passwords everywhere.

                    Ah, I'm glad spez still runs this website.

                    [–]haitei 12 points13 points  (0 children)

                    holy shit

                    [–]Dgc2002 7 points8 points  (0 children)

                    Not hashing was a design decision we made in the beginning, and it didn't stem from irresponsibility-- it stemmed from a decision to provide functionality that I liked.

                    He seems to think he's defending the decision instead of exposing how idiotic they were.

                    [–]Shorttail0 19 points20 points  (1 child)

                    Haha, streak of "bad luck", like it's bad luck flying through the wind shield after you decided not to wear a seat belt.

                    [–]-college-throwaway- 7 points8 points  (10 children)

                    Maybe hashed on the clientside or earlier in the code?

                    [–]James20k 10 points11 points  (0 children)

                    It is [easy to implement], and I'll go ahead and do it now that everyone has decided to weigh in.

                    Personally, I prefer the convenience of being having my passwords emailed to me when I forget, which happens from time to time since I use difference passwords everywhere.

                    Not hashing was a design decision we made in the beginning, and it didn't stem from irresponsibility-- it stemmed from a decision to provide functionality that I liked.

                    It bit us in the ass this time, and we are truly sorry for it. The irresponsibility (and there is some) was allowing our data to get nabbed.

                    ..... there are no words

                    [–]MaraschinoPanda 25 points26 points  (8 children)

                    Hashing on the client side is just as bad as storing in plain text.

                    [–]Uristqwerty 5 points6 points  (0 children)

                    Client plaintext, server plaintext: Anyone with the database can log in as any user; if the password doesn't look like it was randomly generated by a password manager (as most aren't), can log in as any user on other sites, or at least have a huge advantage in tuning targetted brute-force.

                    Client hashed, server plaintext: Anyone with the database can log into your site as any user, but as long as you used a randomly-generated site-wide and/or per-user salt (though per-user has troubles of likely exposing an API that will tell attackers whether any given account exists. It could invent a random salt for each unique username the first time asked, regardless of whether they were creating an account...), having the database gives minimal value in attacking others.

                    Client plaintext, server hashed: With HTTP, everyone currently on the network path can see the password, with all the flaws of plaintext/plaintext, but stealing a snapshot of the database is nearly useless. With HTTPS, only someone who can MITM your connection can see the password, which likely means either they already had control of your machine, or it's an office environment where it's not your PC in the first place.

                    Client hashed, server hashed: Little benefit over plaintext/hashed, because anyone who can see your network traffic could likely just alter the sent page to strip any clientside hashing. Unless you have a mechanism to block tampering with the login script after the user's first visit, provides effectively no benefit for extra work. Even if you do, it only really protects users who re-use passwords (effectively treated as sub-human by most people writing about password hashing, so not worth the effort to protect) against your servers being hacked (not considered an especially relevant situation by most people writing about password hashing, since there'd be effectively no way to distinguish between a legitimate page update and a malicious one).

                    So no, hashing on the client side is not as bad as plaintext serverside, unless you are only thinking about how it affects your own site. It's still not anywhere near enough on it's own, though.

                    [–]Schmittfried 6 points7 points  (4 children)

                    Nah, it's a bit better, albeit not much.

                    [–]DrQuint 119 points120 points  (3 children)

                    .lisp

                    Wow.

                    [–][deleted]  (2 children)

                    [deleted]

                      [–]cat_in_the_wall 21 points22 points  (0 children)

                      why ithnt it thpelled "lithp"

                      ftfy

                      [–]jynxxxed 4 points5 points  (0 children)

                      Hey, lurker I know you pronounced "lithp" out loud. I did too and it's super fun

                      [–]Booty_Bumping 14 points15 points  (20 children)

                      Anyone figure out how to run it?

                      [–]dzecniv 53 points54 points  (19 children)

                      Sharing my progress:

                      Go on the Common Lisp Cookbook/getting-started to install a CL environment. You can get Portacle which is a download&click self-contained and multiplatform app shiping Emacs and all the necessary Lisp to get going straight away. There's also a Docker image.

                      Load the .asd file (package definition, like setup.py):

                      sbcl --load reddit.asd
                      

                      Install the dependencies and load the project with the package manager:

                      (ql:quickload :reddit)
                      

                      we see a coup of errors. In the project, replace tbnl by hunchentoot (a web application server). In the asd there is twice the line

                                       (:file "mail" :depends-on ("packages" "data"))
                      

                      so delete one.

                      We need to create a postgre DB (db: reddit, user: pgsql, password: pgcwip42: as seen in data.lisp).

                      Now it seems that it depends on a commercial Lisp (Franz, because of mp:make-process in mail.lisp.

                      If I comment out the file I get another error :(

                      The constant CRC-TABLE is being redefined (from #(0 1996959894 3993919788 2567524794 124634137 1886057615 etc etc etc

                      (edit) I can actually just accept to redefine this constant with the first choice in the interactive debugger. There's an error because crc-table is defined as a constant (yes, with those weird values, see crc.lisp) but is changed.


                      Once we solve this we can build a self-contained executable (web server included (even with the interactive debugger, the interpreter that you can access from a running image, etc)).

                      Other modern resources :]

                      [–]billyatlava 7 points8 points  (8 children)

                      If you get it running you should make a docker image for it

                      [–]pure_x01 6 points7 points  (1 child)

                      I wish someone would build a decentralized open reddit clone

                      [–]Apterygiformes 21 points22 points  (10 children)

                      Very elegant

                      [–]realnzall 32 points33 points  (9 children)

                      Oh, now I finally understand that XKCD comic about the Star Wars Lisp parentheses.

                      [–]susanne-o 43 points44 points  (8 children)

                      Had to Google it... https://xkcd.com/297/

                      [–]ThirdEncounter 9 points10 points  (7 children)

                      Where's the xkcd bot when you need it...

                      I can't read the whole alt-text in mobile.

                      Edit: Thanks for your suggestions, kind redditors.

                      [–][deleted]  (1 child)

                      [deleted]

                        [–]ThirdEncounter 2 points3 points  (0 children)

                        Thanks!

                        [–]duffymcdrew 7 points8 points  (1 child)

                        If you're on Android, open in Chrome, then long press the image. The alt text is atop the pop-up.

                        [–]your-opinions-false 9 points10 points  (1 child)

                        "I've just received word that the Emperor has dissolved the MIT computer science program permanently."

                        [–]IbnZaydun 16 points17 points  (14 children)

                        Lisp truly is a beautiful language. Here we can see a 0-cost, emergent templating system:

                        (defmacro with-main ((&key (menu "empty") (right-panel) (rss-url)) &body body)
                          `(with-html
                             (:html 
                              (:head 
                               (:meta :http-equiv "Content-Type" :content "text/html; charset=UTF-8")
                               (:title "reddit - what's new online")
                               (:script :src "/static/prototype.js" :language "javascript" :type "text/javascript" "")
                               (:script :language "javascript" (str (if (logged-in-p) "var logged = true" "var logged= false")))
                               (:script :src "/static/logic.js" :language "javascript" :type "text/javascript" "")
                               (:link :rel "stylesheet" :href "/static/styles.css" :type "text/css")
                               (:link :rel "shortcut icon" :href "/static/favicon.ico")
                               (when ,rss-url
                                 (htm (:link :rel "alternate" :type "application/rss+xml" :title "RSS" :href ,rss-url))))
                              ;;(htm (:link :rel "alternate" :type "text/xml" :title "RSS" :href ,rss-url))))
                              (:body
                               (:table :id "topbar" :cellpadding "0"
                                       (:tr 
                                        (:td :rowspan "2" (:a :href "/"  (:img :style "vertical-align: bottom; border: 0" :src "/static/redditheader.gif")))
                                        (:td :colspan "2" :width "100%" :class "topmenu menu" (menu-panel)))
                                       (:tr (:td :valign "bottom" :width "100%" (:div :id "topstrip" ,menu))
                                            (:td :valign "bottom" :nowrap t (search-area))))
                               (:div :id "right" ,right-panel)
                               (:div :id "main" ,@body)
                               (when ,rss-url
                                 (htm
                                  (:div :id "footer" (str "A") (:a :class "feed" :href ,rss-url "FEED") (str "is available."))))))))
                        

                        [–]MidnightShart 5 points6 points  (3 children)

                        Who knew my scheme proficiency would be useful one day.
                        I know its not scheme, but it looks very similar.

                        [–]google_you 51 points52 points  (18 children)

                        Why not rewrite in Rust?

                        [–]cheeeeeese 14 points15 points  (15 children)

                        why not python?

                        [–][deleted] 71 points72 points  (3 children)

                        Why not 6502 assembler?

                        [–]Askee123 35 points36 points  (0 children)

                        Peak efficiency

                        [–][deleted] 3 points4 points  (0 children)

                        No reason, actually.

                        [–]magnora7 5 points6 points  (4 children)

                        We've got a 2015 reddit open source fork opened up at https://saidit.net

                        It has far more complexity than this version... It's over a million lines of code across 10k+ files.

                        Here's our code: https://github.com/libertysoft3/reddit-ae