Arc Forumnew | comments | leaders | submitlogin
1 point by akkartik 4823 days ago | link | parent

Makes sense, thanks for the map example.

I think I was confused because intersperse doesn't seem like a short name to me :) But of course you mean 'prime namespace real estate', which is partly about length but also about being an english word and so easier to remember.[1]

intersperse still seems weirder than map, because map just returns the type of its args, while intersperse is checking the type of elements inside its list arg.

[1] This made me also focus on the fact that testify is actually an english word - and arc is misusing it.



2 points by rocketnia 4823 days ago | link

intersperse still seems weirder than map , because map just returns the type of its args, while intersperse is checking the type of elements inside its list arg.

Yeah, that's one reason I'm not sure I agree with this proposal. Fundamentally, I don't like the idea that (intersperse x (list a b c)) would return (list a x b x c) sometimes and (+ a x b x c) others.

If "string:intersperse" is common enough to be a standalone utility with a shorter name, I'd probably name it after PHP's implode(). I'd probably make it use '+ too, so that it could be used to construct lists and custom types of sequence:

  (def implode (first between seq)
    (apply + first (intersperse between seq)))
  
  (implode "?" '& ...)
  (implode "" "\n" ...)
Using '+ instead of hardcoding 'string makes less sense if you have '+ dispatch on the type of the last argument. But hey, I'm a fan of dispatching on the first arg anyway. ;)

This made me also focus on the fact that testify is actually an english word - and arc is misusing it.

How about 'checkify? ^_^ I don't actually mind word misuse, but I do kinda like the idea of reserving the term "test" for unit tests, and I suppose there are even contexts where 'testify could be used for its English meaning:

  - assertions
  - debugger interaction
  - proofs
  - simulations of belief, knowledge, perception, persuasion, etc.
  - generally, status reports, contracts, and sanity checks registered
      with some surrounding framework or compiler

-----

1 point by akkartik 4822 days ago | link

Oh I like implode, thanks. Especially if it's used in this sense in another language, that makes it closer to 'prime real estate'.

-----