eholk/harlan

Better string handling

eholk opened this issue · 4 comments

Right now Harlan programs can't do much more with strings than pass them around. Even just adding facilities to convert between C strings and vectors of chars would greatly improve the ability of Harlan programs to manipulate strings.

Cool... so how would I access the chars in a string in harlan?

There's a function, str->vec, which converts a string to a vector of characters. From there you can use vector-ref to access individual characters. For example:

(let ((v (str->vec "hello")))
  (vector-ref v 0))

That should return the character 'h'.

Cool.. will try that out when I get time.. I have twitter word analysis in mind.. but lets see how that can work.. :D

Sounds like fun!

I've been working on a PLY file loader lately which is forcing me to improve Harlan's string and IO facilities. Hopefully that will help you out too.