Beta

Slashdot: News for Nerds

×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Draft Scheme Standard R6RS Released

kdawson posted more than 7 years ago | from the scheming-with-a-lisp dept.

235

Watson Ladd writes, "The new version of the official Scheme standard has been released as a draft (PDF)." From the draft: "[This] report gives a defining description of the programming language Scheme. Scheme is a statically scoped and properly tail-recursive dialect of the Lisp programming language invented by Guy Lewis Steele Jr. and Gerald Jay Sussman. It was designed to have an exceptionally clear and simple semantics and few different ways to form expressions. A wide variety of programming paradigms, including imperative, functional, and message passing styles, find convenient expression in Scheme."

cancel ×

235 comments

Hurray! (5, Funny)

Anonymous Coward | more than 7 years ago | (#16125716)

(I (for one (welcome (our new (Scheme (overlords.))))))

Re:Hurray! (3, Funny)

Lachryma (949694) | more than 7 years ago | (#16125759)

shouldn't this be
(welcome '(I ((for one))) '(overlords (our new Scheme)))
?

Re:Hurray! (2)

menkhaura (103150) | more than 7 years ago | (#16125808)

Forth mixing with are not you?

Re:Hurray! (2, Informative)

WilliamSChips (793741) | more than 7 years ago | (#16126091)

Functions in Forth are at the end, in Lisp are at the beginning.

Re:Hurray! (0, Flamebait)

drgnvale (525787) | more than 7 years ago | (#16125959)

No, the original reads more like lisp and scheme code than your garbage.

142 page PDF... (1)

LiquidCoooled (634315) | more than 7 years ago | (#16125718)

I will post comment after reading (give me a few days)

Who knows enough to condense it into a few sentences?

Re:142 page PDF... (1)

starfishsystems (834319) | more than 7 years ago | (#16125773)

Who knows enough to condense it into a few sentences?

You're joking, of course. It's a language specification.

If you insist on having a condensed version, it would read:

"This is a specification for the Scheme programming language. [specification deleted]"

Re:142 page PDF... (1)

brilinux (255400) | more than 7 years ago | (#16125794)

Well, I have the old on on me right now; it is about 50 pages... I really hope that they do not turn it into ... something that is not Scheme...

Re:142 page PDF... (1)

convolvatron (176505) | more than 7 years ago | (#16126103)

i think there is some danger of that. section 7 in particular i found
very disturbing, writing unix-style script execution syntax into
the language. its clear that they are going for pragmatism and adoption
rather than the clarity that was present in the earlier definition.

frankly really i wish they had just stuck to core+sfri (and left
hygenic macros as an sfri)

Re:142 page PDF... (3, Insightful)

John Nowak (872479) | more than 7 years ago | (#16126138)

This is only distributing until you remember that almost every implementation has to implement something similar, often in a way that's slightly different and incompatible with everything else. I'll agree that there is a danger, yes.

However, I personally feel that R6RS is nearly at the perfect point. It is still very heavily leaning towards simplicity and clarity, but includes the bits that everyone ends up implementing anyway in non-standard ways. The truth is that modern unix systems are ugly, i/o is complicated, and a lack of a standard macro system (see the syntax-case variants) is horribly annoying. R6RS does reflect all of this, but I think trying to cleanly negate issues is far better than simply ignoring them. There are a few things that I think overreach, but I'm very happy with 95% of the additions. This is a standard we can make use of for the next 10-20 years.

Re:142 page PDF... (1)

drgnvale (525787) | more than 7 years ago | (#16125966)

Well, the R5RS was only 50 pages, as has been noted, and could be read in a couple of hours, and digested within a week. I haven't read the new one yet, but I'm told the extra bulk comes from standard libraries, which it is very nice to see added to scheme. If only Common Lisp could grow like this...

Re:142 page PDF... (0)

Anonymous Coward | more than 7 years ago | (#16125983)

You could have read about this a few days ago. Sites like Digg, Reddit, and Google Groups, and the mailing lists of essentially every Scheme implementation, were carrying this news. Of course, it's nearly a week old now, so it's posted about here at Slashdot.

Re:142 page PDF... (0)

Anonymous Coward | more than 7 years ago | (#16126055)

So why are you even here?

Oh, right: you're an idiot troll.

Description of differences here (2, Informative)

billstewart (78916) | more than 7 years ago | (#16126053)

If you RTFA and follow a few obvious links, you get to The R6RS Status Report [schemers.org] which gives a relatively concise overview of the changes from R5 to R6.


Since Scheme wasn't the one of the versions of LISP that I learned back in the dark ages, I couldn't really follow the subtleties of which changes are really significant, but it looks like it would make sense if you were following Scheme.

Qs (0)

Anonymous Coward | more than 7 years ago | (#16125727)

Does using scheme make sense when building a windows GUI application? What about a web application? System scripts? Back end to a database?

Is it more or less powerful than, say, C++, Java, or Python?

Re:Qs (4, Informative)

CRCulver (715279) | more than 7 years ago | (#16125739)

The GNU project adopted Scheme (with the Guile interpreter) as its official scripting language. Applications are not meant to be written in Scheme, but applications can expose functionality to the user through a Scheme interface. That is to say, plugins for extensible applications could be written in Scheme. The Gimp [gimp.org] is one of the most noteworthy applications with a Scheme interface, and much of the lower-level functionality of GNU Lilypond [lilypond.org] is reached with Scheme.

Re:Qs (0)

Anonymous Coward | more than 7 years ago | (#16126226)

The Gimp is one of the most noteworthy applications with a Scheme interface

That explains a thing or two...

Re:Qs (2, Informative)

brilinux (255400) | more than 7 years ago | (#16125749)

Hmmm... you will need libraries and such for that, though some people do use Scheme for all of those things (see http://www.plt-scheme.org/ [plt-scheme.org] and http://www-sop.inria.fr/mimosa/fp/Bigloo/ [inria.fr] ). I have personally used it for web applications, though I usually use common lisp and ocaml for that. In fact, if you are looking for an alternative to C++, Java, or Python, I must recommend OCaml [inria.fr] . Look at this book [inria.fr] . In fact, I wrote an interpreter for R5RS in OCaml...

Re:Qs (0)

Anonymous Coward | more than 7 years ago | (#16125874)

Chicken Scheme [call-with-...uation.org] is also quite nice. Compiles to C code, has a lot of libraries, and is supported by things like SWIG [swig.org] , so it's (relatively) easy to call functions written in C/C++.

Re:Qs (2, Interesting)

RAMMS+EIN (578166) | more than 7 years ago | (#16125776)

``What about a web application?''

Scheme's first-class continuations [wikipedia.org] are actually a very good match for web programming, where a user can re-submit an old form at any time. Basically, with languages that lack call/cc, you will have to break up your application in little pieces to account for this, whereas call/cc allows you to structure your application like a regular one, and the language implementation will deal with the issues.

When it comes to practicality, it all depends on the implementation. The Scheme report is (deliberately) very minimal, and you can't write many Real World programs using only standard Scheme. However, implementations often provide features and libraries that make Scheme practical for real projects, to some extent.

``Is it more or less powerful than, say, C++, Java, or Python?''

It depends what you mean by "powerful". In the programming language community, the answer would likely either be "Scheme is more powerful", because its constructs are very flexible (e.g. it has first-class functions and continuations, which the languages you mention lack or only have to a limited extent), or "No", because all these languages are Turing-complete and thus can do everything the others can.

However, outside the programming language community, the question probably refers not just to the language, but also to the libraries, and there Scheme could reasonably be said to lose out to at least Java. On the other hand, there are Scheme implementations that can call Java code, and thus access everything that is available for Java...

Re:Qs (1)

portmapper (991533) | more than 7 years ago | (#16125818)

> However, outside the programming language community, the question probably refers not just to
> the language, but also to the libraries, and there Scheme could reasonably be said to lose out
> to at least Java.

Without extensive libraries, most programming languages are not very useful for many
common tasks.

Re:Qs (1)

RAMMS+EIN (578166) | more than 7 years ago | (#16125889)

``Without extensive libraries, most programming languages are not very useful for many common tasks.''

True, but that's neither here nor there. A language can make an excellent text processing, web programming, scripting, etc. language without needing extensive libraries.

Re:Qs (1)

Abcd1234 (188840) | more than 7 years ago | (#16126343)

Sure, if you enjoy rolling your own FastCGI/HTML generation/string processing/database interface/<insert other useful stuff here> libraries.

Languages without extensive first/third parties libraries are useless. And languages like Scheme and Lisp are particularly crippled because they don't even have a standard extension mechanism. I say this having explored the idea of rolling some interesting applications in Lisp... why would I spend half my time writing libraries when I could switch to Perl/Python/Ruby/C/C++/Java/etc and just get things done?

Re:Qs (2, Interesting)

RAMMS+EIN (578166) | more than 7 years ago | (#16126580)

``Languages without extensive first/third parties libraries are useless.''

I won't argue this point further. I've already stated that languages without _extensive_ libraries can still be useful in specific domains. I still stand by that view.

``And languages like Scheme and Lisp are particularly crippled because they don't even have a standard extension mechanism.''

Huh? The package system is a standard feature of Common Lisp. R6RS may standardize a module system for Scheme (although this is not certain yet); in the absence of that there is SLIB, which provides a de-facto standard mechanism.

Re:Qs (1)

Goaway (82658) | more than 7 years ago | (#16126045)

Here, let me help you parse the replies to your questions:

No, no, no, no, no, no and no.

Re:Qs (1)

grumbel (592662) | more than 7 years ago | (#16126086)

Does using scheme make sense when building a windows GUI application?

Short subjective answer: No

Scheme is a nice language and has some very interesting properties, so learning it is well worth it, but its really not the lanuage that you would want to use for your daily work, for that it simply lacks a lot of convenience features (++a becomes (set! a (+ a 1)) and it also lacks standardization bejoint its very core, which means that every Scheme implementation comes with its own set of libraries for all kinds of jobs, even trivial tasks like a for-loop you have to either code yourself or rely on non-portable extensions.

In terms of 'power', yes its more powerfull, with macros I can do a heck of cool stuff that isn't possible in most other languages, but then those tricks seldomly result in readable code and you can get very similar effects with much cleaner tools like Rubys blocks, generators and similar things provided by other language.

To make it short, Scheme is for most part an academic language, worth learning it is, worth using not so much.

Um. (2, Informative)

Estanislao Martínez (203477) | more than 7 years ago | (#16126133)

;;;
;;; Macro to increment a variable by one.
;;;
;;; Usage:
;;;
;;; (define a 5)
;;; (inc! a)     ; a is now 6
;;;
(define-syntax inc!
  (syntax-rules ()
    ((inc! x)
     (set! x (+ x 1)))))

Not that idiomatic Scheme code will do this very often.  Langauges like Java or C use "++a" most often for loop indexes.  Looping in Scheme is typically driven off data structures.

Re:Qs (1)

bidule (173941) | more than 7 years ago | (#16126176)

(define-macro (increase! var . rest)
    `(begin
            (set! ,var (+ ,var ,(if (null? rest) 1 (car rest)))) ,var))

(increase! a)
(increase! a (+ 1 2))

Obviously you could use (++ a), but that is not important.

Re:Qs (4, Insightful)

John Nowak (872479) | more than 7 years ago | (#16126193)

but its really not the lanuage that you would want to use for your daily work, for that it simply lacks a lot of convenience features (++a becomes (set! a (+ a 1))

This just shows a lack of fundamental understanding of how one typically writes Scheme programs. If you're incrementing variables to the point where that becomes a concern, you're completely misusing the language.

even trivial tasks like a for-loop you have to either code yourself or rely on non-portable extensions.

Again, this shows you have no experience with the language, or you've been using it horribly wrong. There's no reason you should ever need a for loop in Scheme. If you're going to use Scheme as mostly imperative language, you're better off with Python or similar.

Re:Qs (1)

bidule (173941) | more than 7 years ago | (#16126201)


I have worked on a database modeler and a complete IDE under Windows. It was a bastardized Scheme with objects, but still...

So I have to say: done, done, maybe, maybe. And yes, if only for the ability to execute any code while stopped in the debugger.

Thith ith awethome (1)

brilinux (255400) | more than 7 years ago | (#16125733)

Actually, I have been carrying around R5RS with me for a while; it will be nice to suck down more print quota on r5r6 (when it is released). Scheme is quite a fun language, though as far as Lisps go, I do prefer Common. Still, for people who want to learn how to program, I generally tell them to start out with Scheme, usually using the PLT stuff [plt-scheme.org] , and to look at SICP [mit.edu] .

Re:Thith ith awethome (-1, Troll)

Dogun (7502) | more than 7 years ago | (#16125951)

You are a sick, sick person. There are a lot of languages which are far easier these days and actually have relevance. Why in the world would you point someone at Scheme as a first language - given that it is a language they may have at most 3 or 4 opporunities to use later in life?

Re:Thith ith awethome (1)

drgnvale (525787) | more than 7 years ago | (#16125981)

I don't know... maybe because they want them to understand programming concepts without having to learn a complicated syntax? Maybe they want them to see how first class functions make building extendable programs easier? Maybe there is a reason MIT and other top universities also start people off with scheme? I wish I had started out with scheme and not basic, I probably wouldn't have hated programming for so long if I had.

complicated syntax is readable and error-resistant (0, Flamebait)

r00t (33219) | more than 7 years ago | (#16126232)

Humans deal best with languages in which form matches function and there is a bit of redundancy.

Sure, you can go too far. Perhaps perl and C++ do.

In something like C or Pascal, a block is normally rather distinct from an expression. Humans rely on visual pattern recognition to read code. Scheme delibrately avoids anything that would be useful for pattern recognition.

With Scheme, it all becomes a blur. Every line is like every other line.

Re:Thith ith awethome (1)

brilinux (255400) | more than 7 years ago | (#16125985)

Because it is a small language, and one which will teach them the essentials of how to think about programming and structuring programs without the burdens of many heavier languages. And remember that I said "first language", and not "only language". While it may not be "useful" if they go into a programming career, I think that it helps to establish good reasoning and thought processes for when they do pick up other languages later.

Re:Thith ith awethome (0)

Anonymous Coward | more than 7 years ago | (#16126151)

I agree. Mind you, this was the early to mid-90's, but I first learned BASIC, Pascal, C, and then moved on to Scheme.

Learned Scheme first is just not advisable, in my mind.

Re:Thith ith awethome (1)

John Nowak (872479) | more than 7 years ago | (#16126153)

Scheme is a great language for teaching how to program. Knowing that is far more important than knowing the details of any particular language... these things can be picked up as needed.

For Language Enthusiasts (4, Informative)

RAMMS+EIN (578166) | more than 7 years ago | (#16125736)

Scheme is a language that every programming language enthusiast should know. Being both simple and flexible, it's suitable for communicating and explaining all kinds of concepts. A lot of books and papers are about Scheme or use Scheme for examples or teaching (see Readscheme.org [readscheme.org] ). Scheme also pioneered some of the concepts in modern programming languages (such as lexical scoping), as well as several uncommon features (such as hygienic macros and first-class continuations). There are many Scheme implementations, some tiny, some slow, some fast, some with extensive libraries, some which interface to other programming languages, etc. etc.

Re:For Language Enthusiasts (3, Informative)

TheRaven64 (641858) | more than 7 years ago | (#16125813)

Scheme is a language that every programming language enthusiast should know.

No, it (or some other Lisp dialect) is a language that every programmer should know. Every programmer should know Lisp, Smalltalk, and either C or some dialect of assembly language (ideally both). As a bonus, they should also know Haskell and Prolog. Once you know these languages, it is trivial to pick up any other. I would also recommend Erlang; not because it's a particularly good example of anything, but just because it's a real joy to work with.

Re:For Language Enthusiasts (2, Interesting)

brilinux (255400) | more than 7 years ago | (#16125853)

While we are on this bit, I would recommend an ML, either SML [standardml.org] or OCaml [inria.fr] , perhaps even in place of Haskell [haskell.org] (Haskell's syntax can be easily argued to be either better than or worse than ML's, and anything you can so in Haskell (including type-classes and lazyness) can be done in ML, so while I do use Haskell, I generally recommend one of the MLs as a well-typed, type-inferring functional language to know (OCaml if they are more systems/applications oriented, and SML if they are more theory oriented or just curious).

ML vs Haskell (1)

jefu (53450) | more than 7 years ago | (#16126150)

SML or OCaml are great lenguages, but if you're going to learn a functional language, Haskell is a great place to start. First because the syntax is very clean (I never quite liked the "let rec" bit) but also because in both SML and OCaml it is too easy to slip back into imperative styles. Haskell makes that substantially more difficult, which means to use it well you really, really have to get the whole functional programming idea.

Re:For Language Enthusiasts (1)

ramunasg (973228) | more than 7 years ago | (#16125872)

In other words, every programmer should know main programming paradigmas - imperative, functional, logic, object orientated. And a handful of calculis like CSP (which erlang concurrency primitives are based upon) :)

Re:For Language Enthusiasts (1)

TheRaven64 (641858) | more than 7 years ago | (#16126217)

In other words, every programmer should know main programming paradigmas - imperative, functional, logic, object orientated.

Definitely, but learning the paradigm is not quite the same as having it re-inforced by learning a concrete example. And a lot of people these days seem to be being taught things like Java and C++, and told that they are Object Oriented (a quote from Alan Kay: "I invented the term Object-Oriented, and I can tell you I did not have C++ in mind.")

And a handful of calculis like CSP (which erlang concurrency primitives are based upon)

Definitely CSP. Probably Lambda Calculus (I hated it, but it's quite useful), and possibly Pi Calculus.

Bah! I haven't quite finished my PhD, and I'm already complaining about what they teach undergraduates these days...

Re:For Language Enthusiasts (1)

EchoNiner (930773) | more than 7 years ago | (#16126242)

I agree with most, but would add a nice solid OO programming language. These concepts are very important with the stage that we are in with software development. A good understanding of something like Java (I chose this over C++ only because of its more strict OO nature, although something like Ruby might be a better example) helps understand the benefits that OO can provide in terms of code re-use and sharing in terms of interfaces and object heirarchies towards building code that is built from properly tested and secure codebases.

Re:For Language Enthusiasts (1)

Abcd1234 (188840) | more than 7 years ago | (#16126272)

I agree with most, but would add a nice solid OO programming language

So, did you miss him mentioning Smalltalk, or have you just never heard of it? Please *please* tell me you just missed it...

Re:For Language Enthusiasts (2, Insightful)

Poeir (637508) | more than 7 years ago | (#16126318)

I'm with you on the recommendation of learning Erlang, but not for the same reason you are. The vast majority of new systems are at least dual core today. Most people run at least two programs, often meaning that one program can run entirely on one core, and another program runs on another core. Intel recently announced quad-core CPUs, and the first prototypes have got into a few people's hands. It looks like as time goes on, instead of upping the clock speed, the number of cores will increase. Most programming languages in use today, make it hard to do concurrency (or at best, don't make it easy), but Erlang was designed as a concurrent language from the get-go. I am inclined to say that the next generation of effective languages will be similar to Erlang, in their ability to support concurrency, and that programmers who don't get used to writing in some form of concurrent languages will be left behind.

Re:For Language Enthusiasts (1)

oohshiny (998054) | more than 7 years ago | (#16126047)

Being both simple and flexible, it's suitable for communicating and explaining all kinds of concepts.

Scheme is an extremely cumbersome language for experienced computer scientists to communicate ideas: Scheme lacks many concepts (e.g., exceptions, threads, records, associative data structures) that are widely used for communicating ideas. That may be justifiable for a teaching language, but it makes Scheme too cumbersome for most other purposes.

Scheme also pioneered some of the concepts in modern programming languages (such as lexical scoping),

That statement mostly demonstrates how unfamiliar you are with the history of programming languages.

Re:For Language Enthusiasts (1)

masklinn (823351) | more than 7 years ago | (#16126163)

exceptions

meh [plt-scheme.org]

threads

yeah right whatever [plt-scheme.org]

records

can be trivially replaced by lists

associative data structures

such as hashes? [plt-scheme.org]

While these aren't into the RnRS themselves (they don't have many reasons to be there either, anyway), saying that Scheme somehow "lacks" these concepts mostly shows that you don't know the language at all.

Re:For Language Enthusiasts (1)

masklinn (823351) | more than 7 years ago | (#16126202)

And it sure looks like I should've read the R6RS status report before posting this, because all of these are either filed under "features to be added" or "Work in Progress" (with references to the related SRFIs)

Re:For Language Enthusiasts (1)

John Nowak (872479) | more than 7 years ago | (#16126164)

R6RS has exceptions and records. It has continuations, and some implementations provide threads (this is not something that belongs in the standard). It has hash tables. Also, the GP stated he recommends PLT, which already has all of these.

R6RS is not Scheme yet (1)

oohshiny (998054) | more than 7 years ago | (#16126292)

Well, I'm glad that we seem to agree that it is necessary (though not sufficient) for a language to have exceptions and threads in order to be a good language for communicating concepts in computer science. Right now, Scheme is defined by R5RS, and R5RS lacks those. That's one of the many reasons for Scheme's failure to catch on (contrary to popular opinion, syntax is probably not one of them; after all, XML and Perl succeeded despite their syntax).

Whether R6RS will be a good language for communicating concepts in computer science remains to be seen. From what I see in the draft standard, R6RS is a very different language from R5RS. I think R6RS ceases to be a good language for its original purpose (teaching), and it still remains a poor language for grown-up use (although for different reasons than before).

It's a real shame that the bungling of the Scheme and CommonLisp designers have effectively killed the entire Lisp family of languages. The world could really benefit from a nicely designed Lisp.

Re:For Language Enthusiasts (1)

bidule (173941) | more than 7 years ago | (#16126231)


Here Scheme has the same failing as the C language. The C++ language does not define threads either. If you skim through the srfi, you'll find that most if not all of these issues are "standardized", but outside the language itself.

Re:For Language Enthusiasts (1)

feijai (898706) | more than 7 years ago | (#16126361)

There are many Scheme implementations, some tiny, some slow, some fast, some with extensive libraries, some which interface to other programming languages, etc. etc.

IMHO, this is precisely why Scheme has failed to catch on in the Lisp community. There really isn't a standard: there are a series of standards and a whole lot of RFIs, and every Scheme system implements its own subset. It's amazingly frustrating building a portable Scheme program. Common Lisp has fewer, more stringent standards, and is much more compatable across implementations. A lack of standard socket libraries notwithstanding. :-( Compare this to Python or Ruby or Java or Perl, where there is not only a standard, but a benchmark program which every implementation must be bug-for-bug compatable with. That's when you start seeing real portability.

Re:For Language Enthusiasts (1)

RAMMS+EIN (578166) | more than 7 years ago | (#16126439)

``IMHO, this is precisely why Scheme has failed to catch on in the Lisp community. There really isn't a standard: there are a series of standards and a whole lot of RFIs, and every Scheme system implements its own subset.''

I'd say you get the general gist, but I can't really agree with your wording. There really is a standard. And yes, it is very minimal, but that's deliberate: the idea has been that something only gets standardized once everybody agrees on the way to do it, and implementations are left free to implement everything else the way they deem best. I think that's a perfectly reasonable principle, even if it does have the effect of fragmenting the community.

``Compare this to Python or Ruby or Java or Perl, where there is not only a standard, but a benchmark program which every implementation must be bug-for-bug compatable with. That's when you start seeing real portability.''

Actually, no. Most of these languages don't _have_ a standard, only an implementation. Anything professing to be an implementation will try to be compatible (bug for bug) with that implementation, but I think experience shows that that goal is not always achieved. I would say that comparing, e.g., Ruby and Scheme is comparing apples and oranges, just like comparing Windows and "Linux" is. To get meaningful comparisons, you could do something like comparing Ruby and MzScheme, or Windows and Ubuntu.

Veni, Vidi, Parenthesi (1)

FlyByPC (841016) | more than 7 years ago | (#16125742)

..."I came, I saw, I programmed in LISP." This is interesting, but what I'd like to see is a dual-core-optimized dialect of QBasic that will handle obscenely large arrays without kvetching.

Re:Veni, Vidi, Parenthesi (0)

Anonymous Coward | more than 7 years ago | (#16125988)

Try "ceci n'est pas UNE sig". It's UNE signature (just like it was UNE pipe).

Re:Veni, Vidi, Parenthesi (1)

FlyByPC (841016) | more than 7 years ago | (#16126196)

Merci bien. Ce n'est pas la première fois que je me trompe ainsi. (Les langues étrangères sont difficiles pour nous Américains, vous savez...)

Re:Veni, Vidi, Parenthesi (1)

Sterling Christensen (694675) | more than 7 years ago | (#16126069)

but what I'd like to see is a dual-core-optimized dialect of QBasic that will handle obscenely large arrays without kvetching.
FreeBASIC. http://www.freebasic.net/ [freebasic.net] It's no more optimized for dual-core than C is, but it runs as fast as the equivalent C code compiled with -O0 (it doesn't optimize yet). Compiles to asm like C does (no bytecode, no VM) and usually beats other BASICs in benchmarks. It handles arrays as large as C can. And of all the modern BASICs it's the closest to QBasic, able to run many nontrivial (including graphical) QBasic programs unmodified. Here's an IDE for it if you're interested: http://fbide.freebasic.net/ [freebasic.net]

Re:Veni, Vidi, Parenthesi (1)

Sterling Christensen (694675) | more than 7 years ago | (#16126079)

Ooops, with <br>'s this time:

but what I'd like to see is a dual-core-optimized dialect of QBasic that will handle obscenely large arrays without kvetching.
FreeBASIC. http://www.freebasic.net/ [freebasic.net]

It's no more optimized for dual-core than C is, but it runs as fast as the equivalent C code compiled with -O0 (it doesn't optimize yet). Compiles to asm like C does (no bytecode, no VM) and usually beats other BASICs in benchmarks. It handles arrays as large as C can. And of all the modern BASICs it's the closest to QBasic, able to run many nontrivial (including graphical) QBasic programs unmodified.

Here's an IDE for it if you're interested: http://fbide.freebasic.net/ [freebasic.net]

Re:Veni, Vidi, Parenthesi (1)

FlyByPC (841016) | more than 7 years ago | (#16126211)

Thank you! You have just made an IT dinosaur very very happy!

Re:Veni, Vidi, Parenthesi (1)

cervo (626632) | more than 7 years ago | (#16126498)

Woah, Basic with pointers and dynamic memory allocation, now that is scarey!!!!!

lightning000rod@hotmail.com (0)

Anonymous Coward | more than 7 years ago | (#16125762)

lightning000rod@hotmail.com

Re: cursion (1)

mrogers (85392) | more than 7 years ago | (#16125774)

((((((((comment this) below) jokes) programming) functional) all) place) please)

Re: cursion (1)

RAMMS+EIN (578166) | more than 7 years ago | (#16125978)

(let loop ()
        (display "> ")
        (write (eval (read)))
        (newline)
        (loop))

New features? (5, Funny)

RPoet (20693) | more than 7 years ago | (#16125791)

I've never heard about this language, but hopefully the new version will help it keep up with the latest innovations in programming languages, such as codeblocks and Web 2.0.

Yours truly,
Fictional stereotypical teenage Ruby fanatic.

Scheme and Common Lisp... (2, Informative)

mav[LAG] (31387) | more than 7 years ago | (#16125800)

are both tools of beauty that have taught me more about programming and problem-solving than all other languages combined. SICP [mit.edu] and PAIP [norvig.com] are both classics in this regard that everyone should rush out and get now.

It's just such a pity that, since they're both standards which anyone can implement, lots of people do, and as a result, finding one you like and then getting it to talk to other languages and libraries can be a very frustrating experience. And languages like Python with one canonical implementation driven by a BDFL and with exceptional library support are just getting more Lisp-like, which can't be good news for for a renaissance in Lisp or Scheme. Pity really, since I really like 'em both...

Re:Scheme and Common Lisp... (1)

mitchskin (226035) | more than 7 years ago | (#16126074)

If anything, python is getting less lisp-like. Guido wants to get rid of lambda, map(), filter() and reduce() in Python 3000.

Re:Scheme and Common Lisp... (1)

masklinn (823351) | more than 7 years ago | (#16126173)

Nope, he had some desire to but finally decided against it.

Lambdas stay in, and the worst that can happen to map, filter and reduce would be to be moved to a standard package instead of being in the global namespace (akin to imap and ifilter in the iterable module)

What's with naming these days? (0)

Anonymous Coward | more than 7 years ago | (#16125822)

I swear the people coming up with tech names these days are just trying to confuse everybody. I mean, come on... Scheme?? That's just as bad as calling the new Half-Life Engine "Source". A scheme is something which is used in programming, as is the source code. Why can't they call it something unrelated to technology so that people don't get confused by the scheme of a Scheme data set just like people got confused with the source for Source was stolen.

Re:What's with naming these days? (1)

RPoet (20693) | more than 7 years ago | (#16125841)

The name "Scheme" was picked in the 1970s, so I wouldn't say Scheme joins Source in "today's" bad naming practices.

Re:What's with naming these days? (2, Informative)

siride (974284) | more than 7 years ago | (#16126188)

From Wikipedia: "Scheme started as an attempt to understand Carl Hewitt's Actor model.[1] Scheme was originally called "Schemer", in the tradition of other Lisp-derived languages like Planner or Conniver. The current name resulted from the authors' use of the ITS operating system, which limited filenames to two components of at most six characters each. Currently, "Schemer" is commonly used to refer to a Scheme programmer."

rather perl (1)

losec (642631) | more than 7 years ago | (#16125832)

I rather program in an modern language that has invented closures and anonymous functions, like perl.

Re:rather perl (1)

brilinux (255400) | more than 7 years ago | (#16125885)

(lambda (parent) (display (list parent 'is 'this 'a 'joke?)))

Re:rather perl (1)

losec (642631) | more than 7 years ago | (#16126050)

$a = sub { "yes"; }; print &$a;

Tail Recursion (5, Informative)

RAMMS+EIN (578166) | more than 7 years ago | (#16125838)

For those of you who don't know what "properly tail recursive" means, a quick explanation. Consider the following code:

(define (f x) (x x))
(f f)

This defines a function, f, which takes one argument, x, which should be a function (yay, first-class functions!), and calls x upon itself. Then, it calls f on f.

Of course, this will cause f to call f upon itself. Again. And again. Infinite recursion!

Now, proper tail recursion means that if a function call returns in tail position (meaning it is the last thing the surrounding function does before it returns), the activation frame for the surrounding function is replaced by that of the function it calls. Contrast this with normal recursion, where a _new_ activation frame would be created for the called function.

Tail recursion makes the example code above run in bounded memory...looping forever. :-)

Re:Tail Recursion (0)

Anonymous Coward | more than 7 years ago | (#16125876)

Y man, Y?

Re:Tail Recursion (1)

StonyUK (173886) | more than 7 years ago | (#16125894)

It's good because it won't crash by exhausting the runtime's stack space. Instead it will just loop forever.

Re:Tail Recursion (1)

RAMMS+EIN (578166) | more than 7 years ago | (#16125947)

I think you missed the joke. I'm sure the parent was referring to the Y combinator [wikipedia.org] .

Re:Tail Recursion (0)

Anonymous Coward | more than 7 years ago | (#16126032)

You got your facts right.
-The anonymous poster, who is quite aware that the GP's comment was not actually the Y-combinator, but could not resist.

Re:Tail Recursion (1)

Watson Ladd (955755) | more than 7 years ago | (#16125892)

Not bounded memory. It just has to run forever. If the system has an infinite amount of memory, that memory can be consumed by the recusion and that is propert tail recursion. Not that that would matter at all in reality.

an oxymoron (-1, Troll)

r00t (33219) | more than 7 years ago | (#16126276)

"properly tail recursive" is an oxymoron. Tail recursion is not proper. Decent programmers use loop constructs for looping.

Your problem is that Scheme can't do that. When all you have is a hammer, everything looks like a nail. Sure, you can emulate a loop construct, but this is pure stupidity. Needless recursion makes your code more convoluted and less readable.

Just like Pascal, Scheme is a lobotomized teaching language. Just like Pascal, you will find people who try to use it for real work while the rest of us groan in horror. Actually, Pascal whips Scheme's sorry ass.

In my language of choice, I can do looping with recursion. I can also do looping with goto. I know enough to avoid pulling dumb-ass stunts like that.

It's amazing how people can claim a deficiency as some kind of advantage. You just keep smoking...

Re:an oxymoron (4, Interesting)

RAMMS+EIN (578166) | more than 7 years ago | (#16126559)

``"properly tail recursive" is an oxymoron. Tail recursion is not proper. Decent programmers use loop constructs for looping.''

That's highly debatable. I would agree that when you want to express the concept of a loop, it's best to use a looping construct, but other people would disagree. Also, tail calls are more general than loops; for example, they also work for mutually recursive functions.

Which is more elegant?

int gcd(int a, int b) {
    return (b == 0) ? a : gcd(b, a % b);
}

or

int gcd(int a, int b) {
    int t;
    while (b != 0) {
        t = b;
        b = a % b;
        a = t;
    }
    return a;
}

``Your problem is that Scheme can't do that.''

That depends on what you mean by "Scheme can't do that". It's entirely possible to implement looping constructs in Scheme, and several people have done so. Scheme can't do looping in the same sense that C can't compute factorials.

``When all you have is a hammer, everything looks like a nail.''

Except that, in Scheme, you can make your own tools on a much more fundamental level than in many other languages. Thanks to tail call optimization, you can _implement_ looping constructs, even though the language doesn't provide them.

``Needless recursion makes your code more convoluted and less readable.''

I think the example I gave earlier illustrates that, sometimes, recursion leads to less convoluted, more readable programs. The right tool for the job, ey? In a language that isn't properly tail recursive, the recursive gcd would be a bad idea because the recursion would eat memory, but in Scheme it's no problem.

``It's amazing how people can claim a deficiency as some kind of advantage. You just keep smoking...''

I'm not claiming a deficiency as an advantage. I'm claiming tail call optimization is a nice features to have. There is no deficiency here.

You could argue that the lack of looping constructs is a deficiency. However, the lack of looping constructs (1) is not at all implied by the language being properly tail recursive, (2) is easily remedied, and (3) actually has been remedied in many implementations.

And no, I don't smoke, though I do live in the Netherlands.

Isn't it amazing... QWZX (-1, Troll)

Anonymous Coward | more than 7 years ago | (#16125861)

Isn't it amazing how much effort people will go through to specify something that NO ONE will use in any sort of production capacity?

All right, to be fair, I'm sure there is SOMEONE out there that has used Scheme in a production capacity, but that's only because he was an idiot who wanted to use his little plaything language rather than use something everyone else will be able to be maintain.

There is a reason that C and C++ derived languages dominate the industry.

Re:Isn't it amazing... QWZX (0, Flamebait)

masklinn (823351) | more than 7 years ago | (#16126182)

There is a reason that C and C++ derived languages dominate the industry.

Because managers are stupid fucks and don't know any better?

Re:Isn't it amazing... QWZX (0)

Anonymous Coward | more than 7 years ago | (#16126255)

Yeah, because every peon is clamoring for Scheme and Smalltalk, while the ev1l managers are forcing C and Java on them. ::rolls eyes::

Another language developed for compilers (0)

kanweg (771128) | more than 7 years ago | (#16125979)


Despite having written/co-authored 2 booklets on programming (AppleScript for Absolute Starters and Become an X-coder), I've never mastered programming and I keep an eye out for easy to learn language, allowing me to focus on the programming instead of on keeping straining my brain with the grammar side of it. One of the earliest languages I learned was Pascal, which wasn't that bad, but doesn't appear to be as popular as it used to be (TurboPascal and all). But Scheme looks like one of the many programming languages developed for parsers and compilers, instead of for the people. Programming languages should be easy to read for humans too.

Recently I read about a programming language (Python?) where global variables and local variables had a different starting thingie ($ and, I forgot). Now things like that DO help to make sure you're not a writer of a collection of bugs.

Bert
Just the number of parentheses rules out Scheme for me

Re:Another language developed for compilers (1)

shobadobs (264600) | more than 7 years ago | (#16126066)

That's because you're an idiot. The parentheses are not a problem at all when reading code.

Lisp syntax has great cognitive advantages (5, Insightful)

Estanislao Martínez (203477) | more than 7 years ago | (#16126092)

But Scheme looks like one of the many programming languages developed for parsers and compilers, instead of for the people. Programming languages should be easy to read for humans too.

Lisp syntax certainly does not attempt to look like the combination of English text and mathematical formulas that most languages shoot for, but this in fact has many advantages. The idea of making a language look like that doesn't change the fact that the language will work in a way very different from English or mathematical notation; your previous knowledge of those things will not necessarily help you reason about your code, and at worst, may confuse newcomers by tempting them to apply analogies that don't hold. And to achieve that "look" for your language, you always end up giving it a really complex and inflexible syntax, whose users are not going to have any systematic knowledge of. (Do you know many people who can give you a BNF grammar for Java, or tell you the exact precedence rules for it?)

Lisp makes no pretence at looking like English or mathematics. You're certainly expected to understand the syntax rules of the language more than in "friendlier" ones, but these rules are far, far simpler, and you can actually reason them through. Remember, Scheme oooks regularly include a section that shows you how to write a Scheme interpreter in one page of Scheme code; basic knowledge of how Scheme itself works is considered to be elementary Scheme knowledge.

That is, what I'm saying is that compared to other languages, Lisp dialects demand that you understand the language itself far more, but this is a good thing, which will make you program way better. Why? Because you're going to be able to reason about the execution of your program far better than your average Java programmer.

Plus, you can do macros.

Re:Another language developed for compilers (1)

John Nowak (872479) | more than 7 years ago | (#16126178)

, I've never mastered programming and I keep an eye out for easy to learn language, allowing me to focus on the programming instead of on keeping straining my brain with the grammar side of it.

Just the number of parentheses rules out Scheme for me

You're missing out then on the language with perhaps the easiest grammar in existence.

Re:Another language developed for compilers (0)

Anonymous Coward | more than 7 years ago | (#16126180)

Thank you for posting that comment. I've been meaning to pick up a reference on XCode, and I now know what I should avoid like the plague.

Anyways, to say Scheme was developed 'for parsers and compilers' is a bit off the mark. Yes, the language syntax makes it very easy to parse, and yes, it's very easy to write little compilers using macros, but this is hardly the motivator for the language's development. The language actually very closely follows the lambda calculus, making it good for reasoning formally about programs written in the language. Anyways, as a practical matter, once you start using lisp, the syntax becomes a strength rather than a weakness.

Also, I think you are thinking of Perl when you so eruditely comment on the use of 'different starting thingies' to distinguish variables. If this is the case, I think it is safe to say that you are among the first to accuse Perl's syntax of being conducive to writing bug-free code.

Re:Another language developed for compilers (1)

PostPhil (739179) | more than 7 years ago | (#16126227)

Despite starting out with the usual languages of my generation, such as Basic, Pascal, C, and C++, I eventually chose Python as the jack-of-all-trades for my programming for the reason you mentioned. It is human-friendly rather than focusing on saving clock cycles, and I wanted to be able to work from one language for almost everything (it has bindings for almost everything). It's kind of a strange coincidence that Scheme was Slashdotted today, as I was browsing websites for learning LISP or Scheme as well. Maybe it's just intuition, but my gut feeling is that the simplicity of LISP/Scheme will help me re-think programming, as they say. My end goal is to improve my Python programming, and perhaps use Bigloo Scheme to write compiled programs for the JVM, .NET, and C that I will use in coordination with Python.

But I would be careful about being too quick to judge Scheme as a human-unfriendly language. There are lots of parentheses to type, but to me that doesn't hurt the readability because its uniformity maintains the same "flow" throughout the program. It's all just lists using parentheses. Normally, I would hate parentheses being a Python programmer, but at least Scheme doesn't require semicolons and tons of other types of brackets and dots and slashes, and so the elegance of parentheses-only makes up for the extra typing. From what I've seen so far, readability is more a matter of knowing the names of the procedure calls and keywords, so it has more to do with being unfamiliar with the language.

By the way, you must be thinking of a different language than Python. Python doesn't require a $ as a prefix for anything at all. Global variables are either already global or you use the "global" keyword. Perl uses a $ in front of variables, but if you want to avoid "straining your brain with the grammar side" and use a simple and readable language, I sincerely hope you aren't thinking of Perl. Not that it's a bad language, but readability is a deliberate effort in Perl that isn't really encouraged by the syntax itself.

Re:Another language developed for compilers (2, Insightful)

HiddenL (967659) | more than 7 years ago | (#16126400)

Actually, Scheme/LISP was designed for "correctness" rather than for ease of compiler implementation. Take for instance something like

x = y + 1;

in C. That doesn't actually mean "x = y + 1" it means "x = y + 1 (mod 2^32)". Why is it done this way? Because it is a lot easier for a compiler designer to implement integers if they are always a fixed number of bits.

On the other hand, Scheme does it the correct way, so that (set! x (+ y 1)) actually does what it looks like it does. This is one of the reasons C compilers took off in the 70s while lisp compilers stagnated. I suggest you read the paper "Worse is Better"

---
Your resident MIT student

PS. Don't take this as support for Scheme. I hate Scheme.

Scheme--now with bloat! (-1, Troll)

oohshiny (998054) | more than 7 years ago | (#16125996)

How that language ever acquired a reputation for being a "clean, simple" design, I will never know. The Scheme number system alone is a mess, and reducing the number of primitives by creating a can of worms like CALL-CC is not good design. Furthermore, at 142 pages long, the language is getting rather bloated.

We need a nice, clean, simple, powerful teaching language to replace C and Java; Scheme is not it.

That's a bald assertion. (1)

Estanislao Martínez (203477) | more than 7 years ago | (#16126016)

[...] reducing the number of primitives by creating a can of worms like CALL-CC is not good design.

Please argue for this point.

Re:That's a bald assertion. (0)

oohshiny (998054) | more than 7 years ago | (#16126213)

Please argue for this point.

Well, from the point of view of design, the lack of standard threading and exception facilities in Scheme seems to have resulted in a lot of incompatibilities between different Scheme code. That's one of the reasons I stopped using Scheme.

The real question is: how did the Scheme designers ever demonstrate that their design decisions (call/cc or otherwise) were good ones?

Library System (1)

StupidEngineer (102134) | more than 7 years ago | (#16126083)

Yay, they standardized on a library system!

So what's new? (1)

sco08y (615665) | more than 7 years ago | (#16126160)

I notice that r6rs has a lot more editors than r5rs, and another author...

Which isn't surprising. r6rs is twice as long as r5rs which had the entire table of contents on the first page.

I'm glad to see that a lot of the slib stuff is being merged into scheme, and that they're making a lot of progress on number types. r6rs is laying out a lot more information on ADTs, IO and Unicode support.

The explanation of continuations is still as clear as mud. How are they so easy in Python and so hard in Scheme?

Why should I learn Scheme? (4, Interesting)

Bluesman (104513) | more than 7 years ago | (#16126415)

This always comes up, but if you're at all interested in programming languages, here's why you should learn Scheme.

A few years ago I was doing a project that involved parsing the intermediate code that GCC generated while compiling a C program. Doing a bit of research I found out that one of GCC's intermediate stages was a language called RTL (register transfer language). To my surprise, RTL looked something like this:

(set (reg:0) (mem:blah blah))

But wait, I thought -- that looks like Lisp. Come to find out RTL was based on lisp s-expressions.

It was then I realized what the Big Deal with Lisp was - it has no syntax at all, and programs written in this parenthetical form are trivially converted into a parse tree. In fact, if you've ever written a simple interpreter or compiler, odds are good you'd use a list-like structure to store the parsed code.

The reason Lisp and Scheme are so "powerful" is that you, as a programmer, have direct access to the program's parse tree at all times. (You can even alter the parse tree at compile time with macros, which is really modifying the compiler to suit your program.)

But really, the best way to learn why Scheme or Lisp are so great is to implement them. Writing a Scheme to assembly compiler will give you an incredibly deep understanding as to how compilers and programming languages in general work.

If you were to try to write a compiler for any other language, you'd probably spend most of your time on the lexer and parser. With Lisp or Scheme, the program, as written, is already almost fully parsed for you. Once you understand that, you'll realize why it's so cool.

Learn Scheme (3, Informative)

borgboy (218060) | more than 7 years ago | (#16126509)

I am sure there are a numer of ways to learn Scheme if you are interested. Here's one: follow the CS-61A course podcast [berkeley.edu] of Brian Harvey's class at Berkeley.

informative gOa7goat (-1, Flamebait)

Anonymous Coward | more than 7 years ago | (#16126586)

Load More Comments
Slashdot Account

Need an Account?

Forgot your password?

Don't worry, we never post anything without your permission.

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>
Create a Slashdot Account

Loading...