Gleefre's blog

By Gleefre, history, 2 years ago, In English

Hello,

I have posted this as a comment to big old post About the programming languages, but this was probably not the best place to post to. So I am repeating it here with hope to get some kind of answer to it.

Common Lisp is a very powerful language that can run at speed of c++ and is even more expressive than python (IMHO). I think that it is really worth adding as supported language because it is a very mature language, which has a very reach set of features.

It was asked to add it as supported language for quite a few times now, starting from 13 years ago every 1-2 years.


In hope that it will be able to help (judging by comment to Julia request):

Here is an implementation of binary heap sort benchmark in common lisp: https://github.com/Gleefre/binary-heap-benchmark/blob/master/common-lisp/heap.lisp (and I'll be glad to create a PR if wanted).

One of the best open source common lisp implementations is probably SBCL which can be installed here.

A common lisp script can be run with sbcl like this: sbcl --script <filename>.

Or, if (probably) needed, with an increased/decreased dynamic stack size:

sbcl --dynamic-space-size <megabytes> --script <filename>. It's default value is platform dependent.

On my computer, heap.lisp benchmark results in a range of [693..846] ms with an average time of 701.69 ms.


The problem 1A — Theatre Square can be solved like this:

(defun theatre-square (n m a)
  (* (1+ (floor (1- n) a))
     (1+ (floor (1- m) a))))

(format t "~a~%" (theatre-square (read) (read) (read)))
  • Vote: I like it
  • +75
  • Vote: I do not like it

»
2 years ago, # |
  Vote: I like it -17 Vote: I do not like it

nah, i think C++, Python and PHP are enough for Codeforces

  • »
    »
    2 years ago, # ^ |
      Vote: I like it +11 Vote: I do not like it

    Erm... That can be enough for you, not for others. Me, for example.

  • »
    »
    2 years ago, # ^ |
      Vote: I like it +86 Vote: I do not like it

    bro really said PHP

    • »
      »
      »
      2 years ago, # ^ |
        Vote: I like it -14 Vote: I do not like it

      yes, because programming in PHP is the closest to programming in HTML, but codeforces doesn't support HTML yet :(

      • »
        »
        »
        »
        2 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        I would've exclaimed that Ruby would be much better for CF than PHP

      • »
        »
        »
        »
        2 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Petition to add HTML so I can submit solution with style

»
2 years ago, # |
Rev. 2   Vote: I like it +16 Vote: I do not like it

+1. Lisps are some pretty great languages, and it'll be quite fun to program in them for unrated contests at the very least, if not for rated contests.

Rather than only Common Lisp (which is mostly imperative), I'd also like to see functional Lisps like Clojure and minimal Lisps like Scheme make it to Codeforces. IIRC, CodeChef has support for all three of these examples.

»
2 years ago, # |
  Vote: I like it +8 Vote: I do not like it

+1, I would also like to use Lisps on Codeforces.

»
2 years ago, # |
  Vote: I like it +3 Vote: I do not like it

Bump. (Maybe pinging MikeMirzayanov will work?).

I'm being impatient, right. But I have a feeling that otherwise all my messages are going to be lost in time...

  • »
    »
    2 years ago, # ^ |
      Vote: I like it -17 Vote: I do not like it

    Bump. Pinging MikeMirzayanov one more time..

    • »
      »
      »
      2 years ago, # ^ |
        Vote: I like it +5 Vote: I do not like it

      Bump... MikeMirzayanov, could you leave any answer please?

      • »
        »
        »
        »
        2 years ago, # ^ |
          Vote: I like it -20 Vote: I do not like it

        Bump.. (MikeMirzayanov?..)

        • »
          »
          »
          »
          »
          2 years ago, # ^ |
            Vote: I like it +3 Vote: I do not like it

          It doesn't support Windows 7, but we need such support to run it on invoker machines. https://bugs.launchpad.net/sbcl/+bug/1971640 This bug was reported in May, but not fixed yet.

          • »
            »
            »
            »
            »
            »
            2 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            Hello! Thanks a lot for you reply!

            As mentioned there, SBCL 2.0.0 runs without any problems on windows 7, so the solution might be just using it until the bug is fixed. It will be perfectly fine, since CL is very stable.

            • »
              »
              »
              »
              »
              »
              »
              2 years ago, # ^ |
                Vote: I like it +4 Vote: I do not like it

              I see many bug fixes on https://www.sbcl.org/all-news.html in the releases 2.0.1+. Some of them are in the standard library. I think it could be an issue.

              • »
                »
                »
                »
                »
                »
                »
                »
                2 years ago, # ^ |
                  Vote: I like it 0 Vote: I do not like it

                As I can see none of them (or very few) would be an issue during CP round. (Most of bugs are extreme edge cases, some are introduced in previous versions, some are about compiler warnings.) I don't think this would be an issue.

              • »
                »
                »
                »
                »
                »
                »
                »
                2 years ago, # ^ |
                  Vote: I like it 0 Vote: I do not like it

                Codeforces still uses gcc 11.2.0, but I see 197 bug fixes in gcc 11.3.0. None of the compilers is completely bug free.

              • »
                »
                »
                »
                »
                »
                »
                »
                20 months ago, # ^ |
                  Vote: I like it +5 Vote: I do not like it

                The only difference between 2.0.0 and current latest version 2.3.4 is a lot of small performance improvements, the language itself hasn't changed in past 29 years.

                Nevertheless, if you, for some weird reason, need Windows7-compatible binary on a server, there's unofficial binaries here (full disclosure: built by me).

              • »
                »
                »
                »
                »
                »
                »
                »
                13 months ago, # ^ |
                Rev. 5   Vote: I like it 0 Vote: I do not like it

                Hi MikeMirzayanov, I was wondering whether there are any plans on supporting Common Lisp on Codeforces any time soon.

                As other commenters have noted (about a year ago), the language and compiler support is very stable — in fact, Lisp is the second oldest language still in common use (after Fortran) — predating even C; and Common Lisp — a relatively late dialect — has been around for ~30 years. The SBCL compiler development is quite active, and it has been around for ~25 years now.

                Also, as of now, there are no open reported bugs that could impact the usage of Common Lisp in competitive programming in any way (it turns out that the bugs marked "high importance" are actually either just edge cases or the single report of unsynced-IO-by-default which is also a competitive programming default in C++ so it doesn't matter since flushing can be done manually).

                Update regarding the build issue from a year ago: I went through lockie's unofficial build and glanced through the scripts used to build the binary.

                Conclusion

                It would be great to have SBCL support on Codeforces, since (Common) Lisp is a great language and it seems a lot of CF users also like the language enough to be willing to submit code in it.

              • »
                »
                »
                »
                »
                »
                »
                »
                9 months ago, # ^ |
                  Vote: I like it 0 Vote: I do not like it

                Is there any development on the issue?

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  9 months ago, # ^ |
                    Vote: I like it +8 Vote: I do not like it

                  Sadly, I don't think Codeforces intends to add Common Lisp or any other programming language anymore, especially considering the recent C++ fiasco. I hope I am wrong.

          • »
            »
            »
            »
            »
            »
            17 months ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            MikeMirzayanov: AFAIK recent versions of SBCL works fine on Windows 7. Also see lockie's comment below.

            P.S. I am pretty sure this bug is not marked as fixed because it is not confirmed.

»
2 years ago, # |
  Vote: I like it +4 Vote: I do not like it

+1. Lisp is the best programming language in the world. Just add it.