Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

More data-processing

127 views
Skip to first unread message

WJ

unread,
Feb 8, 2016, 2:06:31 PM2/8/16
to
Oforth:

: parse |result|
wordsWith(':') dup
extract(1,1) asListBuffer -> result
last wordsWith(';') map(#[strip])
result addAll
result put(2, result at(2) words last)
result removeLast words first result add
result ;

"animal: we have cats; dogs; monkey and other animals"
"food: different types like rice; beans; potato and some other"
"car: we have mercedes; ford; opel; mazda plus other cars"
[,,]
apply(#[parse println])


[animal, cats, dogs, monkey]
[food, rice, beans, potato]
[car, mercedes, ford, opel, mazda]


--
The report card by the American Society of Civil Engineers showed the national
infrastructure a single grade above failure, a step from declining to the point
where everyday things simply stop working the way people expect them to. ---
washingtonpost.com/local/trafficandcommuting/us-infrastructure-gets-d-in-annual-report/2013/03/19/c48cb010-900b-11e2-9cfd-36d6c9b5d7ad_story.html

Chris Curl

unread,
Feb 8, 2016, 7:38:42 PM2/8/16
to
Well done, WJ! You are to be commended.

Yet ANOTHER stupid and pointless post of extremely trivial and
pointless programming. Any first year programming student can write
such a simple program.

Now let's see you write a program that takes a recorded OP report from
a surgeon, matches that report to an existing patient in the hospital,
extracts the procedure(s) performed, generates a list of ICD-10 codes
for the operation and sends them to Medicare for billing.

Then of course, you need to get the physician to review and sign the
report and send it to the document repository for archiving.

dunno

unread,
Feb 9, 2016, 2:07:51 PM2/9/16
to
WJ <w_a_...@yahoo.com> wrote:
> Oforth:
>
>> parse |result|
> wordsWith(':') dup
> extract(1,1) asListBuffer -> result
> last wordsWith(';') map(#[strip])
> result addAll
> result put(2, result at(2) words last)
> result removeLast words first result add
> result ;
>
> "animal: we have cats; dogs; monkey and other animals"
> "food: different types like rice; beans; potato and some other"
> "car: we have mercedes; ford; opel; mazda plus other cars"
> [,,]
> apply(#[parse println])
>
>
> [animal, cats, dogs, monkey]
> [food, rice, beans, potato]
> [car, mercedes, ford, opel, mazda]
>
>

Why it does not display "other animals", "some other", and "other cars"?

--
dunno

Rod Pemberton

unread,
Feb 9, 2016, 7:55:10 PM2/9/16
to
On Mon, 8 Feb 2016 16:38:40 -0800 (PST)
Chris Curl <ccur...@gmail.com> wrote:

> On Monday, February 8, 2016 at 2:06:31 PM UTC-5, WJ wrote:
> > Oforth:
> >
> > : parse |result|
>
> [...]
>
> Well done, WJ! You are to be commended.
>

Wait ... Did he just post some Forth? I'm stunned!

> Yet ANOTHER stupid and pointless post of extremely
> trivial and pointless programming [which any] first
> year programming student can write [...].

Give him a few months.

Then, maybe he can code all those Rosetta Code examples
for you guys.


Rod Pemberton

François

unread,
Feb 10, 2016, 5:32:59 AM2/10/16
to
Le mardi 9 février 2016 20:07:51 UTC+1, dunno a écrit :


> Why it does not display "other animals", "some other", and "other cars"?

I think : "result removeLast words first result add"
;)

WJ

unread,
Feb 14, 2016, 5:11:52 PM2/14/16
to
WJ wrote:

> Oforth:
>
> : parse |result|
> wordsWith(':') dup
> extract(1,1) asListBuffer -> result
> last wordsWith(';') map(#[strip])
> result addAll
> result put(2, result at(2) words last)
> result removeLast words first result add
> result ;
>
> "animal: we have cats; dogs; monkey and other animals"
> "food: different types like rice; beans; potato and some other"
> "car: we have mercedes; ford; opel; mazda plus other cars"
> [,,]
> apply(#[parse println])
>
>
> [animal, cats, dogs, monkey]
> [food, rice, beans, potato]
> [car, mercedes, ford, opel, mazda]

Ruby:

"
animal: we have cats, dogs, monkey and other animals
food: differet types like rice, beans, potato and some other
car: we have mercedes, ford, opel, mazda plus other cars

".strip.each_line{|line|
category, text = line.split(":")
types = text.split(/, */).
map.with_index{|str,i| str.split[i.zero? ? -1 : 0]}
p [category, *types]
}

===>
["animal", "cats", "dogs", "monkey"]
["food", "rice", "beans", "potato"]
["car", "mercedes", "ford", "opel", "mazda"]

--
In the United States in 2005, 37,460 white females were sexually assaulted or
raped by a black man, while between zero and ten black females were sexually
assaulted or raped by a white man. What this means is that every day in the
United States, over one hundred white women are raped or sexually assaulted by
a black man. -- http://archive.frontpagemag.com/readArticle.aspx?ARTID=26368
0 new messages