Couple of tips (I don't really have anything to add about the algorithm,
just pointing out stylistic things in case they help):

- In `col-of-n`, instead of `[ drop ] dip`, use `nip`.

- If [ p ] and [ q ] have stack effects ( x y z -- a ), then `3dup p [ q ]
dip` is just the same as `[ p ] [ q ] 3bi`.  So, instead of

  : different-row-different-col? ( size n m -- ? )
      3dup same-row? not [ same-col? not ] dip and ;

you could write

  : different-row-different-col? ( size n m -- ? )
      [ same-row? not ] [ same-col? not ] 3bi and ;

- Similarly, instead of

  : coeffs-minors ( matrix -- coeffs minors )
      dup coeffs
      swap minors ;

you could write

  : coeffs-minors ( matrix -- coeffs minors )
      [ coeffs ] [ minors ] bi ;

- If p has the stack effect ( x -- y ), then instead of `swap p swap` you
can write `[ p ] dip`.  So, instead of

  : matrix-filter-index ( matrix1 quot -- matrix2 )
      swap concat swap  ! ( flattened quot )
      filter-index'
      flat-to-matrix ; inline

you could write

  : matrix-filter-index ( matrix1 quot -- matrix2 )
      [ concat ] dip filter-index' flat-to-matrix ; inline

- You've got an extra `+` in `ij-to-n`:

  : ij-to-n ( size row col -- n )
      [ * ] dip + ! already adds the elements
      + ; ! stack effect error

- You've got an unmatched `]` in your tests.

Regards,
--Alex Vondrak
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to