dash.el icon indicating copy to clipboard operation
dash.el copied to clipboard

Support for vectors?

Open Silex opened this issue 8 years ago • 6 comments

Hello,

(--each [1 2 3] (message "%s" it it))

Does not work. Is that intentional? Any plans on supporting it? For example, --map works.

Silex avatar Apr 18 '16 09:04 Silex

There's a task opened for that already somewhere. We wanted to do this but haven't found a good way to do it.

Fuco1 avatar Apr 18 '16 17:04 Fuco1

Can't you simply use --map for the implementation? No because performance issues?

Silex avatar Apr 19 '16 06:04 Silex

--map works because it uses mapcar. Some functions in dash which just do indirection for the sake of API will work, but most will not. You should rather not rely on that behaviour as we might change something wrt vectors and break your code.

There are options like generics to implement this but so far we haven't found it very convincing.

Fuco1 avatar Apr 19 '16 07:04 Fuco1

Alright... should I close this?

Silex avatar Apr 19 '16 08:04 Silex

Hm, the duplicate #43 is already closed. Maybe you could use seq too for when you need vectors.

I don't mind having this opened but we will probably not act upon this any time soon.

Fuco1 avatar Apr 19 '16 08:04 Fuco1

Alright, for the record, I'm currently working around this by passing the vector in dash as (-map 'identity myvector) and outputing it as (apply 'vector LIST).

Silex avatar Apr 19 '16 12:04 Silex