Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Chicken Scheme 6.0 (call-cc.org)
292 points by eatonphil 19 hours ago | hide | past | favorite | 45 comments
 help



Folks may also be interested that this version, 6.0, supports Crunch(although Crunch itself has not been declared a 1.0 status, currently @ .993), which is a compiler for a statically typed subset of Scheme R7RS. (https://wiki.call-cc.org/eggref/6/crunch)

CRUNCH is really cool, I helped make it work better on Windows (although it requires a bit of setup)

For an introduction:

CHICKEN is a compiler that translates Scheme source files into C, which in turn can be fed to a C compiler to generate a standalone executable. An interpreter is also available and can be used as a scripting environment or for testing programs before compilation.


does this mean that you can't do `eval`-like things in "production" systems?

IIRC not compiled (you can include the interpreter).

But then Scheme was always less EVAL-friendly of the lisps


I'm not seeing the less friendly... Eval, and sandboxing eval, are builtin features of the Scheme standard.

It has eval but it lacks reader macros (or at least it did thirty years ago) which is what makes eval useful on lisp2 systems.

I started playing with Chicken over the weekend because I was looking for a scheme that you could build binaries of and that had a lively ecosystem. I've really enjoyed it. So far I've mostly played with web stuff. Built a wrapper around makemkvcon for ripping some dvds I've been meaning to rip that'll do a little bit of automatic naming of output using the tv db.

I was slightly worried that I'd start using v5 and then v6 would come out but it looked like they'd been working on it for a while so I figured I'd have some time on v5. Turns out I was wrong!


How would it be for a 2D game?

I’ve thought a tiny bit about this. I think I’d lean towards Guile for a game because of Hoot, wasm compiler, and Chickadee, little game library. But I’m remarkably unqualified to have a real opinion since I’ve used Chicken for 72 hours now.

I am currently looking into simple options for using Scheme as a scripting language in a game written in C. So far, s7 made a good impression for embedding it, but I am also not that far into evaluating the actual performance. I looked a bit at Chicken, and it seemed possible to embed, but too complicated for my purposes.

There's raylib and sdl2 eggs available. Those are a great place to start.

I was eagerly waiting for this release, which brings full Unicode support.

Congratulations to the team, Chicken Scheme is a little gem!


For those who use Chicken Scheme: what made you pick it over other Lisps? What are some things it does particularly well?

The eggs are great. For instance I can be up and running building an SDL2 game or make a webserver quickly.

It has good emacs support with geiser-chicken.

Because it compiles down to C the FFI provides a lot of nice ergonomics beyond what I get with Chez Scheme.

Error messages are actually useful with a stacktrace. Can't overstate this.

It supports optional type definitions which reduces the number of tests I need.

The docs are adequate, though I frequently add "MIT scheme" to my search queries. I wasn't able to get chicken-doc setup in NixOS, and the docs website has gone down on me a bunch lately. I wish Chicken had complete documentation available including its eggs in an offline format, like a PDF.


     It has good emacs support with geiser-chicken.
I wrote the initial support for chicken some 11 years ago; it wasn't _great_, but I see that Jao and others have worked on it some since then. Glad to see it's working well!

What about Gambit? Perhaps it's a better, optimizing compiler but the built-in library is rather minimalist?

The compiler. That’s the gem of the system.

The generated C is reasonably portable, so you can run Scheme programs on systems that “don’t run Scheme”.


Absolutely. And eggs too [1]: these are libraries provided by the community, very easy to import and use.

[1] https://wiki.call-cc.org/eggs


What happens if you try to run Python eggs under Chicken? Do you get Roko's Basilisk? :-)

Pythons are too cold to hatch Chicken eggs, and viceversa

To me it is the combination of what is listed in https://www.call-cc.org/.

Self-contained, compact, compiled, fast, ready to use.

SBCL is not compact and its "image" concept is not universally liked by everyone.

Guile and Racket are not fast (nor compact).

Chez Scheme is not "ready to use".


In many benchmarks, Racket is significantly faster than many other Scheme implementations, including Chicken: https://ecraven.github.io/r7rs-benchmarks/ This is because it is now based on Chez.

It is certainly not compact, though.


Racket may be significant faster than many, esp since transitioning to Chez, but its still very hard/problematic to compile to a binary, and if wrapped into a binary still very bloated in size.

FWIW: I enjoy working with Gambit, especially since it can compile to C and standalone binaries and also scores even higher than Racket.


Would be interesting to see how Crunch [0][1] does on that benchmark. Any plans to add it to the benchmark?

[0] https://news.ycombinator.com/item?id=49252127

[1] https://wiki.call-cc.org/eggref/6/crunch


Well, SBCL can just use sources just fine. On Guile not being fast enough, it got a JIT since version 3 and it can be pretty fast. It must be, you know, because if not Guix would be even slower.

   - Strings and symbols passed to foreign code are not copied, they are
    passed directly, any mutations done by external code will be visible on the
    Scheme side.
  - Complex numbers, C structs and unions can now be passed directly as
    arguments and returned as results when interfacing to C code.
Those were major bottlenecks for any FFI-heavy Chicken Scheme app, and would often result in brittle and unsafe abstractions to work around. Glad to see this changed.

Happy to see CHICKEN 6.0 out. Moving to full R7RS and UTF-8 strings was long overdue. The change from blobs to bytevectors and the process-object API look particularly clean. Anyone who has already started porting code — any major gotchas so far?

Why do people use chicken over gambit? Is it due to chicken’s larger ego system and eggs, or is there more?

Native UTF-8 strings are the part I care about most here. The old blob-versus-string juggling was the first thing that bit me porting code.

I only used Chicken for a short time, because of a UTF-8 bug it had/has, but I always liked Chicken's docs. They seem to be written with care and often make things understandable. When I look up Scheme things and don't understand something, sometimes I specifically go for the Chicken Scheme docs, to see if I understand its explanation.

ngl this is a massive update full R7Rs support UTF-8 strings and they finally ditched blobs for bytevectors the closure reuse otpimization sounds interesting too ngl

Uhm. I'm divided. Common Lisp it's the weird cousin, bloated at first but in the end you get SBCL, ECL or CCL and almost everything will work the same. With Scheme, you need to instal SRFI's to complete SICP exercises and then there's R5RS and R7RS.

You have no way to run Hypergiant under Guile. In Common Lisp, tons of packages for QuickLisp/UltraLisp will run on SBCL, CCL and ECL with ease.

In the end Scheme+Dependencies can be more convoluted than a subset of Common Lisp (you can avoid CLOS if you don't need it for instance).


Scheme SRFIs make Scheme a much bigger language while also making it painful to use because you have to research which SRFI are implemented in your scheme variant then map those SRFI numbers to what they actually do then you usually need read the raw SRFI because that's the only documentation around.

R7RS is going on 14 years old and there's still no R7RS-large either. They really need to just take the critical SFRIs, give them names and proper documentation, then call them R7RS-large and move the current work to a future R8RS.


Indeed. Scheme it's amazing for embedded (such as s9) and its small size. Also, the SICP it's cool to do with Chicken Scheme and this ~/.csirc (and chicken install srfi-203 and srfi-216):

    (import scheme)
    (import (srfi 203))
    (import (srfi 216))
 
 (define (displaynl x)
  (display x)
  (newline))
 
 (define pi (* 4 (atan 1.0)))
 
Even if Chicken has Hypergiant to play with 3D objects, Common Lisp has Kandria, Sketch, Kons-9...

From Scheme, after finishing SICP as an Scheme exercise (and CS course), just jump into Common Lisp, and finish both Gentle Introduction to Symbolic Computation and Paradigms of Artificial Intelligence, where you will implement a micro-Scheme in Common Lisp itself as an exercise.

SBCL allows you to create working stuff with very few dependencies (uiop and the like from QuickLisp/Ultralisp). With Scheme/Chicken you will get lost in a maze of eggs and SRFI's.

And, on CS/academics, if you finish SICP both GITC and PAIP on on Common Lisp will be a breeze and it will give you superpowers with these three books.


I guess you mean s7 -- I find s7 scheme fits into a lua shaped hole for scripting larger applications quite well without having to use lua (which is a personal preference). I used s7 scheme for scripting a C program years ago, and moved on to writing programs with chicken scheme.

I really think in an alternate universe chicken scheme could fit into the python niche, because the eggs feel very "batteries included". Super excited for this release!


That dynamic was exactly why I moved from Scheme to CL many years ago (full disclosure, Clojure is my daily driver, now). I loved the minimalism of the RxRS documents, but they really only covered the small core of the language, and then all the implementations were completely different when it came to libraries. And those differences always needed to be understood in order to write real-world programs. SRFIs helped, but adoption was spotty. Every multi-implementation language has some of that, but Scheme had more than most. For me, the choices were to use a very full-featured Scheme like Racket (which is great) or go to CL and then use something like SBCL. I went with CL and later jumped to Clojure (which, IMO, is a better, more modern Lisp that fits better with today’s multi-core hardware than either Scheme or CL).

However, with Schemes the SRFI implementations usually (?) come with the standard library, so you don't actually "have to install" them. Still gotta know the usual suspects, like SRFI for tests, SRFI for vectors, hash tables, random numbers, etc. if you want your code to be mostly portable to other Schemes.

I've never really heard of installing SRFIs (could be my ignorance); do you mean importing them? Or is installing SRFI implementations as their own packages really common? (Haven't really tried R7.)

The anti-R6/R7 folks (or what I've heard) won't see a problem so long as you can use CL to build fancy serious software, which lets Scheme stay small and simple for education. (Of course ideally you'd be able to do any SICP exercise on a Scheme implementation out of the box, though.)


For that I use Chicken 5 with trace, srfi-203 and srfi-216.

[flagged]


They’re patch notes for a release of some software that I can only assume is used by poultry to plot world domination.

Disappointed to learn this is unrelated to the Chicken chicken chicken https://www.youtube.com/watch?v=yL_-1d9OSdk


How can you tell?



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: