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: 5421
Joined: Tue Feb 05, 2008 1:10 am
Location: Somewhere in the Frontier on a Hycrotan station, working on 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)
(plySetGenome gPlayer (list 'Varalyn 'nonBinary))
Homelab Servers: Xeon Silver 4110, 16GB | Via Quadcore C4650, 16GB | Athlon 200GE, 8GB | i7 7800X, 32GB | Threadripper 1950X, 32GB | Atom x5 8350, 4GB | Opteron 8174, 16GB | Xeon E5 2620 v3, 8GB | 2x Xeon Silver 4116, 96GB, 2x 1080ti | i7 8700, 32GB, 6500XT
Workstations & Render machines: Threadripper 3990X, 128GB, 6900XT | Threadripper 2990WX, 32GB, 1080ti | Xeon Platinum 8173M, 48GB, 1070ti | R9 3900X, 16GB, Vega64 | 2x E5 2430L v2, 24GB, 970 | R7 3700X, 32GB, A6000
Gaming Systems: R9 5950X, 32GB, 6700XT
Office Systems: Xeon 5318Y, 256GB, A4000
Misc Systems: R5 3500U, 20GB | R5 2400G, 16GB | i5 7640X, 16GB, Vega56 | E5 2620, 8GB, R5 260 | P4 1.8ghz, 0.75GB, Voodoo 5 5500 | Athlon 64 x2 4400+, 1.5GB, FX 5800 Ultra | Pentium D 3.2ghz, 4GB, 7600gt | Celeron g460, 8GB, 730gt | 2x Athlon FX 74, 8GB, 8800gts 512 | FX 9590, 16GB, R9 295x2 | E350, 8GB | Phenom X4 2.6ghz, 16GB, 8800gt | random core2 duo/atom/i5/i7 laptops
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: 2997
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: 307
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