Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #54379

.re: lisp newbie here

From "Robert L." <No_spamming@noWhere_7073.org>
Newsgroups comp.lang.forth
Subject .re: lisp newbie here
Date 2017-01-25 07:25 +0000
Organization Aioe.org NNTP Server
Message-ID <o69jtc$jlo$1@gioia.aioe.org> (permalink)

Show all headers | View raw


Rob Warnock wrote:

>     > (loop for ((a . b) (c . d)) on '((1 . 2) (3 . 4) (5 . 6) (7 . 8)) 
>                                   by #'cddr 
>         collect (list d c b a)) 
> 
>     ((4 3 2 1) (8 7 6 5))

Ruby:

[[1, 2],[3, 4],[5, 6],[7, 8]].each_slice(2).map{|xs| xs.flatten.reverse}
 ===>
[[4, 3, 2, 1], [8, 7, 6, 5]]

[[1, 2],[3, 4],[5, 6],[7, 8]].each_slice(2).map{|((a,b),(c,d))|
  [a,c,b,d]}
 ===>
[[1, 3, 2, 4], [5, 7, 6, 8]]

In Forth?


-- 
When the Israeli bombers and torpedo-planes were sent to attack and destroy the
ship, the Jewish commander, seeing that it was an American vessel, had
misgivings and reported to the High Command, which simply repeated the orders
to attack and sink the Liberty. www.revilo-oliver.com/rpo/Bit_of_Good_News.html

Back to comp.lang.forth | Previous | Next | Find similar | Unroll thread


Thread

.re: lisp newbie here "Robert L." <No_spamming@noWhere_7073.org> - 2017-01-25 07:25 +0000

csiph-web