Feature #6242
closedRuby should support lists
Added by shugo (Shugo Maeda) over 12 years ago. Updated over 1 year ago.
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) over 12 years ago
- File list2.diff list2.diff added
Updated the patch to evaluate x ::: y' as
y.:::(x)', not `x.:::(y)'.
Updated by shugo (Shugo Maeda) over 12 years ago
- File list3.diff list3.diff added
Updated the patch to add methods: foldl, foldr, +, flatten/concat, map, flat_map/concat_map,
filter, length/size, sum, reverse.
Updated by drbrain (Eric Hodel) over 12 years ago
I have heard Ruby is a LISP too:
http://www.jwz.org/blog/2012/03/haters-gonna-hate-tail-call-optimization/#comment-103386
Updated by shugo (Shugo Maeda) over 12 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) over 12 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) over 12 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) over 12 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 over 12 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 over 12 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) over 12 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) over 12 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) over 12 years ago
- Status changed from Open to Rejected
April fools' day ended. Thanks.
--
Yusuke Endoh mame@tsg.ne.jp
Updated by jamesw (James Owen) about 12 years ago
even i guess so Ruby is a LISP
Updated by sumit (sumit ghosh) over 11 years ago
I doubt that ruby is LISP.
http://www.ifeel.edu.in
Updated by jasonsmith (jason smith) over 11 years ago
List processing is a draw back??
http://www.venkotech.com
Updated by rohansoni619 (Rohan Soni) over 11 years ago
- File jaro-1.jpg jaro-1.jpg added
I think ruby is a LISP.
http://www.jaro.in/international-MBA-1-year.html
Updated by huma10 (huma mustqeem) almost 7 years ago
jamesw (James Owen) wrote:
even i guess so Ruby is a LISP
Yes agree with you
https://leatherbaba.com/genuine-leather-motorcycle-jacket
Updated by jacketskingdom (Jackets Kingdom) over 1 year ago
i agree with you and see more about punk clothing.
https://jacketskingdom.com/collections/punk-leather-jacket