Блог пользователя Gleefre

Автор Gleefre, история, 23 месяца назад, По-английски

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)))
  • Проголосовать: нравится
  • +75
  • Проголосовать: не нравится

»
23 месяца назад, # |
  Проголосовать: нравится -17 Проголосовать: не нравится

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

»
23 месяца назад, # |
Rev. 2   Проголосовать: нравится +16 Проголосовать: не нравится

+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.

»
23 месяца назад, # |
  Проголосовать: нравится +8 Проголосовать: не нравится

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

»
23 месяца назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

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...

  • »
    »
    23 месяца назад, # ^ |
      Проголосовать: нравится -17 Проголосовать: не нравится

    Bump. Pinging MikeMirzayanov one more time..

    • »
      »
      »
      23 месяца назад, # ^ |
        Проголосовать: нравится +5 Проголосовать: не нравится

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

      • »
        »
        »
        »
        23 месяца назад, # ^ |
          Проголосовать: нравится -20 Проголосовать: не нравится

        Bump.. (MikeMirzayanov?..)

        • »
          »
          »
          »
          »
          23 месяца назад, # ^ |
            Проголосовать: нравится +3 Проголосовать: не нравится

          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.

          • »
            »
            »
            »
            »
            »
            23 месяца назад, # ^ |
              Проголосовать: нравится 0 Проголосовать: не нравится

            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.

            • »
              »
              »
              »
              »
              »
              »
              23 месяца назад, # ^ |
                Проголосовать: нравится +4 Проголосовать: не нравится

              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.

              • »
                »
                »
                »
                »
                »
                »
                »
                23 месяца назад, # ^ |
                  Проголосовать: нравится 0 Проголосовать: не нравится

                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.

              • »
                »
                »
                »
                »
                »
                »
                »
                23 месяца назад, # ^ |
                  Проголосовать: нравится 0 Проголосовать: не нравится

                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.

              • »
                »
                »
                »
                »
                »
                »
                »
                19 месяцев назад, # ^ |
                  Проголосовать: нравится +5 Проголосовать: не нравится

                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).

              • »
                »
                »
                »
                »
                »
                »
                »
                12 месяцев назад, # ^ |
                Rev. 5   Проголосовать: нравится 0 Проголосовать: не нравится

                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.

              • »
                »
                »
                »
                »
                »
                »
                »
                8 месяцев назад, # ^ |
                  Проголосовать: нравится 0 Проголосовать: не нравится

                Is there any development on the issue?

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  8 месяцев назад, # ^ |
                    Проголосовать: нравится +8 Проголосовать: не нравится

                  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.

          • »
            »
            »
            »
            »
            »
            16 месяцев назад, # ^ |
              Проголосовать: нравится 0 Проголосовать: не нравится

            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.

»
23 месяца назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится

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