Jump to content

Fascinating LISP Irregularities...


Lee Mac

Recommended Posts

Hi Guys,

 

Hope everyone is having a nice Christmas so far.

 

Was just playing around with some LISP, and wondered why there was an irregularity in the way the LISP functions are named, for example:

itoa
--->>
i
-
to
-
a
--->>
integer
to
string

 

atoi
--->>
a
-
to
-
i
--->>
string
to
integer

 

This would seem to imply that:

 

i = integer
(obvious enough)

a = string
(not so obvious, but OK...)

 

It follows:

 

atof
--->>
a
-
to
-
f
--->>
string
to
real

 

This is also logical, as we have already assumed:

 

a = string

 

Now we would assume:

 

f = real
(again, not so obvious, but what the heck...
:P
)

 

So, why is it that, when we get to "Real to String" we have:

 

rtos
---
>>
r
-
to
-
s
--->>
real
to
string

 

This seem pretty irregular, so I though I'd have a discussion about it, and maybe there are other irregularities that others have found and want to discuss.

Link to comment
Share on other sites

Lee,

 

Most used to think that the a is to mean ASCII

 

atoi ASCII to integer

atof ASCII to float

 

itoa integer to ASCII

 

 

They relate to the (ascii) and (float) calls in AutoLISP. -David

Link to comment
Share on other sites

Lee,

 

Most used to think that the a is to mean ASCII

 

atoi ASCII to integer

atof ASCII to float

 

itoa integer to ASCII

 

 

They relate to the (ascii) and (float) calls in AutoLISP. -David

 

Ahhhh, good point, this would make sense. :P Thanks for clarifying that.

 

But in that case, why use rtos and not something like: ftoa

Link to comment
Share on other sites

Lee,

 

Probably due to the terms REAL vs INT as used to store values in 'puter languages.

 

(float) converts 'INTs into 'REALs

 

-David

Link to comment
Share on other sites

Another conspicuous irregularity is with polylines. The word “Polyline” can identify, or excluded, any of the three poly types, L(ight)W(eight)Polyline, 2DPolyline, 3DPolyline depending on the context – Lisp, VBA, Quick Select, DXF Reference and Filter Command.

 

The Filter command (which utilizes the DXF Reference - so behave similarly) also includes Polygon Mesh and PolyFace Mesh under the “Polyline” designation. Keeps us on our toes, I guess.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...