Hacker News new | past | comments | ask | show | jobs | submit login
Chicken Scheme 5.0 (nongnu.org)
303 points by mario-goulart on Nov 8, 2018 | hide | past | favorite | 86 comments



Wow! It has been almost 6-7 years since I used Chicken Scheme, but I have fond memories of it. I wrote a program to automatize the creation of scientific reports in the Planck/LFI project [1]. The purpose was to quickly scan a large number of maps and power spectra produced by the data analysis pipeline, detect any weirdness in the data, and create a report in HTML format. The report included several tables and plots.

The ability to natively encode HTML in Scheme syntax was the main reason why I chose Chicken Scheme: LISP is perfect for creating HTML programmatically. However, while using Chicken Scheme, I discovered a few other features that were big timesavers:

(1) The simplicity of its FFI was incredible. It was immediate to link existing C libraries we were using in the Planck project, as Chicken Scheme compiles to C.

(2) Eggs were a joy to use. It was trivial to download and install them, compared to the amount of work needed for the usual C and Fortran libraries needed in our field (Lapack, Blas, HEALPix, etc.)

(3) Several tools were available: documentation generators (I don't remember the name of the one I used, but I remember the good looks of the documents it produced), seamless integration in Emacs, etc.

(4) Developers were super-friendly. I did not need to ask questions very often, but the few times I had to do so, I found them responsive and happy to help.

(5) The fact that the compiler produces an executable made deployment quite easy: once I verified that the necessary dynamic libraries were available, I compiled the code using Chicken Scheme on my laptop and then copied the executable on the server hosting the data to analyze.

Congratulations to the team for this new release!

[1] https://en.wikipedia.org/wiki/Planck_(spacecraft)#Low_Freque...


If you don't mind me asking, why did you stop using it?


Essentially, because at that time I was the only one in charge of producing the reports, and so I could choose any tool in the market. (This does not mean that I have not met resistance by other colleagues in using Chicken Scheme: had I used a more widespread language, other people could have helped me in hacking the reports.)

Recently I coordinated the development of a similar tool for another experiment, but this time I was managing a team of three. While everybody knew how to program in Python, I was the only one with an adequate understanding of Scheme. So I decided to allow the members to use Python. (This time, however, we produced Markdown reports, which we converted to HTML using Pandoc.)

Most of the other codes I regularly develop for my job do not involve HTML reporting but make heavy use of Python libraries. In this case, I either stick with Python or use Julia.


I remember writing bindings for Zephyros in Chicken Scheme, it was an enlightening and fun experience! and I just wanted to echo all your comments about it.


> LISP is perfect for creating HTML programmatically

'printf' has always worked just as fine for this purpose.


Have you worked with SXML or Reagent or anything like that? You're not wrong, but your comment makes me wonder if maybe you just haven't seen a more elegant solution than string interpolation.


Seriously, having html represented as an actual tree structure that can be manipulated like any other data is so absurdly powerful it made it impossible to go back to anything else after that. Even JSX feels like a crude hack by comparison.


This is the biggest value of structured data, as soon as you convert something to a string you have lost all your leverage.


Great news!

When I applied for my present job (at a Golang/JS place), the dumb little coding exercise I was asked to do said it could be done in any language. Before thinking about whether or not it would actually be a good idea, I'd opened a new file and started hacking with this at the top:

;; you said any language

;; this is chicken scheme

And it worked! Thank you, chicken.


One of the best intros to generational garbage collection is on chicken internals[1]. If you've ever wondered about GCs I thoroughly recommend giving the article a read, it's full of interesting asides as well.

I think I would use chicken more but usually when reaching for scheme it seems to be because I want something embeddable. Even so, extremely excited about this release!

[1]: https://www.more-magic.net/posts/internals-gc.html


CHICKEN is just as suitable for embedding in C programs as for embedding C code in CHICKEN: https://wiki.call-cc.org/man/5/Embedding

The complete CHICKEN 5 runtime should be a bit smaller already than the CHICKEN 4 runtime, because we dropped some stuff, but if the runtime is still too large for your needs, you can make a custom build that omits certain components. Here's a small tutorial on how to do that: https://wiki.call-cc.org/generating%20the%20smallest%20possi...


JOOI, what's your embeddable Scheme of choice?


Guile or Chibi depending on what I want. Guile is about 2mb and seriously fast. Chibi is tiny and not very fasy.


Do you statically link Guile? Guile is a pleasure to work with, but I was under the impression that you can’t embed Guile because it’s GPL.


Guile ls LGPL.

You can statically link to LGPL libraries so long as you also provide your program in "object form" so that the user can re-link their program with a different version of guile.

See: https://www.gnu.org/licenses/gpl-faq.html#LGPLStaticVsDynami...


Surprised to see Guile weighing in at 2mb - my experience with it on Linux was a much larger install. What makes the Linux packages so much larger out of curiosity? I profiled it at more like 50-80mb when I compiled it a couple of months ago.


I meant weight as in extra RAM usage for the application I use it in.


One of the hard problems in CS is naming things. WHY do scheme implementations decide to name stuff by SRFI numbers? Even if you've been using the language a lot, numbers don't make very much sense. I want to import the standard list library -- not library #1. Even (import srfi-1-lists) would be better than (import srfi-1).

In addition, such names make the language more approachable for new users. Not only do they have to know that SRFI exist, but they have to look over all of them to see if one exists for what they need.


Working on that. As SRFIs get incorporated into the R7RS-large edition of the standard, they get renamed to (scheme list) and so on. Of course, that hasn't propagated too far yet, but it's coming.


Chicken is an instance of "Mysteryware".

* Who created it?

* Why didn't them pick one of the other implementations?

* What's the history / background?

Could not find any of the answers to those questions after a few minutes of Googling around, nor in Wikipedia [1].

Closest I got is this page [2] that list "Felix Winkelmann" as the top core contributor. I'm guessing he is the author since the name rings a bell (after dabbling a bit with scheme and comparing implementations, so maybe I read his name somewhere, probably right here at HN).

Regarding the "why", I also think I read somewhere that the idea was to implement scheme using the ideas on "Cheney on the M.T.A." [3] and later the project took off, but I don't know the details... did I just make this up? :-p... damn, really need to improve my note taking process.

1: https://en.wikipedia.org/wiki/CHICKEN_(Scheme_implementation...

2: http://wiki.call-cc.org/maintainers

3: http://wiki.c2.com/?CheneyOnTheMta

EDIT: Found it! I think most I remember about Chicken history I read from these blog posts:

* https://spin.atomicobject.com/2013/05/02/chicken-scheme-part...

* https://spin.atomicobject.com/2013/06/19/chicken-scheme-spoc...


I had a plastic toy of Feathers McGraw on my desk, the evil penguin (disguised as a chicken!) from the Wallace and Gromit movie, “The Wrong Trousers.” Looking for a preliminary working title for the compiler, I used the first thing that came to my mind that day. I’m somewhat superstitious about names for software projects, and things were progressing well, so I didn’t dare to change the name.

Great!


I wrote an IRC bot[1] to get a feel for Scheme in general earlier this year. I chose Chicken for it, which got me to look into Cheney on the MTA and other implementation details which were really interesting.

The FFI is really nice, given that Chicken compiles to C.

The Chicken IRC channel was a lot of help early on.

All in all an enjoyable experience!

[1] https://github.com/sebcat/kylling/blob/master/kylling.scm


The chicken IRC channel is IMHO one of the kindest and most helpful places on the internet.

I have asked so many stupid questions and they were so helpful. I would go as far as to say that they were an important part of me becoming proficient in scheme. The chicken community is my prime example of welcoming and nice open source communities.

I still use chicken from time to time, but I switched to guile for a project with an embedded scheme. I wrote quite a lot of scheme code and suddenly had a prelude in guile that wasn't so easily ported.


I actually came across this the other day. I recently got into using IRC and wanted to learn lisp, so I decided to make an IRC bot. I wanted to get an idea of how this would work in Chicken Scheme (since the documentation for the irc egg was not great) and the only one I could find was your kylling.scm bot. So thank you for putting the code for kylling.scm out there because it helped me get started with the IRC bots I am maintaining now.


At my last job (company that builds data portals) I put together a basic site-to-Gopher gateway, so that people could explore data portals in glorious ASCII.

I didn’t get all the functionality I wanted built in the time allotted (some of the time was also spent trying to fix up an old Wyse60 serial console that was on the fritz), but I had a blast writing that in Chicken Scheme. I was surprised and enormously entertained that there’s a pretty well-baked Gopher server for Chicken... it supports IPv6 even!

Kudos to the Chicken team. While I like some of the Racket-isms in Racket, Chicken is a delight and has an awesome deployment story.


Great to see this. I liked using Chicken on Linux, but unfortunately for me, I am on Windows and do not like using Cygwin or Mingw to compile it for Windows. There is no current MSVS solution as far as I know for now. I use Racket, Extempore [1], and I play with Shen [2] for my lispy appetite. Shen has been ported to Chez Scheme, which is also what Racket is being re-written in (sort of).

[1] https://extemporelang.github.io

[2] http://shenlanguage.org


Not sure if this will work for your use case but have you tried compiling it with WSL? It's much more convenient way to work with Linux software on Windows but may not be what you're looking for if you want to link a library in to a Windows project.


Chicken works great on WSL. I used to have it on both WSL and Cygwin.


I am not running Windows 10 on my daily computer. I’ll try this on my other box. Thanks!


Still a bit of a hassle, but I got it working. It's a shame it isn't easier to install like Racket, Shen or CL.

I really want this to build as a Windows exe without the need for the Posix stuff, I think?


For those wondering what this is like I was: Chicken is a compiler for a version of the Scheme language, which is a dialect of LISP. It compiles to portable C.


THANK YOU! My Google-Fu was failing on me!



Is there some lisp that has offers nearly as powerful and fast data processing and tensor algebra facilities like Pandas and Numpy of Python? I would love to use a lisp but am not sure how well are they going to manage with huge 2-3D arrays.


Yes there is a really great statistics functional programming language that was founded on being a scheme for data science. Unfortunately the data scientist back then were not training in doing code well so the examples of the language got cluttered up but there is a great functional Scheme right in there.

That language is R. http://adv-r.had.co.nz/Functional-programming.html

I learned Racket (Lisp) and then realized I had so many thing inside of R that I was missing. Hadley Wickham's tidyverse and funtional Advance R book changed everything in my code.


Currently, this comment is heavily downvoted, which I do not understand. If Julia warrants mentioning as having a lispy core, then it’s at least as valid to point out R’s deeply lisp-inspired (and technical implementation based) heritage.

I mean, scratch the surface on any of the FFI docs, and you’ll see that SEXPRs are right there lurking barely beneath the surface: http://dirk.eddelbuettel.com/code/rcpp.html

EDIT: and you can, as the parent comment says, do much worse than Hadley’s functional programming guide as an introduction.


> and you’ll see that SEXPRs are right there lurking barely beneath the surface

Then why the surface? Why can't we just have a lisp with a good data-science library? Scheme seems the easiest of all the programming languages to me. I bet I can teach Scheme (not including advanced FP stuff though) to anybody faster than any other language although I have never used it to code anything serious (because libraries), I actually find it simpler than Python or even VBA. Phenomenally everybody seems so scared by the parentheses but these are not a serious problem given an intelligent IDE with proper outlining and highlighting.


You’re preaching to the choir here.

I’d love to see a data science community around Racket in particular. In fact, you can do quite a lot in Racket today, just with not nearly the libraries and tooling as Python or R.

But as a consolation prize, R is pretty Schemey, and has the best collection of libraries for data around. It’s been a dream for years to figure out a way of making use of more of R from Racket, but time and deadlines keep getting in the way.


I searched and I can't find it but someone was trying to implement R inside of Racket.

Personally I really want a language just for cleaning data in Racket first and then tidyverse.


Have you seen this package yet? http://alex-hhh.github.io/2018/08/racket-data-frame-package....

I think it could be the starting point for some data science work in Racket.


Thank you so for finding that. It is a totally different project but further along then the one I was following a few years ago.


Because they made the decision to be S-compatible, as many statisticians used S+ at the time. At that point in time, the real lispers all used X-Lisp Stat: https://en.wikipedia.org/wiki/XLispStat (in fact, some people objected to the journal of statistical software on the basis that it would only cover XLispStat).


Most programmers, esp from ALGOL-like and C-like languages, hate the syntax. Decades have been wasted trying to convince them to overlook it. Clojure was a surprising exception. Whereas many languages that stayed close to languages people were familiar with got adoption.

Better to hide the LISP'y core underneath a syntax similar to a widely deployed language. Julia was a brilliant example that's getting a lot of uptake vs scientific LISP's as predicted.


The parent asked for a Lisp dialect. R is not a Lisp dialect. It's ridiculous to claim there's a "Scheme" in R. R is not Scheme, it's not even close.


It’s much closer than people think. R originally built on a Scheme runtime, and the DNA of Scheme is still lurking pretty close to the surface.

The meta programming facilities in R still look very lispy, and are used to good effect throughout the Tidyverse family of packages.

If I had one wish, it would be to see something like the Tidyverse exist in something still closer to Scheme... like Racket.


If it's all Scheme under the hood, why can't it be backported easily?


This is valid R

  sum(1:10)
This is also valid R:

  (sum (1:10))


Just wrapping whatever in parentheses does not make a lisp.


There are multiple Clojure options for high-speed matrix processing. E.g.

    https://neanderthal.uncomplicate.org/
    https://kieranbrowne.com/research/clojure-tensorflow-interop/
    https://mxnet.incubator.apache.org/api/clojure/index.html


Its dead now but there was http://lush.sourceforge.net/


Julia can show s-expressions for an expression I think...sorta what you asked, but not really I know.

If you really want something like pandas + lisp then you probably need Common Lisp and have to dig for some libraries.


I'm a great admirer of Julia, but I doubt it would appeal to those seeking a "true" lisp/scheme. Even if it's has a sane macro system, and much of the same power. You can indeed see s-expressions (search for "s-expression") :

https://docs.julialang.org/en/v1/manual/metaprogramming/inde...

This nice talk mentions a bit on how Julia is (not) a lisp (if I recall correctly):

"Julia: to Lisp or not to Lisp?": https://m.youtube.com/watch?v=dK3zRXhrFZY

This might also be of interest: https://tpapp.github.io/post/common-lisp-to-julia/

As well as (maybe) clasp: https://github.com/clasp-developers/clasp


You could always just use Hy, which is a clojuresque language that runs on top of python and can use its libraries.


Hy is awesome, it's a pleasure to use and you can always convert is straight to readable Python to debug. Access to regular Python libraries is seamless.

[0] https://learnxinyminutes.com/docs/hy/

[1] http://docs.hylang.org/en/stable/quickstart.html


Ok. Perhaps that's the language. Which IDE/editor has the most intelligent support for it? There seems to be no Hy plugin for PyCharm (e.g. IntelliJ Idea supports Clojure nicely AFAIK).


Hy has a nice Emacs plug-in (hy-mode) which I use. Other than that I'm aware of Vim and Atom support. I'm not really sure how intelligent they are though.


Chicken sounds super interesting but I’ve never used it. Anybody have a tutorial(s) on how to get started using chicken? And specially how do you do to 2D graphics with it?


We have a tutorials page at https://wiki.call-cc.org/tutorials

For graphics, see eggs categorized "graphics" at https://eggs.call-cc.org - The CHICKEN 5 list of graphics eggs is not very long, but for CHICKEN 4 there are quite a few eggs, some of which will probably be ported soonish.

Your best bet is probably doodle: https://wiki.call-cc.org/eggref/4/doodle but feel free to browse the list of other graphics eggs.


I like Chicken but I still think Racket should be the first one learned, because of the documentation. https://docs.racket-lang.org/quick/


And the free, online textbook How to Design Programs.

https://htdp.org/2018-01-06/


Awful seems to have come a long way since I last looked at it: http://wiki.call-cc.org/eggref/4/awful. Anybody used it in production?


I don't know many uses of awful in production.

http://paste.call-cc.org/ is awful-based. My home page (http://parenteses.org/mario/) is also in awful, but it's nothing fancy.

It's been ported to CHICKEN 5, by the way: http://wiki.call-cc.org/eggref/5/awful


I took a peek at the link to your homepage. I wish I had a cute dog named Ada!


Looked really cool. Downloaded it via Homebrew but my first test file[1] ran into a myriad of issues like 'unbound variable: use', 'unbound variable: printf', 'import had trouble expanding the macro: srfi-1' (paraphrasing). Not sure if the Homebrew recipe is broken but I would love to use this for some of my side projects.

Congrats on the release!

[1] test.scm

(use srfi-1) (define (test number1 number2) (printf "Sum: ~s" (+ number1 number2))) (test 1 2)


This is an old example. This should now be something like

(import (chicken format)) (define (test number1 number2) (printf "Sum: ~s" (+ number1 number2))) (test 1 2)

If you're trying to actually use srfi-1, that's now imported via (import srfi-1). (use...) no longer exists.


You can use two spaces at the beginning of the line to get code mode:

  ;(use srfi-1)                ; <-- old
  (import (chicken format))    ; <-- new 
  (define (test number1 number2)
    (printf "Sum: ~s" (+ number1 number2)))
  (test 1 2)


Gotcha! Thanks for the update.


Just curious. Does anyone use Chicken Scheme in production?


The CHICKEN team is a big fan of dog fooding: the wiki, pastebin, egg documentation search (which is yet to be updated to C5) and our infrastructure sysadmin stuff in the background is all written in CHICKEN.


Also the test stuff and the compiler itself. :-)

Regarding non-own dog food, http://wiki.call-cc.org/Software lists some projects using CHICKEN.


It's not a high-volume application by any means, but I wrote an online testing program (multiple choice, etc.) in Chicken that's been running at our university for about twelve years. It was meant as a short-term, interim solution until the bugs in our 'enterprise' testing system were fixed... but it still finds some use today. (I just took a peek at the database; we've had about 250,000 test submissions over the years. Not bad for a little Scheme app.)


Builds are fully bit-for-bit reproducible!


I have been playing with gambit and gerbil in my spare time. How is chicken compared with gambit and gerbil?


CHICKEN has a more permissive license, larger community (and therefore more libraries) and a slightly better bus factor than Gambit and Gerbil.

Gambit is faster on many benchmarks and has multiple backends. This makes it easier to run inside a browser, for example, with the JS backend. It also has better introspective capabilities than CHICKEN, if I remember correctly.

I believe Gambit is currently R5RS only with no plans to implement R7RS, and it has no native module system like CHICKEN does. If I understand correctly, Gerbil adds this to Gambit, but there's also the Black Hole module system. I don't know how compatible those are.

Both have full continuations, tail call optimization and take the standard serious. You can compile stand-alone programs with both, and both can link to C libraries quite easily.

Full disclosure: I'm a CHICKEN developer and my knowledge of Gambit is somewhat limited.


Really exciting!

Unfortunately, it looks like some of the page references are broken for eggs. [0]

[0] http://wiki.call-cc.org/eggref/5/mpi


I've notified the author of the egg. Should hopefully be fixed soon. Thanks for reporting!


iup and nanomsg has the same issue, but the v4 pages work so most of the docs can be seen there if needed.


Indeed, just bear in mind that (use foo) is now (import foo). For most eggs, that's the only user-visible change.

I've also notified the authors of these eggs.


This page might give an idea of what's new in Chicken 5:

https://wiki.call-cc.org/chicken-5-roadmap


That wiki page was just an informal working page for the core team to keep us focused. That's why it is a bit messy and incomplete, plus it mentions some changes that we decided not to include in CHICKEN 5.0.0.

I wrote a more accessible introduction to CHICKEN 5's new features on my blog, https://www.more-magic.net/posts/chicken-5.html


Whatever happened to the Chicken Gazette?


The Gazette archive is still there at http://gazette.call-cc.org/archive.html but the Gazette hasn't seen new issues in a long time.

It turned out that keeping a regular writing schedule with a small group of people is quite hard. Gathering the news and coming up with interesting new content is quite a lot of work. Eventually the releases started to drift further apart because people did not find the time to write the articles anymore. Eventually nobody volunteered to put in the time anymore.

It's unfortunate, but people have busy lives and we're happy we find the time to develop the CHICKEN code itself. So, I don't see a way to restore it unless droves of new volunteers step up.


Would Chicken Scheme work ootb to code along with SICP?


There are minor differences, as SICP was written with MIT Scheme in mind, so you'll run into nonstandard procedures like "1+" not existing. In CHICKEN that one is called "add1". But for the most part, things should just work.


Great news, Mario.


Bravo guys.




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

Search: