lisp
17 years agobase: compile-time-defun should define in the interpreter.
Mark Wooding [Thu, 1 Jun 2006 16:00:19 +0000 (17:00 +0100)]
base: compile-time-defun should define in the interpreter.

17 years agoMerge branch 'master' of git+ssh://metalzone.distorted.org.uk/~mdw/public-git/lisp
Mark Wooding [Thu, 1 Jun 2006 15:51:09 +0000 (16:51 +0100)]
Merge branch 'master' of git+ssh://metalzone.distorted.org.uk/~mdw/public-git/lisp

* 'master' of git+ssh://metalzone.distorted.org.uk/~mdw/public-git/lisp:
  sys-base: Portability fixes again.
  Porting stuff.

17 years agocollect: New functions collect-append and collect-nconc.
Mark Wooding [Thu, 1 Jun 2006 15:26:31 +0000 (16:26 +0100)]
collect: New functions collect-append and collect-nconc.

17 years agosys-base: Portability fixes again.
Mark Wooding [Wed, 24 May 2006 17:50:26 +0000 (18:50 +0100)]
sys-base: Portability fixes again.

  * Make sure *command-line-strings* is bound to something sane, even if
    runlisp isn't doing its thing.

  * As a result, use *lisp-interpreter* to decide whether runlisp is
    actually present.

17 years agoPorting stuff.
Mark Wooding [Wed, 24 May 2006 16:39:51 +0000 (17:39 +0100)]
Porting stuff.

  * Change to use new runlisp system (rather than the bizarre hackery of
    the same name which we had previously).

  * Support ECL, as much as is sensible.

17 years agoMerge branch 'master' of /home/mdw/public-git/lisp
Mark Wooding [Wed, 24 May 2006 08:12:14 +0000 (09:12 +0100)]
Merge branch 'master' of /home/mdw/public-git/lisp

* 'master' of /home/mdw/public-git/lisp:
  optparse: Process docstring and declarations correctly in defopthandler.
  gitignore: Ignore CLisp FASL files.
  Various: Try porting the code to CLisp.

Conflicts:

mdw-mop.lisp: Trivial conflict in the defpackage stanza.

17 years agooptparse: Process docstring and declarations correctly in defopthandler.
Mark Wooding [Wed, 24 May 2006 08:12:17 +0000 (09:12 +0100)]
optparse: Process docstring and declarations correctly in defopthandler.

Previously, the docstring got left inside the with-locatives form, which
is a shame.

17 years agogitignore: Ignore CLisp FASL files.
Mark Wooding [Wed, 24 May 2006 08:09:04 +0000 (09:09 +0100)]
gitignore: Ignore CLisp FASL files.

17 years agoVarious: Try porting the code to CLisp.
Mark Wooding [Wed, 24 May 2006 08:07:35 +0000 (09:07 +0100)]
Various: Try porting the code to CLisp.

Not entirely successful, largely because the CLisp pretty-printer seems
quite badly broken.

17 years agomop: New macro with-slot-variables.
Mark Wooding [Thu, 18 May 2006 08:43:29 +0000 (09:43 +0100)]
mop: New macro with-slot-variables.

The docstring describes it pretty well: the idea is to cache slots in
correctly-typed lexical variables and then write them back after
processing the body forms.

17 years agomop: Rearrange a bit.
Mark Wooding [Thu, 18 May 2006 08:41:29 +0000 (09:41 +0100)]
mop: Rearrange a bit.

Put the miscellaneous stuff before the metaclass hacking.

17 years agoMerge branch 'master' of git+ssh://metalzone.distorted.org.uk/~mdw/public-git/lisp
Mark Wooding [Wed, 17 May 2006 19:25:30 +0000 (20:25 +0100)]
Merge branch 'master' of git+ssh://metalzone.distorted.org.uk/~mdw/public-git/lisp

* 'master' of git+ssh://metalzone.distorted.org.uk/~mdw/public-git/lisp:
  asdf: Provide more package information and dependencies.
  sys-base: Only use the extensions package from CMUCL.
  base: Export unsigned-fixnum as a handy type to have.
  mop: Use CMUCL's `mop' package instead of `pcl'.
  base: New `until' macro does the obvious thing.

17 years agooptparse: Make enum opthandler take an evaluated list.
Mark Wooding [Wed, 17 May 2006 19:15:16 +0000 (20:15 +0100)]
optparse: Make enum opthandler take an evaluated list.

... rather than an unevaluated &rest argument.  This makes it rather
more suitable for dynamic lists of things.

17 years agoasdf: Provide more package information and dependencies.
Mark Wooding [Wed, 17 May 2006 18:56:27 +0000 (19:56 +0100)]
asdf: Provide more package information and dependencies.

17 years agosys-base: Only use the extensions package from CMUCL.
Mark Wooding [Wed, 17 May 2006 18:55:14 +0000 (19:55 +0100)]
sys-base: Only use the extensions package from CMUCL.

We'll have to do something special for other Lisp systems.

17 years agobase: Export unsigned-fixnum as a handy type to have.
Mark Wooding [Wed, 17 May 2006 18:48:05 +0000 (19:48 +0100)]
base: Export unsigned-fixnum as a handy type to have.

17 years agoMerge branch 'master' of git+ssh://guvnor.distorted.org.uk/~mdw/src/lisp
Mark Wooding [Wed, 17 May 2006 18:40:26 +0000 (19:40 +0100)]
Merge branch 'master' of git+ssh://guvnor.distorted.org.uk/~mdw/src/lisp

17 years agobase: New `until' macro does the obvious thing.
Mark Wooding [Wed, 17 May 2006 18:40:14 +0000 (19:40 +0100)]
base: New `until' macro does the obvious thing.

17 years agoinfix: Overhaul the readtable installer.
Mark Wooding [Sat, 13 May 2006 00:19:59 +0000 (01:19 +0100)]
infix: Overhaul the readtable installer.

Let it cope properly with different start and end characters (including
marking the end character as a terminating macro), and be willing to
install as a dispatching macro character if requested.  Also changed
the defaults to {...}, since these are explicitly reserved, and look
appropriate.

17 years agoinfix: Replace multiple-value constructs with a single bind.
Mark Wooding [Sat, 13 May 2006 00:13:52 +0000 (01:13 +0100)]
infix: Replace multiple-value constructs with a single bind.

This lets you do several layers of binding in one swoop, which is quite
shiny, really.  This covers multiple-value-bind and let (both the
single and multiple variable cases, if you're willing to use `values')
and multiple-value-setq is unnecessary since values is setf-able.

17 years agoinfix: Remove redundant progn in loop expander
Mark Wooding [Sat, 13 May 2006 00:08:53 +0000 (01:08 +0100)]
infix: Remove redundant progn in loop expander

17 years agoinfix: Make delim's requiredp argument optional rather than keyword.
Mark Wooding [Sat, 13 May 2006 00:07:43 +0000 (01:07 +0100)]
infix: Make delim's requiredp argument optional rather than keyword.

This makes the code rather less messy, I think.

17 years agomop: Use CMUCL's `mop' package instead of `pcl'.
Mark Wooding [Fri, 12 May 2006 09:37:43 +0000 (10:37 +0100)]
mop: Use CMUCL's `mop' package instead of `pcl'.

I must have gotten that name from an old source of information.

17 years agosafely: Temporary file name changes.
Mark Wooding [Thu, 11 May 2006 18:41:58 +0000 (19:41 +0100)]
safely: Temporary file name changes.

  * Use CL pathname magic to mess only with the name component of paths
    rather than putting extensions on the end, which seems to confuse
    CMU CL.

  * Use a Scsh-like fresh-name generator where it matters, rather than
    hoping (in the case of move-aside names).  This means generating old
    names later on in the process, but that seems OK.

  * Do the file copy in plain Lisp using read/write-sequence rather than
    Unix hacking.  There's a hack here for CMU CL to use link(2) for
    efficiency's sake, but it's not strictly necessary.

This means that the whole package is, in fact, standard Common Lisp.
Yay.

17 years agomop: New metaclass for singleton classes: ensures only one instance.
Mark Wooding [Thu, 11 May 2006 13:04:59 +0000 (14:04 +0100)]
mop: New metaclass for singleton classes: ensures only one instance.

17 years agoshow: Handle multiple values correctly.
Mark Wooding [Thu, 11 May 2006 13:04:54 +0000 (14:04 +0100)]
show: Handle multiple values correctly.

While we're at it, make sure the output is pretty-printed in an
attractive way, and print semicolons down the left hand side to protect
any weird characters which appear from messing up the REPL state.

17 years agomop: Handy function for making modified copies of instances.
Mark Wooding [Sun, 7 May 2006 17:34:47 +0000 (18:34 +0100)]
mop: Handy function for making modified copies of instances.

18 years agomop: In print-object-with-slots, use write for the slot values.
Mark Wooding [Mon, 1 May 2006 09:37:05 +0000 (10:37 +0100)]
mop: In print-object-with-slots, use write for the slot values.

Also print unbound slots as `#<unbound>'.  This is what the SLIME
inspector does and it makes sense.

18 years agomop: Use mdw.base, because it contains useful debugging stuff.
Mark Wooding [Mon, 1 May 2006 09:33:52 +0000 (10:33 +0100)]
mop: Use mdw.base, because it contains useful debugging stuff.

Not that there are any bugs which need fixing, of course.

18 years agomop: Remove &allow-other-keys from methods.
Mark Wooding [Sun, 30 Apr 2006 18:32:43 +0000 (19:32 +0100)]
mop: Remove &allow-other-keys from methods.

A more careful reading of the CLOS method congruence rules suggests that
these mess up the keyword validity checking.  Which is a shame.

18 years agocollect: Declare results as having type list.
Mark Wooding [Sun, 30 Apr 2006 14:37:53 +0000 (15:37 +0100)]
collect: Declare results as having type list.

It seems that CMU CL can't work this out on its own.  I suppose that's
not completely surprising.

18 years agobase: Provide fixnump function.
Mark Wooding [Sun, 30 Apr 2006 12:29:58 +0000 (13:29 +0100)]
base: Provide fixnump function.

CMU CL already implements fixnump in the extensions package  Provide it
explicitly here anyway, for other implementations.

Quite why this function isn't in the Common Lisp spec anyway is still a
mystery.

18 years agomop: Implement a class which automatically defines a predicate.
Mark Wooding [Sun, 30 Apr 2006 02:48:20 +0000 (03:48 +0100)]
mop: Implement a class which automatically defines a predicate.

I've found myself typing

  (defgeneric foop (thing)
    (:method (((thing foo)) t))
    (:method (((thing t)) nil)))

too many times.  Now I just put `(:predicate foop)' in the class
definition and forget about it.

18 years agomop: Don't pass filter functions the target object.
Mark Wooding [Sat, 29 Apr 2006 21:22:45 +0000 (22:22 +0100)]
mop: Don't pass filter functions the target object.

Firstly,  it's now what the docstring for `filtered-slot-class-mixin'
says, and it seems to be less useful.

18 years agoanaphora: Rename package to just `anaphora'.
Mark Wooding [Sat, 29 Apr 2006 20:47:30 +0000 (21:47 +0100)]
anaphora: Rename package to just `anaphora'.

I think that, for once, nothing else needs to be updated for this
renaming. ;-)

18 years agoparse-body: Allow docstring to be mixed in among the declarations.
Mark Wooding [Sat, 29 Apr 2006 17:09:49 +0000 (18:09 +0100)]
parse-body: Allow docstring to be mixed in among the declarations.

Ooops.  I've just re-read CLtL, and found that the top of most forms
allows the docstring to be mixed in among the declarations in any old
order, rather than docstring-first, declarations-after.  And I've also
just read Hyperspec 3.4.11, which explains that a final string isn't a
docstring, so handle that correctly too.

So rewrite the code to handle this case.  It means that macros will
probably reorder the forms in their output, but that's all right.

While we're here, glue all the declarations into a single `declare'
form, which makes it easier to put the declarations into some other kind
of form such as `declaim'.  And provide a keyword argument
:allow-docstring-p (defaulting true) to disallow docstrings.

18 years agoAdd some MOP hacking.
Mark Wooding [Thu, 27 Apr 2006 09:25:55 +0000 (10:25 +0100)]
Add some MOP hacking.

  * Abstract classes.

  * Filtered slots -- i.e., all slot writes can be passed through a
    canonifying filter.

18 years agocollect: Reduce consing.
Mark Wooding [Thu, 27 Apr 2006 10:57:40 +0000 (11:57 +0100)]
collect: Reduce consing.

The old collection system made a pair of cons cells: the metadata and a
random `head'.

        ,--------------------------.
        |                          |
  meta  |     head                 v  tail
  +---+-|-+   +---+---+          +---+---+
  | * | * |   |nil| *-----...--->|   |nil|
  +-|-+---+   +---+---+          +---+---+
    |           ^
    |           |
    `-----------'

But we can do better: we can squidge the head and metadata nodes
together.  If we start out at

      head tail
      +---+---+
  ,-->| * |nil|
  |   +-|-+---+
  |     |
  `-----'

we can just insert more items by updating (cdar head)...

  head                               tail
  +---+---+   +---+---+         +---+---+
  | * | *---->|   | *----...--->|   |nil|
  +-|-+---+   +---+---+         +---+---+
    |                             ^
    |                             |
    `-----------------------------'

18 years agobase, optparse: Various option-parsing enhancements.
Mark Wooding [Mon, 24 Apr 2006 14:30:23 +0000 (15:30 +0100)]
base, optparse: Various option-parsing enhancements.

  * `case2' clauses can optionally bind a variable to its scrutinee.

  * New function `option-parse-return' to return a value from
    `option-parse-next'.

  * Enhance `options' parse-option-form' to understand disambiguating
    keywords arguments for all option slots.  This also means that these
    things can be set from expressions rather than constants.

  * Default the `define-program' variables sensibly.

  * Make `do-options' use `let*/gensyms'.

  * Make the optparse test use the convenience macros.

  * Rename `help-opts' to `help-options'.  Just because.  And tidy up
    the code a bunch.

18 years agoReformat all the docstrings.
Mark Wooding [Sun, 23 Apr 2006 15:18:21 +0000 (16:18 +0100)]
Reformat all the docstrings.

Indent subsequent lines.  Makes the code look prettier, and makes diff
function headers more useful.

18 years agocollect: Oops, forgot to export `collect-tail'.
Mark Wooding [Sun, 23 Apr 2006 00:58:45 +0000 (01:58 +0100)]
collect: Oops, forgot to export `collect-tail'.

18 years agocollect: Whitespace rearrangement.
Mark Wooding [Sun, 23 Apr 2006 00:57:42 +0000 (01:57 +0100)]
collect: Whitespace rearrangement.

18 years agobase: New macro for parsing function bodies.
Mark Wooding [Sun, 23 Apr 2006 00:19:04 +0000 (01:19 +0100)]
base: New macro for parsing function bodies.

18 years agocollect, unix: Rename `mdw.collect' package to just `collect'.
Mark Wooding [Sat, 22 Apr 2006 23:59:07 +0000 (00:59 +0100)]
collect, unix: Rename `mdw.collect' package to just `collect'.

18 years agobase, optparse: Introduce `case2' macros.
Mark Wooding [Sat, 22 Apr 2006 23:58:11 +0000 (00:58 +0100)]
base, optparse: Introduce `case2' macros.

  * base: Add new `case2' macro, for fetching two values, switching on
    one and binding the other.  Also add `ecase2' to do the obvious
    thing.

  * optparse: Rewrite `do-options' to use `ecase2' (or `case2').

18 years agobase: Fix bug in `while'.
Mark Wooding [Sun, 23 Apr 2006 00:07:42 +0000 (01:07 +0100)]
base: Fix bug in `while'.

Did I ever use this?

18 years agobase: Reorder a bit.
Mark Wooding [Sun, 23 Apr 2006 00:02:28 +0000 (01:02 +0100)]
base: Reorder a bit.

Nothing significant actually changed.

18 years agobase: Export `nlet' and `while'.
Mark Wooding [Sun, 23 Apr 2006 00:00:59 +0000 (01:00 +0100)]
base: Export `nlet' and `while'.

Should have done this a while ago.

18 years agounix: Fix crap typo in header comment.
Mark Wooding [Thu, 20 Apr 2006 16:29:15 +0000 (17:29 +0100)]
unix: Fix crap typo in header comment.

18 years agooptparse: Various enhancements.
Mark Wooding [Thu, 20 Apr 2006 16:09:57 +0000 (17:09 +0100)]
optparse: Various enhancements.

  * General cleaning up.

  * Removal of redundant handling of option docstrings in both options
    macro and parse-option-form.

  * New feature: option macros can insert several options.

  * New suite of standard option-handling things for usual command-line
    programs.  Should be sufficient for most purposes.  I'll probably
    invent a subcommand system later when I get a feel for what's
    wanted.

18 years agoinfix: Reader macros for infix expressions.
Mark Wooding [Thu, 20 Apr 2006 14:00:08 +0000 (15:00 +0100)]
infix: Reader macros for infix expressions.

18 years agosafely, optparse: Rename packages.
Mark Wooding [Thu, 20 Apr 2006 13:50:43 +0000 (14:50 +0100)]
safely, optparse: Rename packages.

18 years agoGeneral tidying and prettifying.
Mark Wooding [Thu, 20 Apr 2006 11:03:09 +0000 (12:03 +0100)]
General tidying and prettifying.

18 years agoIgnore boring files.
Mark Wooding [Thu, 20 Apr 2006 11:01:07 +0000 (12:01 +0100)]
Ignore boring files.

18 years agomdw-base: Update-in-place macros.
Mark Wooding [Thu, 20 Apr 2006 11:00:25 +0000 (12:00 +0100)]
mdw-base: Update-in-place macros.

These are largely here because the infix reader stuff wants them, but
it's handy enough, probably.

18 years agooptparse: Use parse-integer in parse-c-integer.
Mark Wooding [Tue, 11 Apr 2006 17:49:13 +0000 (18:49 +0100)]
optparse: Use parse-integer in parse-c-integer.

CMU CL's parse-integer has cleverness for parsing bignums relatively
quickly.  It's not as scary as Catacomb, but not bad.  Use it instead of
the grotty hack we had previously.

18 years agosyscall: Don't require (function ...) for the name argument.
Mark Wooding [Tue, 11 Apr 2006 17:20:46 +0000 (18:20 +0100)]
syscall: Don't require (function ...) for the name argument.

In fact, don't allow it.

18 years agosafely: For -without-moaning functions, just do it and catch errors.
Mark Wooding [Tue, 11 Apr 2006 17:05:37 +0000 (18:05 +0100)]
safely: For -without-moaning functions, just do it and catch errors.

... rather than probing first and hoping for the best.

18 years agoKill the unix-try macro.
Mark Wooding [Tue, 11 Apr 2006 16:55:36 +0000 (17:55 +0100)]
Kill the unix-try macro.

Instead, export sys-* functions which do the right thing.  Fix safely to
match.

18 years agosafely: Blank lines make code easier to read.
Mark Wooding [Tue, 11 Apr 2006 17:06:28 +0000 (18:06 +0100)]
safely: Blank lines make code easier to read.

18 years agoMerge branch 'svn'
Mark Wooding [Mon, 13 Feb 2006 11:55:44 +0000 (11:55 +0000)]
Merge branch 'svn'

18 years agoanaphora: Add anaphoric macros.
mdw [Mon, 13 Feb 2006 11:54:57 +0000 (11:54 +0000)]
anaphora: Add anaphoric macros.

18 years agosys-base: Expand hard-exit a bit.
mdw [Mon, 13 Feb 2006 11:54:33 +0000 (11:54 +0000)]
sys-base: Expand hard-exit a bit.

18 years agobase: Implement named-let and while.
mdw [Mon, 13 Feb 2006 11:54:16 +0000 (11:54 +0000)]
base: Implement named-let and while.

18 years agoExtract Subversion ignore data.
Mark Wooding [Mon, 13 Feb 2006 11:52:27 +0000 (11:52 +0000)]
Extract Subversion ignore data.

18 years agoInitial checkin.
mdw [Thu, 25 Aug 2005 08:46:18 +0000 (08:46 +0000)]
Initial checkin.