0

When I do :

 (grid:subgrid #( 1 2 3 4) '(1) '(2))

, i get 3. But when I do:

(grid:subgrid #( 1 2 3 4) '(1) '(* 2 1))

,i get the following error:

#<TYPE-ERROR expected-type: LIST datum: 2>.

Does anyone have a hint?

Xaving
  • 329
  • 1
  • 11

2 Answers2

1

Apologies; not sure exactly where you're headed, and I don't know what the "grid" package is, so I couldn't test very much.

It looks like you're trying to determine grid coordinates on the fly with '(* 2 1) but it's not working. If that's what you are doing, you could maybe use a backquote comma construct...

(grid:subgrid #(1 2 3 4) '(1) `(,(* 2 1)))

subgrid seems to want args 2 and 3 (rest?) as lists with numbers for elements, and as originally provided, you were sending it the * symbol, which may explain why you were getting a type error.

brian_o
  • 462
  • 1
  • 6
  • 16
  • 1
    I don't like using backquote and comma where you really just want to list something. I prefer `(list (* 2 1))`. – Svante Feb 26 '15 at 23:49
  • Don't forget to try Svante's way, it's probably a better approach. I used backquotes because you were already using quotes. In any case, I'm glad it worked for you. – brian_o Feb 27 '15 at 16:07
0

If this is grid grid from Antik then subgrid parameters for the dimensions are lists

This is the manual. If you use slime just do M-. to look at the function.

Hope that helps

David Hodge
  • 269
  • 1
  • 7
  • Thank you. I didn't known the slime command. Do you know how to use the two others Parameter ( destination and drop) that appear in the help? – Xaving Feb 28 '15 at 20:33
  • @Xaving I have not used the destination parameter, but it appears that you can specify an existing grid for output. The drop parameter will remove dimensions of the subgrid that are 1, simplifying the object. – David Hodge Feb 28 '15 at 20:54
  • I try the destination parameter, and it woks as you say. The grid:slice function could return a foreign array. – Xaving Mar 02 '15 at 13:07