parent
74faeb4320
commit
26b58a5c71
|
@ -50,7 +50,6 @@
|
||||||
;;; takes two sorted lists a and b and smashes their cdr fields to form a
|
;;; takes two sorted lists a and b and smashes their cdr fields to form a
|
||||||
;;; single sorted list including the elements of both.
|
;;; single sorted list including the elements of both.
|
||||||
;;; Note: this does _not_ accept vectors.
|
;;; Note: this does _not_ accept vectors.
|
||||||
|
|
||||||
(define (merge! a b less?)
|
(define (merge! a b less?)
|
||||||
(define (loop r a b)
|
(define (loop r a b)
|
||||||
(if (less? (car b) (car a))
|
(if (less? (car b) (car a))
|
||||||
|
@ -80,13 +79,11 @@
|
||||||
a)))
|
a)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;;; (sort! sequence less?)
|
;;; (sort! sequence less?)
|
||||||
;;; sorts the list or vector sequence destructively. It uses a version
|
;;; sorts the list or vector sequence destructively. It uses a version
|
||||||
;;; of merge-sort invented, to the best of my knowledge, by David H. D.
|
;;; of merge-sort invented, to the best of my knowledge, by David H. D.
|
||||||
;;; Warren, and first used in the DEC-10 Prolog system. R. A. O'Keefe
|
;;; Warren, and first used in the DEC-10 Prolog system. R. A. O'Keefe
|
||||||
;;; adapted it to work destructively in Scheme.
|
;;; adapted it to work destructively in Scheme.
|
||||||
|
|
||||||
(define (sort! seq less?)
|
(define (sort! seq less?)
|
||||||
(define (step n)
|
(define (step n)
|
||||||
(cond
|
(cond
|
||||||
|
|
|
@ -37,6 +37,19 @@ class SchemeCheckSyntax(method.Method):
|
||||||
else:
|
else:
|
||||||
app.data_buffer("*Scheme-Check-Syntax*", output)
|
app.data_buffer("*Scheme-Check-Syntax*", output)
|
||||||
|
|
||||||
|
class GuileStart(method.shell.Interact):
|
||||||
|
args = []
|
||||||
|
def _execute(self, w, **vargs):
|
||||||
|
method.shell.Interact._execute(self, w, bname='*Guile*', cmd='guile')
|
||||||
|
|
||||||
|
class GuileLoadFile(method.shell.Interact):
|
||||||
|
args = []
|
||||||
|
def _execute(self, w, **vargs):
|
||||||
|
method.shell.Interact._execute(self, w, bname='*Guile*', cmd='guile')
|
||||||
|
b = w.application.get_buffer_by_name('*Guile*')
|
||||||
|
path = os.path.realpath(w.buffer.path)
|
||||||
|
b.pipe_write('(load "%s")\n' % path)
|
||||||
|
|
||||||
class Scheme(mode.Fundamental):
|
class Scheme(mode.Fundamental):
|
||||||
modename = 'Scheme'
|
modename = 'Scheme'
|
||||||
extensions = ['.scm']
|
extensions = ['.scm']
|
||||||
|
@ -54,7 +67,7 @@ class Scheme(mode.Fundamental):
|
||||||
'scheme_boolean': ('magenta', 'default', 'bold'),
|
'scheme_boolean': ('magenta', 'default', 'bold'),
|
||||||
'scheme_number': ('default', 'default', 'bold'),
|
'scheme_number': ('default', 'default', 'bold'),
|
||||||
}
|
}
|
||||||
actions = [SchemeCheckSyntax]
|
actions = [SchemeCheckSyntax, GuileStart, GuileLoadFile]
|
||||||
_bindings = {
|
_bindings = {
|
||||||
'close-paren': (')',),
|
'close-paren': (')',),
|
||||||
'close-brace': ('}',),
|
'close-brace': ('}',),
|
||||||
|
|
Loading…
Reference in New Issue