Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Interesting that this fails, since removing one element was an example they considered. Maybe they should include the length of the lists as "magic numbers" which they then use to generate functions. For example, here they might generate the functions take_the_first_2 and remove_the_last_(4-2) as candidates.


The example they considered was removing the first element of the list, while that example is removing the last element.

In terms of computational cost, this makes sense: removing the last element of a list in lisp takes linear time with the size of the list, while removing the first element takes constant time. (If you're returning a copy this is moot, but if you're modifying in-place this could be a problem.)




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: