Who else uses Textmate for Scheme? I know, most of the LISP community use Emacs alone for religious reasons, but since there was a Scheme language definition already there, I can't be the only one :-)
Anyway, for my own use I've been adding to the Scheme language a bit; telling it about define-syntax, then adding properties so that (define (foo ...) ...), (define foo ...) and (define-syntax foo ...) all result in 'foo' appearing in the symbol list, and writing a few snippets for common things.
I'd like to look into figuring out a good way to do help on current symbol type stuff, but I'm not sure where best to refer to. Since the current language starts 'csi' as the interpreter, the Chicken documentation on callcc.org would be a good bet, but it would be nice to keep the Scheme language as implementation-indepedent as possible. Or have a base Scheme language then a special module for Chicken Scheme that binds run script, help on symbol, etc.
If there's any other TextMate schemers about, I can post the resulting diffs, and if everyone likes them, send 'em in to go in the repository?
ABS
-- Alaric Snell-Pym Work: http://www.snell-systems.co.uk/ Play: http://www.snell-pym.org.uk/alaric/ Blog: http://www.snell-pym.org.uk/?author=4
Alaric Snell-Pym wrote:
Who else uses Textmate for Scheme? I know, most of the LISP community use Emacs alone for religious reasons, but since there was a Scheme language definition already there, I can't be the only one :-)
Anyway, for my own use I've been adding to the Scheme language a bit; telling it about define-syntax, then adding properties so that (define (foo ...) ...), (define foo ...) and (define-syntax foo ...) all result in 'foo' appearing in the symbol list, and writing a few snippets for common things.
I'd like to look into figuring out a good way to do help on current symbol type stuff, but I'm not sure where best to refer to. Since the current language starts 'csi' as the interpreter, the Chicken documentation on callcc.org would be a good bet, but it would be nice to keep the Scheme language as implementation-indepedent as possible. Or have a base Scheme language then a special module for Chicken Scheme that binds run script, help on symbol, etc.
If there's any other TextMate schemers about, I can post the resulting diffs, and if everyone likes them, send 'em in to go in the repository?
I think that all sounds great. I have only done a very little bit of scheme. I added a bit to the run command about a year ago to make it also work with guile set as the TM_SCHEME_INTERPRETER, and then I think added a bit of stuff to the language grammar, particularly to make it work with Lilypond (which is a music engraving description language which uses embedded scheme for customization).
In addition to work on the bundle as it exists now in TM1, it would be very useful for Scheme/Lisp users to add input (i.e. talk to allan) about how the indentation/folding system could be modified/extended for better support of languages with Lisp-like syntax.
Cheers! Jacob
On 18 Jun 2007, at 2:05 am, Jacob Rus wrote:
I think that all sounds great. I have only done a very little bit of scheme. I added a bit to the run command about a year ago to make it also work with guile set as the TM_SCHEME_INTERPRETER, and then I think added a bit of stuff to the language grammar, particularly to make it work with Lilypond (which is a music engraving description language which uses embedded scheme for customization).
Ah, cool. I was wondering if anybody did any DSSSL, too.
What I have so far is at http://love.warhead.org.uk/~alaric/ Scheme.tmbundle.tar.gz - extract that into ~/Library/Application Support/TextMate/Bundles; make sure you already have the Scheme bundle installed in /Library/... since my bundle is just a delta to that.
In addition to work on the bundle as it exists now in TM1, it would be very useful for Scheme/Lisp users to add input (i.e. talk to allan) about how the indentation/folding system could be modified/ extended for better support of languages with Lisp-like syntax.
Yeah...
The fun part is that it's normal to stack the 'end' symbols on one line.
Ruby:
def foo ... if bar foo.each do ... end else ... end ... end
Scheme:
(define (foo) (if bar (map foo ...) (...)))
^ ends the (..., the if, and the define, all in one
Funnily enough, this causes a problem with how the folding symbols are put in the left hand margin.
As for indentation - here's a few examples of normal approaches:
This is the standard indent rule, used after a line with more (s and ) s in:
(define (foo x) (body indented one standard indent))
But sometimes you're expected to make things line up neatly:
(if items lined up)
(cond ((= x 1) something) ((= x 22) something else lined up) ((= x (* y 2)) somethine else yet but still lined up)
In both of those cases, on the line before the indent, you have a "last unmatched left parens"; on the cond example, the ((= x 1) something) balanced, so the last unmatched is the one before cond, and on the if case, it's the one before if. The correct point to indent to is the character AFTER the whitespace AFTER the last unmatched left parenthesis. I think.
Let (and its many variants) are a bit special:
(let ((bindings 1) (lined 2) (up 3)) (body indented one standard indent))
Not quite sure how I'd express that as a rule!
When the arms of a cond get too long, you usually put a line break in and return to standard indenting rules:
(cond ((= x 1) one standard ndent) ((= x 22) still all lined up) ((= x (* y 2)) but on a standard indent not some other marker)
Cheers! Jacob
ABS
-- Alaric Snell-Pym Work: http://www.snell-systems.co.uk/ Play: http://www.snell-pym.org.uk/alaric/ Blog: http://www.snell-pym.org.uk/?author=4
On Jun 18, 2007, at 5:57 AM, Alaric Snell-Pym wrote:
What I have so far is at http://love.warhead.org.uk/~alaric/ Scheme.tmbundle.tar.gz - extract that into ~/Library/Application Support/TextMate/Bundles; make sure you already have the Scheme bundle installed in /Library/... since my bundle is just a delta to that.
Just a quick tidbit… Best way to share a bundle is to drag it from the Bundle Editor to the desktop, a new complete bundle is created that anyone can use. Also works with individual items from a bundle.
On 18. Jun 2007, at 12:57, Alaric Snell-Pym wrote:
[ indenting in scheme ] Not quite sure how I'd express that as a rule!
I have seen scientific papers on pretty-printing functional programming languages, so this is not exactly trivial ;)
I definitely prefer a rule-based system, but I am also open for allowing actual code to re-indent the source, but that requires an API, and before I do that, I need someone stepping up who actually will (and can) write a re-indenter for the problematic languages.