Arc Forumnew | comments | leaders | submitlogin
2 points by rocketnia 4728 days ago | link | parent

"In fact, in Arubic I plan for strings to just be a special subtype of conses, so you can use car and cdr on strings, and all operators that expect conses should work on strings as well."

Can you set the car of a string to an arbitrary value, like you can with a cons? Is "" nil?

I'm not trying to change your mind, but "all strings are conses" is the kind of thing lots of people think would be nifty only to change their own minds later. :)



1 point by Pauan 4728 days ago | link

"Can you set the car of a string to an arbitrary value, like you can with a cons? Is "" nil?"

Yes and yes. I plan for the only difference between strings and conses is that A) they have a type of 'string, in addition to a type of 'cons, and B) they display differently, surrounded by "" rather than ()

Generally speaking, strings will only contain characters (since that's what the string constructor does), but I don't see why they can't contain arbitrary stuff, if you want to do that.

P.S. I might not actually give them a type of string... in that case the only difference would be that they display differently. That might be an interesting approach.

-----

1 point by rocketnia 4728 days ago | link

Okay, sounds fine to me. ^_^

-----

1 point by Pauan 4728 days ago | link

Actually, you probably didn't notice, but in Arubic/Python, strings literally are a subclass of cons, so they really do behave just like conses in almost every situation. I didn't make (is nil "") return t though. That shouldn't be hard to add, but I've been busy on Arubic/ar.

-----