[REBOL] Re: Linguistic influences
From: lmecir:mbox:vol:cz at: 11-May-2002 23:37
Hi Joel,
interesting thoughts. Nevertheless, both your functions look unnatural to
me. I think, that the readability isn't optimal. If I had to do the job, I
would try to use a simpler algorithm. BTW, what do you want to get in a case
like: insflatten [a/b c/d [1] [[2] [[3]]]]?
As a human, I would prefer to use a FLAT-APPEND instead:
flat-append: func [
series [series! port!]
value [any-type!]
] [
either block? get/any 'value [
if not empty? value [
flat-append :series first value
flat-append :series next value
]
] [
insert/only tail :series get/any 'value
]
:series
]
czech-flatten: func [b [block!]] [flat-append copy [] b]
; and the usage:
czech-flatten [a/b c/d [1] [[2] [[3]]]] ; == [a/b c/d 1 2 3]
-L
----- Original Message -----
From: "Joel Neely" <[joel--neely--fedex--com]>
To: <[rebol-list--rebol--com]>
Sent: Saturday, May 11, 2002 4:29 PM
Subject: [REBOL] Linguistic influences
Hi, all,
The discussion stimulated by Tim's question on internal dots
reminded me of a question (about REBOL and other things as
well) that I've pondered over the years. Since this list has
a very eclectic, erudite, international population, perhaps
someone can shed some light for me.
Please consider the following paragraphs:
Paragraph 1
-----------
From my decades-ago one year of college German, it seemed
that one deeply nested with many subordinate qualifiers,
subtle variations in meaning to express, (at least in
literary style) sentences can construct. This style a
certain degree of mental discipline and attention span
(and perhaps a deep "mental stack") to understand requires.
Paragraph 2
-----------
American English is different. We move quickly through an
MTV, evening-news-sound-bite world. Brevity is the soul
of wit. Don't make me think. Just spit it out.
Hemingway was brilliant.
I'd be happy to have some of our German-speaking friends (and
perhaps others not hampered by English as a native language)
to comment on whether Paragraph 1 is a plausible word-order
construction for German, or whether it is just a bad parody
concocted of too many elapsed years and too little understanding.
What does this have to do with REBOL??? Please consider the
following function definitions:
insflatten: func [b [block!] /local front] [
either empty? b [
copy []
][
head insert insflatten next b either block? front: first b [
insflatten front
][
front
]
]
]
flattenins: func [b [block!] /local result front] [
either empty? b [
result: copy []
][
front: first b
result: insflatten next b
either block? front [
insert result insflatten front
][
insert result front
]
]
result
]
Both of these functions return a "flattened" block containing all
of the data from an arbitrarily-nested argument block, without
destroying the structure of the argument itself, as in:
>> foo: [[[0 1] 2 [[3] 4] 5] [[6]]]
== [[[0 1] 2 [[3] 4] 5] [[6]]]
>> insflatten foo
== [0 1 2 3 4 5 6]
>> flattenins foo
== [0 1 2 3 4 5 6]
>> foo
== [[[0 1] 2 [[3] 4] 5] [[6]]]
It seems to me that INSFLATTEN is stylistically analogous to
Paragraph 1 as FLATTENINS is to Paragraph 2. The first (in
each case) uses a nested thought structure, while the second
is more choppy and uses simpler structures.
Here, then is my pondering...
What is the extent to which a person's native (or habitual)
language influences that person's mental habits? Do those
influences then emerge in other kinds of behavior, such as
programming style?
If my recollection of German literary style is not too flawed,
would a literarily-oriented German speaker be more comfortable
(or more quickly comfortable) with a nested, structured style
illustrated by INSFLATTEN than an equally-trained American?
Would a "child of the boob tube" be more likely to prefer (or
understand...) the style of FLATTENINS than someone more
accustomed to thought -ful/-provoking literature?
-jn-
--
; Joel Neely joeldotneelyatfedexdotcom
REBOL [] do [ do func [s] [ foreach [a b] s [prin b] ] sort/skip
do function [s] [t] [ t: "" foreach [a b] s [repend t [b a]] t ] {
| e s m!zauafBpcvekexEohthjJakwLrngohOqrlryRnsctdtiub} 2 ]