Project

General

Profile

Actions

Feature #6242

closed

Ruby should support lists

Added by shugo (Shugo Maeda) about 10 years ago. Updated over 4 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
[ruby-core:44036]

Description

I've heard that Ruby is a LISP.
LISP stands for "LISt Processing."
Hence, Ruby should support lists.

I've attached a patch to add the classes List and Cons, and the cons operator `:::'.

Example:

S[1,2,3].inject(:+)
=> 6
S[1,2,3]
=> S[1, 2, 3]
0 ::: S[1,2,3]
=> S[0, 1, 2, 3]
0 ::: 1 ::: 2 ::: 3 ::: nil
=> S[0, 1, 2, 3]
S[1,2,3].inject(:+)
=> 6


Files

list.diff (9.61 KB) list.diff shugo (Shugo Maeda), 04/01/2012 12:17 PM
list2.diff (9.61 KB) list2.diff shugo (Shugo Maeda), 04/01/2012 02:10 PM
list3.diff (14 KB) list3.diff shugo (Shugo Maeda), 04/01/2012 11:14 PM
noname (500 Bytes) noname Anonymous, 04/02/2012 10:59 AM
noname (500 Bytes) noname Anonymous, 04/02/2012 11:23 AM
jaro-1.jpg (12.3 KB) jaro-1.jpg rohansoni619 (Rohan Soni), 06/08/2013 02:20 PM

Updated by shugo (Shugo Maeda) about 10 years ago

Updated the patch to evaluate x ::: y' as y.:::(x)', not `x.:::(y)'.

Updated by shugo (Shugo Maeda) about 10 years ago

Updated the patch to add methods: foldl, foldr, +, flatten/concat, map, flat_map/concat_map,
filter, length/size, sum, reverse.

Updated by shugo (Shugo Maeda) about 10 years ago

drbrain (Eric Hodel) wrote:

I have heard Ruby is a LISP too:

http://www.jwz.org/blog/2012/03/haters-gonna-hate-tail-call-optimization/#comment-103386

Thanks for the information. I forgot to propose macros.

But the following comment reminded me that Ruby was originally Smalltalk, not a LISP.

http://www.jwz.org/blog/2012/03/haters-gonna-hate-tail-call-optimization/#comment-103406

I'm afraid this issue might be rejected.

Updated by xds2000 (deshi xiao) about 10 years ago

Hi,shugo
What benefits of the proposed lisp changed? I am very confuse this LISP list feature. your sample is very similar with native ruby Hash in my options.

Updated by drbrain (Eric Hodel) about 10 years ago

shugo (Shugo Maeda) wrote:

But the following comment reminded me that Ruby was originally Smalltalk, not a LISP.

http://www.jwz.org/blog/2012/03/haters-gonna-hate-tail-call-optimization/#comment-103406

I'm afraid this issue might be rejected.

Maybe we should propose a free ":" after method names for keyword arguments in a separate issue, like:

open: "file.txt", mode: "r+", encoding: Encoding::UTF_8 do |io|
# …
end

Then we can have the best of LISP and Smalltalk

Updated by shugo (Shugo Maeda) about 10 years ago

xds2000 (deshi xiao) wrote:

Hi,shugo
What benefits of the proposed lisp changed? I am very confuse this LISP list feature. your sample is very similar with native ruby Hash in my options.

  ∧,,∧
 (,,・∀・) You should say "Array", not "Hash"!
~(_u,uノ

Updated by Anonymous about 10 years ago

On Mon, Apr 02, 2012 at 09:14:30AM +0900, xds2000 (deshi xiao) wrote:

Issue #6242 has been updated by xds2000 (deshi xiao).

Hi,shugo
What benefits of the proposed lisp changed? I am very confuse this LISP list feature. your sample is very similar with native ruby Hash in my options.

Hi, this is a joke ticket for April fool's day. Don't take it too
seriously! :-)

https://img.skitch.com/20120402-bt88qqb8jitx92kqyuq4yh4rdx.jpg

--
Aaron Patterson
http://tenderlovemaking.com/

Updated by Anonymous about 10 years ago

On Mon, Apr 02, 2012 at 10:56:47AM +0900, shugo (Shugo Maeda) wrote:

Issue #6242 has been updated by shugo (Shugo Maeda).

xds2000 (deshi xiao) wrote:

Hi,shugo
What benefits of the proposed lisp changed? I am very confuse this LISP list feature. your sample is very similar with native ruby Hash in my options.

  ∧,,∧
 (,,・∀・) You should say "Array", not "Hash"!
~(_u,uノ

(ノಠ益ಠ)ノ彡┻━┻

--
Aaron Patterson
http://tenderlovemaking.com/

Updated by spatulasnout (B Kelly) about 10 years ago

shugo (Shugo Maeda) wrote:

But the following comment reminded me that Ruby was originally Smalltalk, not a LISP.

http://www.jwz.org/blog/2012/03/haters-gonna-hate-tail-call-optimization/#comment-103406

I used to think so too, until I saw this:

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/336646

Clearly Ruby has been a stealth-Lisp all along.

:)

Updated by jballanc (Joshua Ballanco) about 10 years ago

On Sunday, April 1, 2012 at 10:40 PM, Bill Kelly wrote:

shugo (Shugo Maeda) wrote:

But the following comment reminded me that Ruby was originally Smalltalk, not a LISP.

http://www.jwz.org/blog/2012/03/haters-gonna-hate-tail-call-optimization/#comment-103406

I used to think so too, until I saw this:

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/336646

Clearly Ruby has been a stealth-Lisp all along.

Ah! Our old friend Pascal… I remember him well. I ran across him not to long ago. Seems he's moved on to Lua now: http://article.gmane.org/gmane.comp.lang.lua.general/81364/match=

:)

Updated by mame (Yusuke Endoh) about 10 years ago

  • Status changed from Open to Rejected

April fools' day ended. Thanks.

--
Yusuke Endoh

Actions #14

Updated by sumit (sumit ghosh) about 9 years ago

I doubt that ruby is LISP.
http://www.ifeel.edu.in

Updated by jasonsmith (jason smith) about 9 years ago

List processing is a draw back??
http://www.venkotech.com

Actions

Also available in: Atom PDF