Loading ...
Sorry, an error occurred while loading the content.

Re: scheme and vim

Expand Messages
  • Hans Fugal
    John, Thanks for the very informative reply! I am glad that my question prompted you to do a little research that will hopefully make us both happier
    Message 1 of 3 , Sep 5 5:50 PM
    • 0 Attachment
      John,
      Thanks for the very informative reply! I am glad that my question
      prompted you to do a little research that will hopefully make us both
      happier 'scheming vimmers'.

      After getting my feet wet, I like scheme in that it is something
      different - a different paradigm. It will be interesting to work with.

      If the :set lisp solution and/or the syntax highlighting doesn't meet my
      expectations I anticipate I might do a little bit of hacking in
      vimfiles... time permitting. But there's no point in duplicating
      efforts if someone else has done it. Is anyone aware of vim/scheme
      references not included with vim6 or on the official vim webpages?

      Hans :)

      * John Beppu (beppu@...) thus spake:
      > [ date ] 2001/09/05 | Wednesday | 09:30 AM
      > [ author ] Hans Fugal <hans@...>
      >
      > Hi Hans,
      >
      > > I am taking a programming languages class where pretty much everything
      > > we do is going to be in scheme. I've looked on the web and not found
      > > anything practical on using scheme with vim - and since I have no
      > > experience yet with scheme I can't really make a judgement call here.
      > > They encourage us to use emacs, I would rather not.
      >
      > <blasphemy>
      >
      > I recently had to write some Script-Fu for the Gimp, and I tried
      > to use vim, but emacs just worked better for Scheme development.
      > The part about emacs that I liked the best was that its scheme
      > mode understood the code formatting conventions used by the
      > scheme community, and hitting tab would automagically indent a
      > line to exactly the right column. [0]
      >
      > </blasphemy>
      >
      > In Scheme code (and code for Lisp derivatives in general),
      > indentation of code is not as rigid as it is in languages that
      > can trace their roots back to Algol. Whereas these languages
      > have a convention for indenting blocks of code w/ regularly
      > spaced intervals, Scheme code is seldom indented this way. That
      > isn't to say that there isn't logic and consistency to the
      > Scheme style of indenting. There is, but it's different from
      > what I'm used to.
      >
      > > Before I go
      > > learning all those bucky-bit combos, do any of you happily do scheme
      > > stuff in vim? Are there any secrets?
      >
      > I'd be interested, too. I would have liked to use vim, but I
      > found that emacs was better-suited for doing Scheme development.
      >
      > As long as I'm here, let me pass on a few links to you to help
      > you learn Scheme. I, myself, just learned Scheme last week, and
      > I found the following tutorial to be excellent.
      >
      > http://www.cs.rice.edu/~dorai/t-y-scheme/t-y-scheme.html
      >
      > Also, if you know a scripting language like Perl, Python, Ruby,
      > or even JavaScript... try to play with the functional
      > constructs that these languages provide. I'm primarily a Perl
      > guy, so if you were to use Perl, I would suggest that you
      > practice using the following:
      >
      > * lexical closures (aka anonymous subroutines)
      > - this way, when you see words like "lambda", you won't
      > be confused. Python doesn't have lexical closures,
      > yet, but all the other languages I mentioned do.
      > Here's an example in Perl:
      >
      > sub iterator {
      > my $start = shift;
      >
      > return sub {
      > print $start++, "\n";
      > };
      > }
      >
      > # this creates a closure and assigns it to $next
      > my $next = iterator(100);
      >
      > # this executes the closure 5 times
      > $next->() for (1..5);
      >
      > The output will be:
      >
      > 100
      > 101
      > 102
      > 103
      > 104
      >
      > Notice that $next remembers what $start is even though
      > $start is in a different lexical scope.
      >
      > * recursion
      > - All loops can be expressed recursively. Although it's
      > possible to implement loops in an imperative fashion,
      > it is more in the spirit of Scheme to use recursion.
      > To analyze a lot of Scheme code, you will have to be
      > able to think recursively, so be prepared.
      >
      > * list-oriented functions (like map)
      > - I actually like using map in Perl. In Scheme, the
      > equivalent is mapcar. Once you become good at using
      > these functions for list iteration, they'll become fun
      > to use.
      >
      > # Perl
      > @doubled = map { $_ * 2 } (1 2 3 4);
      >
      > # Scheme
      > (set! doubled (mapcar (lambda (x) (* x 2)) '(1 2 3 4)))
      >
      > Both @doubled and doubled will contain (2 4 6 8).
      > Does that make sense? Can you see the parallels?
      >
      >
      > Good luck w/ Scheme and Vim.
      >
      >
      >
      >
      > [0] This post made me do a little research, and I found out a
      > few nice things about vim.
      >
      > :set showmatch
      > (this will show you matching parentheses as you type)
      >
      > :set lisp
      > (this will indent things the lisp way)
      > (I think you also need :set autoindent for this to work)
      >
      > Also, bounce on the "%" key in command mode to move between
      > matching parentheses. It's fun.
      >
      > Well, shit... I think I've atoned for my sins now. I
      > have found a way to use vim (and not emacs) to write my Scheme.
      >
      > --
      > package wuv'apqvjgt;($_=join('',(*PgtnHcemgt))) # print map "beppu\@$_\n", qw(
      > =~ s/([HaP])(?!e)/ \U>$1/g;s/^.|:| (?=A)|>//g;y # cpan.org lbox.org binq.org
      > /c-z/a-u/;print"J$_\n";#$^%$^X@.^ <!-- japh --> # oss.lineo.com codepoet.org);

      --
      What an incredible smell you've discovered!
    Your message has been successfully submitted and would be delivered to recipients shortly.