From 3dff342ef56bd7afd53bd8b93268c921600dbab3 Mon Sep 17 00:00:00 2001 From: AJ Rossini Date: Tue, 23 Jun 2009 16:47:47 +0200 Subject: [PATCH] initial work towards getting xarray support into CLS. Signed-off-by: AJ Rossini --- lispstat.asd | 3 ++- src/data/dataframe-xarray.lisp | 44 ++++++++++++++++++++++++++++++++++++++++++ src/packages.lisp | 7 ++++++- 3 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 src/data/dataframe-xarray.lisp diff --git a/lispstat.asd b/lispstat.asd index b4cf851..d5eefa2 100644 --- a/lispstat.asd +++ b/lispstat.asd @@ -1,5 +1,5 @@ ;; -*- mode: lisp -*- -;;; Time-stamp: <2009-06-18 07:47:37 tony> +;;; Time-stamp: <2009-06-22 17:07:24 tony> ;;; Created: <2005-05-30 17:09:47 blindglobe> ;;; File: lispstat.asd ;;; Author: AJ Rossini @@ -114,6 +114,7 @@ ;; :cl-plplot ; FIXME: conditional load, tends to crash. :lisp-matrix :lift + :xarray :rsm-string) :components ((:static-file "version" :pathname #p"version.lisp-expr") (:static-file "LICENSE") diff --git a/src/data/dataframe-xarray.lisp b/src/data/dataframe-xarray.lisp new file mode 100644 index 0000000..c29eb08 --- /dev/null +++ b/src/data/dataframe-xarray.lisp @@ -0,0 +1,44 @@ +;;; -*- mode: lisp -*- + +;;; Time-stamp: <2009-06-23 08:02:51 tony> +;;; Creation: <2009-06-22 17:09:47 tony> +;;; File: dataframe-xarray.lisp +;;; Author: AJ Rossini +;;; Copyright: (c)2009--, AJ Rossini. BSD, LLGPL, or GPLv2, depending +;;; on how it arrives. +;;; Purpose: Integration of xarray tools with dataframe-like +;;; objects. + +;;; What is this talk of 'release'? Klingons do not make software +;;; 'releases'. Our software 'escapes', leaving a bloody trail of +;;; designers and quality assurance people in its wake. + +;;; Tamas Papp's xarray package is his 2nd generation generic array +;;; indexing package, coming after the ideas and thoughts behind his +;;; affi package, which while novel, is somewhat obsolete. + + +(defmethod xref ((obj data-frame-like) &rest indices) + (apply #'dfref obj indices)) + +(defmethod (setf xref) (value (object array) &rest subscripts) + (setf (apply #'dfref object subscripts) value)) + +(defmethod xref ((obj matrix-like) &rest indices)) + +(defmethod xtype ((obj dataframe-like))) + +(defmethod xdims ()) + +(defmethod xdims* ()) + +(defmethod xdim ((obj dataframe-like) index) + (dataframe-dimension index)) + +(defmethod xrank ()) + +(defmethod slice ()) + +(defmethod take ()) + + (defmethod carray ()) diff --git a/src/packages.lisp b/src/packages.lisp index 5dd44d9..cc80480 100644 --- a/src/packages.lisp +++ b/src/packages.lisp @@ -1,6 +1,6 @@ ;;; -*- mode: lisp -*- -;;; Time-stamp: <2009-06-18 07:53:42 tony> +;;; Time-stamp: <2009-06-23 07:52:13 tony> ;;; Creation: <2008-03-11 19:18:34 user> ;;; File: packages.lisp ;;; Author: AJ Rossini @@ -419,6 +419,9 @@ ;; lispstat-macros make-rv-function make-rv-function-1 + ;; xarray + xref xtype xdims xdim xdims* + ;; data open-file-dialog read-data-file read-data-columns load-data load-example *variables* *ask-on-redefine* @@ -433,6 +436,8 @@ dataset list-of-columns list-of-rows + + ;; listoflist lists-of-same-size equal-listoflist transpose-listoflist -- 2.11.4.GIT