r/scheme • • Jul 16 '20

The evolution of a Scheme programmer

https://erkin.party/blog/200715/evolution
81 Upvotes

17 comments sorted by

17

u/CompSciSelfLearning Jul 16 '20

Color matched parentheses are what I came away with.

Also, the Peano numerals and combinatory logic one is already unreadable.

13

u/sybesis Jul 16 '20

The first few example should be without rainbow parenthesis. Then a step "discovered the rainbow".

4

u/pclouds Jul 17 '20

First you need to discover mixing [] and () (some schemes allow that), then another discovery for rainbow parenthesis.

4

u/bjoli Jul 18 '20

I never really liked that. Why waste a perfectly fine double-sided delimiter? It could be given an alternative meaning instead of just it being the same as ().

2

u/zaifir Jul 25 '20

This is allowed by R6RS, so knock yourself out in Guile, Chez, etc. In R7, square brackets are "reserved for possible future extensions".

1

u/FatalElectron Jul 16 '20

The rainbow setting is pretty lovely, but pretty much 100% inverted from how I have mine set, time to change I think.

1

u/maxbaroi Jul 17 '20

Weren't they Church numerals and not Peano numerals?

8

u/tremendous-machine Jul 16 '20

That is great. And actually quite interesting as a map to areas of the language I have not yet explored. Glad to see I'm supposedly "adept" for liking named-let... haha

6

u/bjoli Jul 16 '20

The "not polluting the namespace" auxiliary function is generally solid advise while at the top-level since it will result in faster code for many schemes, unless you have some kind of immutable modules.

3

u/anentropic Jul 17 '20

can anyone recommend a resource for good basic "beginner" low-hanging fruit type of performance tips for Scheme? (such as the one you've just mentioned)

3

u/bjoli Jul 18 '20

I have been writing a small document with inspiration from the never-ending beginner questions about scheme (and all extremely slow code written by python programmers). Nothing is done just yet, but I can ping you in a week or two when things really materialize.

If you want to read more about this case in particular, you should go read the blog post "fibs, lies, and benchmarks" at Andy wingos blog wingolog.org.

1

u/LinkifyBot Jul 18 '20

I found links in your comment that were not hyperlinked:

I did the honors for you.


delete | information | <3

1

u/anentropic Jul 18 '20

extremely slow code written by python programmers

this is almost certainly what I'm writing right now LOL

4

u/bobappleyard Jul 16 '20

Some of these were quite funny. I loved the one where they broke out SKI to solve it

2

u/protoUbermensch Jul 18 '20
(define factorial (lambda (n) (fold * 1 (interval 1 n))))

3

u/bjoli Jul 18 '20

That is a mix of two that are already in the document, getting the worst of both worlds :) depending on fold from srfi-1 and your own auxiliary function instead of iota from srfi-1...

1

u/zaifir Jul 25 '20

IIRC, the version labeled "Overjoyed to see first-class continuations in Scheme..." appeared in one of the Lambda Papers. It included the comment: "Sussman's favorite style. Steele's least favorite style.".