Skip to content
This repository has been archived by the owner on Dec 29, 2018. It is now read-only.

Support matching of multi-dimensional arrays #59

Open
fare opened this issue Nov 3, 2012 · 4 comments
Open

Support matching of multi-dimensional arrays #59

fare opened this issue Nov 3, 2012 · 4 comments
Assignees
Milestone

Comments

@fare
Copy link

fare commented Nov 3, 2012

To supersede cl-match, we need to be able to match arrays of arbitrary dimensions.

e.g. an array of rank 3:

(array 3 (((1 2) (3 4)) ((5 6) (6 8))))

same array using explicit dimensions:

(array (2 2 2) (((1 2) (3 4)) ((5 6) (6 8))))

same array using an array as a pattern:

(array #3(((1 2) (3 4)) ((5 6) (6 8))))

Oh, what about checking the specialized array type? Makes things even worse.

(array 2 double-float ((a b) (c d)))
@ghost ghost assigned m2ym Nov 9, 2012
@guicho271828
Copy link
Contributor

I have the similar idea.

It would be better if the matcher gives the somewhat similar interface to the constructor.

  • all options to make-array except :initial-contents
  • e.g.) type declaration should be specified by :element-type. :adjustable, :fill-pointer and so on

and I am thinking about this:

(array (5 5)
       ((_ _ _ _ _)
        ___________
        a-row
        ___________
        (a _____ b)))
  • a-row is an displaced array
  • in order to get the better graphical representation in the source code,
    symbols made of any number of underscores have the same effect as _
(array (101 101)
       ((_ (column 99) _)
        (column 49)
        a
        (column 49)
        (_ _ _ _ _)))
  • ability to specify a numbers of ignored columns, rows.
  • should the number accept a execute-time value?

@guicho271828
Copy link
Contributor

if it doesn't accept an execute-time value, something like 49 might be a choice.

@guicho271828
Copy link
Contributor

__49__

@guicho271828
Copy link
Contributor

This is addressed in Trivia, in combination with inline patterns.
https://github.com/guicho271828/trivia/blob/master/level2/arrays.lisp

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants