Why append shouldn't be called append

Post ideas & suggestions you have pertaining to the game here.
Post Reply

I hate the function named append because

Append dosen't work that way, other languages taught me so
1
11%
It sounds a lot like lnkAppend but works NOTHING like it
0
No votes
It concatanates lists and I didn't even know that
1
11%
I used it and my code didn't do what I wanted
1
11%
I actually like it this way
2
22%
Bananaphone
4
44%
 
Total votes: 9
User avatar
Star Weaver
Militia Commander
Militia Commander
Posts: 311
Joined: Sun Nov 07, 2010 10:20 pm
Location: . . . between the stars and the warm black sky . . .

I suggested calling it Join in http://wiki.neurohack.com/transcendence/trac/ticket/858 and now I'm remembering to get around to making a discussion thread thing about it.

So, um, discuss.
Image
Image
Image
User avatar
Aury
Fleet Admiral
Fleet Admiral
Posts: 5510
Joined: Tue Feb 05, 2008 1:10 am
Location: At the VSS Shipyards in the frontier, designing new ships.

As a C-family native programmer, I divide things into 'atomic & pseudo-atomic' and 'non-atomic' types. Atomic are things like ints, pointers, chars, etc. Pseudo-atomic things are Abstract Data Types (ADTs) and tend to be things like c-strings, etc. Non-atomic types are clearly non-atomic data structures like lists, templates, arrays, etc.

Links and Structs fall into the non-atomic group here, while the function name 'Append' suggests that it is meant to be used on atomic items, due to lack of a prefix. Maybe a clone with the prefix of lst for all list functions (ie, operating with lists). I've actually been pre-pending them with lnk in TAI so far, since I didn't realize that there was a distinction between functions operating with elements of the list and the lists themselves.
(shpOrder gPlayership 'barrelRoll)

<New tutorials, modding resources, and official extension stuff coming to this space soon!>
FourFire
Militia Captain
Militia Captain
Posts: 567
Joined: Sun Aug 12, 2012 5:56 pm

And I basically missed everything which Wolfy just said.
(move along, nothing to comprehend here!)
(func(Admin Response)= true){
if(admin func(amiable) = true)
Create func(Helpful Posts)
else func(Keep Calm and Post derisive topics)}
george moromisato
Developer
Developer
Posts: 2998
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

I agree that "append" is suboptimal, but I'm not sure "join" is better. In many languages "join" is used to concatenate a list of strings into a single string with a separator:

Code: Select all

(join (list "a" "b" "c") ",") -> "a,b,c"
p.s., the most common usage of append it to append an atom to a list:

Code: Select all

(append (list 'a 'b 'c) 'd) -> ('a 'b 'c 'd)
p.p.s., Lisp uses the word "append" the same way:

http://en.wikipedia.org/wiki/.append#Lisp

p.p.p.s., You can always alias it:

Code: Select all

(setq join append)
User avatar
Star Weaver
Militia Commander
Militia Commander
Posts: 311
Joined: Sun Nov 07, 2010 10:20 pm
Location: . . . between the stars and the warm black sky . . .

george moromisato wrote:

Code: Select all

(setq join append)
Hmm, I'd do this but wouldn't .......... oh, no it wouldn't. I was thinking it would introduce substantial call overhead but it's just a name rebinding :).

I don't think i've ever used append so no big there, I've just kinda been wanting to get it out of the headspace of people trying to learn the language ....

I need to finish that best practicices page and maybe start a 'stuff that will trip you up' page .... like default global data D:.
Image
Image
Image
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

I never had a problem with append
Get your own Galactic Omni Device
Get it now. It's free!!
Image
Vachtra
Militia Commander
Militia Commander
Posts: 308
Joined: Tue Feb 16, 2010 2:03 am
Location: Texas
Contact:

My first encounter with append was with making pdf files where append means to put at the end of, think of an appendis of a book.
This seems to do just that in that it puts things together in the order you put them in.

Seems fine to me. to say append "thingy" with "other thingy".

In my head at least join sounds like inheriting traits of a class rather than putting things together.
"Have you guys ever watched the show?" ~ Guy
Post Reply