William James
4/22/2016 9:03:00 PM
WJ wrote:
> Nathan Baum wrote:
>
> > Then suppose you later need the loop/map to collect some of the values
> > under certain conditions. You might have
> >
> > (loop for x in (get-list)
> > for i from 0
> > do (format t "~A - ~A~%" i x)
> > if (test x)
> > collect (foo x))
>
> Gauche Scheme:
>
> (use srfi-42 :only (list-ec))
> (use srfi-13 :only (string-upcase))
>
> (list-ec (: x (index i) '("a" "of" "I" "it"))
> (begin (print i " - " x))
> (if (#/../ x))
> (string-upcase x))
>
> 0 - a
> 1 - of
> 2 - I
> 3 - it
> ("OF" "IT")
>
>
> MatzLisp (Ruby):
>
> %w(a of I it).each_with_index.map{|x,i|
> puts "#{i} - #{x}"
> x.match(/../) && x.upcase}.compact
>
> 0 - a
> 1 - of
> 2 - I
> 3 - it
> ==>["OF", "IT"]
>
>
> Another way:
>
> %w(a of I it).each_with_index.flat_map{|x,i|
> puts "#{i} - #{x}"
> x.match(/../) ? x.upcase : []}
>
>
> Another way:
>
> r=[]
> %w(a of I it).each_with_index{|x,i|
> puts "#{i} - #{x}"
> r<<x.upcase if x.match(/../)}
> r
OCaml:
["a"; "of"; "I"; "it"]
|> List.mapi (fun i s -> i,s)
|> List.fold_left
(fun acc (i,s) ->
Printf.printf "%d - %s\n" i s;
if String.length s = 2 then String.uppercase s :: acc else acc)
[] ;;
0 - a
1 - of
2 - I
3 - it
- : string list = ["IT"; "OF"]
--
"Anti-racism," Shamir writes, "is a denial of the autochthon's [native's] right
to decide his fate; a tool to separate Man from his native landscape. This
concept de-legitimizes objections to swamping a land with a flood of immigrants
and ruining the society's fabric."
www.theoccidentalobserver.net/authors/Connelly-Gaza2.html