Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #53149 > unrolled thread
| Started by | Julian Fondren <julian.fondren@gmail.com> |
|---|---|
| First post | 2016-12-07 03:23 -0800 |
| Last post | 2016-12-21 23:00 -0800 |
| Articles | 20 on this page of 26 — 14 participants |
Back to article view | Back to comp.lang.forth
Object-Oriented Programming is Bad Julian Fondren <julian.fondren@gmail.com> - 2016-12-07 03:23 -0800
Re: Object-Oriented Programming is Bad Mark Wills <markwills1970@gmail.com> - 2016-12-07 09:06 -0800
Re: Object-Oriented Programming is Bad "HAA" <someone@microsoft.com> - 2016-12-09 11:03 +1100
Re: Object-Oriented Programming is Bad Alex <alex@rivadpm.com> - 2016-12-09 00:17 +0000
Re: Object-Oriented Programming is Bad "HAA" <someone@microsoft.com> - 2016-12-10 10:14 +1100
Re: Object-Oriented Programming is Bad hughaguilar96@gmail.com - 2016-12-09 19:54 -0800
Re: Object-Oriented Programming is Bad "Robert L." <No_spamming@noWhere_7073.org> - 2016-12-10 06:44 +0000
Re: Object-Oriented Programming is Bad Julian Fondren <julian.fondren@gmail.com> - 2016-12-10 00:37 -0800
Re: Object-Oriented Programming is Bad polymorph self <jackvanc3@gmail.com> - 2016-12-11 06:39 -0800
Re: Object-Oriented Programming is Bad Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-12-10 03:38 -0600
Re: Object-Oriented Programming is Bad november.nihal@gmail.com - 2016-12-11 08:57 -0800
Re: Object-Oriented Programming is Bad hughaguilar96@gmail.com - 2016-12-11 10:19 -0800
Re: Object-Oriented Programming is Bad Paul Rubin <no.email@nospam.invalid> - 2016-12-11 13:25 -0800
Re: Object-Oriented Programming is Bad hughaguilar96@gmail.com - 2016-12-11 17:39 -0800
Re: Object-Oriented Programming is Bad november.nihal@gmail.com - 2016-12-11 17:49 -0800
Re: Object-Oriented Programming is Bad hughaguilar96@gmail.com - 2016-12-11 20:31 -0800
Re: Object-Oriented Programming is Bad november.nihal@gmail.com - 2016-12-12 07:01 -0800
Re: Object-Oriented Programming is Bad Paul Rubin <no.email@nospam.invalid> - 2016-12-11 21:50 -0800
Re: Object-Oriented Programming is Bad polymorph self <jackvanc3@gmail.com> - 2016-12-11 06:20 -0800
Re: Object-Oriented Programming is Bad Paul Rubin <no.email@nospam.invalid> - 2016-12-07 09:26 -0800
Re: Object-Oriented Programming is Bad Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-12-07 11:44 -0600
Re: Object-Oriented Programming is Bad anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-12-08 09:58 +0000
Re: Object-Oriented Programming is Bad Bernd Paysan <bernd@net2o.de> - 2016-12-21 21:18 +0000
Re: Object-Oriented Programming is Bad gavinschuette@gmail.com - 2016-12-21 23:00 -0800
Re: Object-Oriented Programming is Bad franck.bensusan@gmail.com - 2016-12-21 09:41 -0800
Re: Object-Oriented Programming is Bad gavinschuette@gmail.com - 2016-12-21 23:00 -0800
Page 1 of 2 [1] 2 Next page →
| From | Julian Fondren <julian.fondren@gmail.com> |
|---|---|
| Date | 2016-12-07 03:23 -0800 |
| Subject | Object-Oriented Programming is Bad |
| Message-ID | <4ca00d44-3973-4ddc-8572-6616882b0252@googlegroups.com> |
Youtube vid: https://www.youtube.com/watch?v=QM1iUe6IofM Probably not that interesting for us, but I did note that the feature he wants at the end, which he doesn't think any existing language has, is actually what quotations are. Non-Hugh quotations: he explicitly doesn't want any of the outer function's environment to seep through into the inner function, except by argument passing. -- Julian
[toc] | [next] | [standalone]
| From | Mark Wills <markwills1970@gmail.com> |
|---|---|
| Date | 2016-12-07 09:06 -0800 |
| Message-ID | <412f1cc4-221e-4e6e-ad69-c615f8b84073@googlegroups.com> |
| In reply to | #53149 |
On Wednesday, 7 December 2016 11:23:21 UTC, Julian Fondren wrote: > Youtube vid: https://www.youtube.com/watch?v=QM1iUe6IofM > > Probably not that interesting for us, but I did note that the feature > he wants at the end, which he doesn't think any existing language has, > is actually what quotations are. Non-Hugh quotations: he explicitly > doesn't want any of the outer function's environment to seep through > into the inner function, except by argument passing. > > > -- Julian > he explicitly > doesn't want any of the outer function's environment to seep through > into the inner function, except by argument passing. We had them in the 70s. They were called SUBROUTINES :-)
[toc] | [prev] | [next] | [standalone]
| From | "HAA" <someone@microsoft.com> |
|---|---|
| Date | 2016-12-09 11:03 +1100 |
| Message-ID | <o2csc8$966$1@gioia.aioe.org> |
| In reply to | #53163 |
Mark Wills wrote: > On Wednesday, 7 December 2016 11:23:21 UTC, Julian Fondren wrote: > > Youtube vid: https://www.youtube.com/watch?v=QM1iUe6IofM > > > > Probably not that interesting for us, but I did note that the feature > > he wants at the end, which he doesn't think any existing language has, > > is actually what quotations are. Non-Hugh quotations: he explicitly > > doesn't want any of the outer function's environment to seep through > > into the inner function, except by argument passing. > > > > > > -- Julian > > > he explicitly > > doesn't want any of the outer function's environment to seep through > > into the inner function, except by argument passing. > > We had them in the 70s. They were called SUBROUTINES > > :-) Technically a "subroutine" is a reusable quantity. To be able to be called by *any* function, explicit argument passing is necessary. The idea behind quotations is that being 'local', you can dispense with some of the requirements of subroutines. If your parent has locals and your 'subroutine' is local, it stands to reason you should *not* have to go to the trouble and expense of explicitly passing arguments between them via the stack. There seems to be this notion quotations are just nameless subroutines. They don't have the capabilities of subroutines and never will.
[toc] | [prev] | [next] | [standalone]
| From | Alex <alex@rivadpm.com> |
|---|---|
| Date | 2016-12-09 00:17 +0000 |
| Message-ID | <o2ct3k$4ve$1@dont-email.me> |
| In reply to | #53210 |
On 12/9/2016 00:03, HAA wrote: > Mark Wills wrote: >> On Wednesday, 7 December 2016 11:23:21 UTC, Julian Fondren wrote: >>> Youtube vid: https://www.youtube.com/watch?v=QM1iUe6IofM >>> >>> Probably not that interesting for us, but I did note that the feature >>> he wants at the end, which he doesn't think any existing language has, >>> is actually what quotations are. Non-Hugh quotations: he explicitly >>> doesn't want any of the outer function's environment to seep through >>> into the inner function, except by argument passing. >>> >>> >>> -- Julian >> >>> he explicitly >>> doesn't want any of the outer function's environment to seep through >>> into the inner function, except by argument passing. >> >> We had them in the 70s. They were called SUBROUTINES >> >> :-) > > Technically a "subroutine" is a reusable quantity. To be able to be called by > *any* function, explicit argument passing is necessary. The idea behind > quotations is that being 'local', you can dispense with some of the requirements > of subroutines. If your parent has locals and your 'subroutine' is local, it stands > to reason you should *not* have to go to the trouble and expense of explicitly > passing arguments between them via the stack. Since a quotation has an existence outside of its parent, that's a bit of a strawman argument (if you'll excuse the pun). The execution time of a quotation is not necessarily inside the parent's "frame" of execution. > There seems to be this notion > quotations are just nameless subroutines. They don't have the capabilities of > subroutines and never will. What capabilities does a subroutine have that quotations don't? -- Alex
[toc] | [prev] | [next] | [standalone]
| From | "HAA" <someone@microsoft.com> |
|---|---|
| Date | 2016-12-10 10:14 +1100 |
| Message-ID | <o2fe03$2hi$2@gioia.aioe.org> |
| In reply to | #53211 |
Alex wrote: > On 12/9/2016 00:03, HAA wrote: > > ... > > Technically a "subroutine" is a reusable quantity. To be able to be called by > > *any* function, explicit argument passing is necessary. The idea behind > > quotations is that being 'local', you can dispense with some of the requirements > > of subroutines. If your parent has locals and your 'subroutine' is local, it stands > > to reason you should *not* have to go to the trouble and expense of explicitly > > passing arguments between them via the stack. > > Since a quotation has an existence outside of its parent, that's a bit > of a strawman argument (if you'll excuse the pun). The execution time of > a quotation is not necessarily inside the parent's "frame" of execution. I'm suggesting (as have others) namelessness is not enough. That if users of locals must engage in the same lengthy methods of communication currently required of them by subroutines, then quotations will be little more than eyecandy. > > There seems to be this notion > > quotations are just nameless subroutines. They don't have the capabilities of > > subroutines and never will. > > What capabilities does a subroutine have that quotations don't? Subroutines make a program manageable by isolating functionality into discrete re-usable objects. Quotations tend toward the opposite.
[toc] | [prev] | [next] | [standalone]
| From | hughaguilar96@gmail.com |
|---|---|
| Date | 2016-12-09 19:54 -0800 |
| Message-ID | <f0ac2bbc-389b-4918-b9cd-2066767805b5@googlegroups.com> |
| In reply to | #53236 |
On Friday, December 9, 2016 at 4:16:23 PM UTC-7, HAA wrote:
> Alex wrote:
> > On 12/9/2016 00:03, HAA wrote:
> > > ...
> > > Technically a "subroutine" is a reusable quantity. To be able to be called by
> > > *any* function, explicit argument passing is necessary. The idea behind
> > > quotations is that being 'local', you can dispense with some of the requirements
> > > of subroutines. If your parent has locals and your 'subroutine' is local, it stands
> > > to reason you should *not* have to go to the trouble and expense of explicitly
> > > passing arguments between them via the stack.
> >
> > Since a quotation has an existence outside of its parent, that's a bit
> > of a strawman argument (if you'll excuse the pun). The execution time of
> > a quotation is not necessarily inside the parent's "frame" of execution.
>
> I'm suggesting (as have others) namelessness is not enough. That if users of
> locals must engage in the same lengthy methods of communication currently
> required of them by subroutines, then quotations will be little more than eyecandy.
>
> > > There seems to be this notion
> > > quotations are just nameless subroutines. They don't have the capabilities of
> > > subroutines and never will.
> >
> > What capabilities does a subroutine have that quotations don't?
>
> Subroutines make a program manageable by isolating functionality into discrete
> re-usable objects. Quotations tend toward the opposite.
HAA knows what he is talking about. Subroutines and quotations have completely different uses.
This subject has already been discussed thoroughly:
https://groups.google.com/forum/#!topic/comp.lang.forth/ohE8mx7tWQU%5B1-25%5D
I really killed the subject with my rquotations --- what the "Committee of Can't" says is impossible, I accomplish with a few lines of code. :-D
-----------------------------------------------------------------------------------
VFX? SwiftForth? or [if]
\ My code ( VFX or SwiftForth only) requires that the HOF does have local variables.
: rexit ( -- ) rdrop ;
: (r:) ( -- r ) r@ 5 + ; \ 5 is the size of a JMP instruction in 32-bit x86
: r[ ( -- r ) postpone (r:) postpone ahead ; immediate
: ]r ( -- ) postpone rexit postpone then ; immediate
VFX? [if]
code rex ( r -- ) \ HumptyDumpty called this RCALL
push edi \ this is the HOF's LF which won't be used by the quotation
mov edi, 0 [edi] \ this is the parent's LF which will be used by the quotation
mov eax, ebx
mov ebx, 0 [ebp] lea ebp, w [ebp]
call eax
pop edi \ restore HOF's LF
next, end-code
[then]
SwiftForth? [if]
156 constant lf-offset \ this is the offset for the local-frame in the user-variables (ESI is the user-variable base)
code rex ( r -- ) \ HumptyDumpty called this RCALL
lf-offset [esi] edx mov
edx push \ this is the HOF's LF which won't be used by the quotation
-4 [edx] eax mov \ this is the old ESP
0 [eax] eax mov \ this is the parent's LF which will be used by the quotation
eax lf-offset [esi] mov
ebx eax mov [drop]
eax call
lf-offset [esi] pop \ restore HOF's LF
ret end-code
[then]
[else] \ this was written by HumptyDumpty and works on gForth, SwiftForth and VFX
: rexit ( -- ) RDROP ;
: (r:) ( -- r ) R@ 0 ;
: r[ ( -- r ) postpone (r:) postpone IF ; immediate
: ]r ( -- ) postpone REXIT postpone THEN ; immediate
: rex ( r -- ) >R -1 ; \ HumptyDumpty called this RCALL
\ HumptyDumpty's code requires that the HOF does not have local variables.
[then]
-----------------------------------------------------------------------------------
Here is some sample code using my rquotations:
-----------------------------------------------------------------------------------
marker hottie.4th
seq
w field .gender \ 'M' or 'F' \ if someone isn't one or the other, then he/she isn't a person
constant person
: init-person ( str node -- node )
init-seq >r
[char] M r@ .gender ! \ default is male
r> ;
: new-person ( str -- node )
person alloc
init-person ;
person
w field .hotness \ scale of 1 to 10
constant chick
: init-chick ( hotness str node -- node )
init-person >r
[char] F r@ .gender !
r@ .hotness !
r> ;
: new-chick ( hotness str -- node )
chick alloc
init-chick ;
: chick-counter ( head -- chicks )
0
swap r[ .gender @ [char] F = if 1+ then ]r |each ;
: macro-chick-counter ( head -- chicks )
0
swap each[ .gender @ [char] F = if 1+ then ]each ;
: test { head | people chicks tens nines eights -- }
head r[
1 +to people
dup .gender @ [char] F = if 1 +to chicks
.hotness @
dup 8 = if 1 +to eights then
dup 9 = if 1 +to nines then
10 = if 1 +to tens then \ Yay! We found at least one!
else drop then
]r |each
cr ." total people: " people .
cr ." total chicks: " chicks .
cr ." level 10 chicks: " tens .
cr ." level 9 chicks: " nines .
cr ." level 8 chicks: " eights .
;
[toc] | [prev] | [next] | [standalone]
| From | "Robert L." <No_spamming@noWhere_7073.org> |
|---|---|
| Date | 2016-12-10 06:44 +0000 |
| Message-ID | <o2g88h$utg$1@gioia.aioe.org> |
| In reply to | #53245 |
On 12/9/2016, hughaguilar96@gmail.com wrote:
> VFX? SwiftForth? or [if]
>
> \ My code ( VFX or SwiftForth only) requires
> that the HOF does have local variables.
>
> : rexit ( -- ) rdrop ;
> : (r:) ( -- r ) r@ 5 + ; \ 5 is the size of a
> JMP instruction in 32-bit x86
> : r[ ( -- r ) postpone (r:) postpone ahead ; immediate
> : ]r ( -- ) postpone rexit postpone then ; immediate
>
> VFX? [if]
>
> code rex ( r -- ) \ HumptyDumpty called this RCALL
> push edi \ this is the HOF's LF which won't be used
> by the quotation
> mov edi, 0 [edi] \ this is the parent's LF which will be used
> by the quotation
"quotation"?
Lambdas (a.k.a. anonymous functions) have been in use for decades
in languages superior to Forth.
Why did the Forth witlings feel that they had to conceive of a newer,
senseless name for the concept?
Forth witlings are the laughingstocks of the programming world.
> mov eax, ebx
> mov ebx, 0 [ebp] lea ebp, w [ebp]
> call eax
> pop edi \ restore HOF's LF
> next, end-code
Absolutely useless code.
Will not run on an ARM.
>
> [then]
>
> SwiftForth? [if]
>
> 156 constant lf-offset \ this is the offset for the local-frame in
> the user-variables (ESI is the user-variable base)
>
> code rex ( r -- ) \ HumptyDumpty called this RCALL
> lf-offset [esi] edx mov
> edx push \ this is the HOF's LF which won't be
> used by the quotation
> -4 [edx] eax mov \ this is the old ESP
> 0 [eax] eax mov \ this is the parent's
> LF which will be used by the quotation
> eax lf-offset [esi] mov
> ebx eax mov [drop]
> eax call
> lf-offset [esi] pop \ restore HOF's LF
> ret end-code
>
> [then]
>
> [else] \ this was written by HumptyDumpty and works on
> gForth, SwiftForth and VFX
>
> : rexit ( -- ) RDROP ;
> : (r:) ( -- r ) R@ 0 ;
> : r[ ( -- r ) postpone (r:) postpone IF ; immediate
> : ]r ( -- ) postpone REXIT postpone THEN ; immediate
> : rex ( r -- ) >R -1 ;
> \ HumptyDumpty called this RCALL
>
....
>
> [then]
>
....
> Here is some sample code using my rquotations:
....
>
> marker hottie.4th
>
>
> seq
> w field .gender \ 'M' or 'F'
"gender"?
Humans are of the male sex or of the female sex.
Only words have gender.
To pretend otherwise is to obey the Cultural Marxists.
Hugh may feel that he is obligated to obey them, since
they are his superiors.
"A Jew always has a much higher soul than a gentile, even if he is a
homosexual," he [Israel's Deputy Defense Minister Eli Ben-Dahan] said.
theoccidentalobserver.net/2015/10/israeli-minister-latest-in-long-line-of-jews-asserting-the-inferiority-of-non-jews
> \ if someone isn't one or the other, then he/she isn't a person
> constant person
>
> : init-person ( str node -- node )
> init-seq >r
> [char] M r@ .gender ! \ default is male
> r> ;
>
> : new-person ( str -- node )
> person alloc
> init-person ;
>
> person
> w field .hotness \ scale of 1 to 10
> constant chick
>
> : init-chick ( hotness str node -- node )
> init-person >r
> [char] F r@ .gender !
> r@ .hotness !
> r> ;
>
> : new-chick ( hotness str -- node )
> chick alloc
> init-chick ;
>
> : chick-counter ( head -- chicks )
> 0
> swap r[ .gender @ [char] F = if 1+ then ]r |each ;
>
> : macro-chick-counter ( head -- chicks )
> 0
> swap each[ .gender @ [char] F = if 1+ then ]each ;
>
> : test { head | people chicks tens nines eights -- }
> head r[
> 1 +to people
> dup .gender @ [char] F = if 1 +to chicks
> .hotness @
> dup 8 = if 1 +to eights then
> dup 9 = if 1 +to nines then
> 10 = if 1 +to tens then \ Yay! We found at least one!
> else drop then
> ]r |each
> cr ." total people: " people .
> cr ." total chicks: " chicks .
> cr ." level 10 chicks: " tens .
> cr ." level 9 chicks: " nines .
> cr ." level 8 chicks: " eights .
> ;
Note that he does not actually perform a test of
his code.
That would have added an intolerable additional amount
of code to the already incredible bloat.
Humans are capable of learning. Many experiments
have been performed in which laboratory rats have
learned rather rapidly.
However, Forth witlings have no capability for learning.
They must keep using Forth until doomsday.
Ruby:
Person = Struct.new(:sex)
Chick = Struct.new( *Person.members, :hotness )
persons = [:m, :f, 7, :f, 10, :m, :f, 8, :m, :f, 8].
slice_before{|x| x.is_a? Symbol}.map{|sex,hotness|
hotness ? Chick.new(sex,hotness) : Person.new(sex)}
counts = [0] * 11 ;
persons.select{|x| x.respond_to? :hotness}.each{|x| counts[x.hotness] += 1} ;
puts "#{ persons.size} people" ;
puts "#{ counts.reduce(:+) } chicks" ;
10.downto(8).each{|i| puts "level #{i} chicks: #{counts[i]}"}
===>
7 people
4 chicks
level 10 chicks: 1
level 9 chicks: 0
level 8 chicks: 2
--
Jewish drug dealers, child porn pushers, and slave traders are free
from prosecution in Israel. Israel does not consider these to be
crimes ... so long as the victims are non-Jews.
www.theoccidentalobserver.net/2009/08/the-culture-of-deceit/
[toc] | [prev] | [next] | [standalone]
| From | Julian Fondren <julian.fondren@gmail.com> |
|---|---|
| Date | 2016-12-10 00:37 -0800 |
| Message-ID | <ee85660d-3ff2-4454-9e56-23d832062b03@googlegroups.com> |
| In reply to | #53248 |
On Saturday, December 10, 2016 at 12:44:40 AM UTC-6, Robert L. wrote:
> Lambdas (a.k.a. anonymous functions) have been in use for decades
Forth has had anonymous definitions for decades as well. :NONAME
creates them. Quotations are a convenience that make sense in Forth.
A more analogous convention in other languages is the { code; block; }
The appeal of a stupid name like 'lambda' is tradition. Forth has a
tradition as well.
> persons = [:m, :f, 7, :f, 10, :m, :f, 8, :m, :f, 8].
> slice_before{|x| x.is_a? Symbol}
Yuck.
> witling witling witling
"Hey, Rob, what have you done with the last decade of your life?"
"I've been attacking ANS Forth!"
"Have you won any battles?"
"No."
"Oh. Are you going to win any battles?"
"A few people agree with me sometimes."
"Oh. Do you like them?"
"No, they're idiots."
-- Julian
[toc] | [prev] | [next] | [standalone]
| From | polymorph self <jackvanc3@gmail.com> |
|---|---|
| Date | 2016-12-11 06:39 -0800 |
| Message-ID | <b8372b96-7db1-4867-b15f-7b778905184e@googlegroups.com> |
| In reply to | #53248 |
On Saturday, December 10, 2016 at 1:44:40 AM UTC-5, Robert L. wrote:
> On 12/9/2016, hughaguilar96@gmail.com wrote:
>
> > VFX? SwiftForth? or [if]
> >
> > \ My code ( VFX or SwiftForth only) requires
> > that the HOF does have local variables.
> >
> > : rexit ( -- ) rdrop ;
> > : (r:) ( -- r ) r@ 5 + ; \ 5 is the size of a
> > JMP instruction in 32-bit x86
> > : r[ ( -- r ) postpone (r:) postpone ahead ; immediate
> > : ]r ( -- ) postpone rexit postpone then ; immediate
> >
> > VFX? [if]
> >
> > code rex ( r -- ) \ HumptyDumpty called this RCALL
> > push edi \ this is the HOF's LF which won't be used
> > by the quotation
> > mov edi, 0 [edi] \ this is the parent's LF which will be used
> > by the quotation
>
>
> "quotation"?
>
> Lambdas (a.k.a. anonymous functions) have been in use for decades
> in languages superior to Forth.
>
> Why did the Forth witlings feel that they had to conceive of a newer,
> senseless name for the concept?
>
> Forth witlings are the laughingstocks of the programming world.
>
>
> > mov eax, ebx
> > mov ebx, 0 [ebp] lea ebp, w [ebp]
> > call eax
> > pop edi \ restore HOF's LF
> > next, end-code
>
>
> Absolutely useless code.
>
> Will not run on an ARM.
>
>
>
> >
> > [then]
> >
> > SwiftForth? [if]
> >
> > 156 constant lf-offset \ this is the offset for the local-frame in
> > the user-variables (ESI is the user-variable base)
> >
> > code rex ( r -- ) \ HumptyDumpty called this RCALL
> > lf-offset [esi] edx mov
> > edx push \ this is the HOF's LF which won't be
> > used by the quotation
> > -4 [edx] eax mov \ this is the old ESP
> > 0 [eax] eax mov \ this is the parent's
> > LF which will be used by the quotation
> > eax lf-offset [esi] mov
> > ebx eax mov [drop]
> > eax call
> > lf-offset [esi] pop \ restore HOF's LF
> > ret end-code
> >
> > [then]
> >
> > [else] \ this was written by HumptyDumpty and works on
> > gForth, SwiftForth and VFX
> >
> > : rexit ( -- ) RDROP ;
> > : (r:) ( -- r ) R@ 0 ;
> > : r[ ( -- r ) postpone (r:) postpone IF ; immediate
> > : ]r ( -- ) postpone REXIT postpone THEN ; immediate
> > : rex ( r -- ) >R -1 ;
> > \ HumptyDumpty called this RCALL
> >
> ....
> >
> > [then]
> >
> ....
> > Here is some sample code using my rquotations:
> ....
> >
> > marker hottie.4th
> >
> >
> > seq
> > w field .gender \ 'M' or 'F'
>
>
> "gender"?
>
> Humans are of the male sex or of the female sex.
>
> Only words have gender.
>
> To pretend otherwise is to obey the Cultural Marxists.
>
> Hugh may feel that he is obligated to obey them, since
> they are his superiors.
>
> "A Jew always has a much higher soul than a gentile, even if he is a
> homosexual," he [Israel's Deputy Defense Minister Eli Ben-Dahan] said.
> theoccidentalobserver.net/2015/10/israeli-minister-latest-in-long-line-of-jews-asserting-the-inferiority-of-non-jews
>
>
>
> > \ if someone isn't one or the other, then he/she isn't a person
> > constant person
> >
> > : init-person ( str node -- node )
> > init-seq >r
> > [char] M r@ .gender ! \ default is male
> > r> ;
> >
> > : new-person ( str -- node )
> > person alloc
> > init-person ;
> >
> > person
> > w field .hotness \ scale of 1 to 10
> > constant chick
> >
> > : init-chick ( hotness str node -- node )
> > init-person >r
> > [char] F r@ .gender !
> > r@ .hotness !
> > r> ;
> >
> > : new-chick ( hotness str -- node )
> > chick alloc
> > init-chick ;
> >
> > : chick-counter ( head -- chicks )
> > 0
> > swap r[ .gender @ [char] F = if 1+ then ]r |each ;
> >
> > : macro-chick-counter ( head -- chicks )
> > 0
> > swap each[ .gender @ [char] F = if 1+ then ]each ;
> >
> > : test { head | people chicks tens nines eights -- }
> > head r[
> > 1 +to people
> > dup .gender @ [char] F = if 1 +to chicks
> > .hotness @
> > dup 8 = if 1 +to eights then
> > dup 9 = if 1 +to nines then
> > 10 = if 1 +to tens then \ Yay! We found at least one!
> > else drop then
> > ]r |each
> > cr ." total people: " people .
> > cr ." total chicks: " chicks .
> > cr ." level 10 chicks: " tens .
> > cr ." level 9 chicks: " nines .
> > cr ." level 8 chicks: " eights .
> > ;
>
>
> Note that he does not actually perform a test of
> his code.
>
> That would have added an intolerable additional amount
> of code to the already incredible bloat.
>
> Humans are capable of learning. Many experiments
> have been performed in which laboratory rats have
> learned rather rapidly.
>
> However, Forth witlings have no capability for learning.
> They must keep using Forth until doomsday.
>
>
> Ruby:
>
> Person = Struct.new(:sex)
> Chick = Struct.new( *Person.members, :hotness )
>
> persons = [:m, :f, 7, :f, 10, :m, :f, 8, :m, :f, 8].
> slice_before{|x| x.is_a? Symbol}.map{|sex,hotness|
> hotness ? Chick.new(sex,hotness) : Person.new(sex)}
>
> counts = [0] * 11 ;
> persons.select{|x| x.respond_to? :hotness}.each{|x| counts[x.hotness] += 1} ;
> puts "#{ persons.size} people" ;
> puts "#{ counts.reduce(:+) } chicks" ;
> 10.downto(8).each{|i| puts "level #{i} chicks: #{counts[i]}"}
>
> ===>
> 7 people
> 4 chicks
> level 10 chicks: 1
> level 9 chicks: 0
> level 8 chicks: 2
>
> --
> Jewish drug dealers, child porn pushers, and slave traders are free
> from prosecution in Israel. Israel does not consider these to be
> crimes ... so long as the victims are non-Jews.
> www.theoccidentalobserver.net/2009/08/the-culture-of-deceit/
woa
shots fired!
what lang do you use? lisp? haskell? smalltalk? ada?
[toc] | [prev] | [next] | [standalone]
| From | Andrew Haley <andrew29@littlepinkcloud.invalid> |
|---|---|
| Date | 2016-12-10 03:38 -0600 |
| Message-ID | <HNmdncVJE8KaUNbFnZ2dnUU7-XudnZ2d@supernews.com> |
| In reply to | #53236 |
HAA <someone@microsoft.com> wrote: > Alex wrote: >> On 12/9/2016 00:03, HAA wrote: >> > There seems to be this notion quotations are just nameless >> > subroutines. They don't have the capabilities of subroutines and >> > never will. >> >> What capabilities does a subroutine have that quotations don't? > > Subroutines make a program manageable by isolating functionality > into discrete re-usable objects. Quotations tend toward the > opposite. That's quite the non-answer. Andrew.
[toc] | [prev] | [next] | [standalone]
| From | november.nihal@gmail.com |
|---|---|
| Date | 2016-12-11 08:57 -0800 |
| Message-ID | <87fee783-ce0e-4461-bd3b-6f3b9719e692@googlegroups.com> |
| In reply to | #53252 |
On Saturday, 10 December 2016 09:38:20 UTC, Andrew Haley wrote: > HAA <someone@microsoft.com> wrote: > > Alex wrote: > >> On 12/9/2016 00:03, HAA wrote: > > >> > There seems to be this notion quotations are just nameless > >> > subroutines. They don't have the capabilities of subroutines and > >> > never will. > >> > >> What capabilities does a subroutine have that quotations don't? > > > > Subroutines make a program manageable by isolating functionality > > into discrete re-usable objects. Quotations tend toward the > > opposite. > > That's quite the non-answer. > > Andrew. I think thats because the question asked, was the wrong one! If quotations are quoted lists, are all quoted lists quotations ? No. Lists which contain executable code should be considered quotations. The power of quotations is you can manipulate a list and thus the sequence of the code with ease. Given we are talking about quotations within the context of forth, I think :noname is a poor substitute. NN
[toc] | [prev] | [next] | [standalone]
| From | hughaguilar96@gmail.com |
|---|---|
| Date | 2016-12-11 10:19 -0800 |
| Message-ID | <e1ecf868-6c2d-4e59-89d5-5158a0e72e43@googlegroups.com> |
| In reply to | #53280 |
On Sunday, December 11, 2016 at 9:57:18 AM UTC-7, novembe...@gmail.com wrote: > On Saturday, 10 December 2016 09:38:20 UTC, Andrew Haley wrote: > > HAA <someone@microsoft.com> wrote: > > > Alex wrote: > > >> On 12/9/2016 00:03, HAA wrote: > > > > >> > There seems to be this notion quotations are just nameless > > >> > subroutines. They don't have the capabilities of subroutines and > > >> > never will. > > >> > > >> What capabilities does a subroutine have that quotations don't? > > > > > > Subroutines make a program manageable by isolating functionality > > > into discrete re-usable objects. Quotations tend toward the > > > opposite. > > > > That's quite the non-answer. > > > > Andrew. > > > > I think thats because the question asked, was the wrong one! > > If quotations are quoted lists, are all quoted lists quotations ? No. > Lists which contain executable code should be considered quotations. > > The power of quotations is you can manipulate a list and thus the sequence of the code with ease. > > Given we are talking about quotations within the context of forth, I think :noname is a poor substitute. > > NN What I have right now as an rquotation is a single executable (you give it to REX and it executes). I don't support a "quotation" being a list of rquotations --- the reason is that, if a HOF expects an rquotation as a parameter, it has no way of distinguishing between an rquotation and a pointer to a list of rquotations because in Forth data is not tagged like it is in Lisp. I could support lists of quotations in Straight Forth if I wanted to. This could be done by making every quotation a pointer to a list of quotations (possibly only one in the list though). This would be slightly slower because there is extra work when the list contains only one quotation, which is the typical case --- I don't think this is worthwhile unless you have GC like in Scheme, and I'm not going to have GC in Straight Forth, so I don't think I will support it. Factor doesn't support this, afaik. I should really learn Scheme so I know more about the subject before I get too far into Straight Forth design --- I don't want to become a Scheme programmer though because I think that tagged data and GC is too slow --- Scheme can be used as a scripting language, but that is not where I'm going with Straight Forth. The world already has a lot of slow scripting languages, all derived from Scheme (Ruby etc.). I want Straight Forth to be fast --- it is primarily for numerical programs (that hyperspace turtle program, for example, involves a lot of computation done pretty fast). My use of quotations in Straight Forth is pretty basic --- all I want to do is support general-purpose data-structures --- I'm not competing against Scheme; I'm competing against C.
[toc] | [prev] | [next] | [standalone]
| From | Paul Rubin <no.email@nospam.invalid> |
|---|---|
| Date | 2016-12-11 13:25 -0800 |
| Message-ID | <87mvg22m65.fsf@nightsong.com> |
| In reply to | #53280 |
november.nihal@gmail.com writes: > If quotations are quoted lists, are all quoted lists quotations ? ... > The power of quotations is you can manipulate a list and thus the > sequence of the code with ease. I don't understand the bit about quotations being quoted lists. Do you mean like in Lisp? That's certainly not a necessary characteristic. I thought a Forth quotation was just supposed to be a function pointer made from an anonymous code block, that could appear in the middle of a colon definition. Lots of other languages have features like that and it's useful. Whether it's a good fit for Forth is more debatable. > Given we are talking about quotations within the context of forth, I > think :noname is a poor substitute. Afaict, quotations per the ANS proposal are a straightforward syntactic convenience--quotations that can reach outer scopes for locals are more powerful but much harder to implement.
[toc] | [prev] | [next] | [standalone]
| From | hughaguilar96@gmail.com |
|---|---|
| Date | 2016-12-11 17:39 -0800 |
| Message-ID | <6b005ec9-fc7a-4a11-bdcc-b6e980b12f7d@googlegroups.com> |
| In reply to | #53283 |
On Sunday, December 11, 2016 at 2:25:23 PM UTC-7, Paul Rubin wrote: > Afaict, quotations per the ANS proposal are a straightforward syntactic > convenience--quotations that can reach outer scopes for locals are more > powerful but much harder to implement. LOL I implemented the rquotations (source-code provided in previous post) as a joke --- everytime one of the Forth-200x enthusiasts say that quotations are impossible, that is the punch-line of the joke! This is why I call the Forth-200x committee the "Committee of Can't" --- they are totally focused on telling the Forth community what they can't do --- but what they say we can't do, I implement easily with a few lines of straight-forward assembly-language.
[toc] | [prev] | [next] | [standalone]
| From | november.nihal@gmail.com |
|---|---|
| Date | 2016-12-11 17:49 -0800 |
| Message-ID | <1e02dfcb-390e-4812-8c40-bc7124aa2099@googlegroups.com> |
| In reply to | #53283 |
> > If quotations are quoted lists, are all quoted lists quotations ? ... > > The power of quotations is you can manipulate a list and thus the > > sequence of the code with ease. > > I don't understand the bit about quotations being quoted lists. Do you > mean like in Lisp? .... Yes I mean quoted lists like in Lisp. Joy has a list datatype which doubles up for quotations ( as does factor ) Forth does not have a list datatype and thus any implementation we forthers create will be limited by the constraints of what we have. I hope this clarifies my earlier post. NN
[toc] | [prev] | [next] | [standalone]
| From | hughaguilar96@gmail.com |
|---|---|
| Date | 2016-12-11 20:31 -0800 |
| Message-ID | <cdac7287-8ba7-4b9f-b135-2c9d2ff1fb0d@googlegroups.com> |
| In reply to | #53287 |
On Sunday, December 11, 2016 at 6:49:34 PM UTC-7, novembe...@gmail.com wrote:
> > > If quotations are quoted lists, are all quoted lists quotations ? ...
> > > The power of quotations is you can manipulate a list and thus the
> > > sequence of the code with ease.
> >
> > I don't understand the bit about quotations being quoted lists. Do you
> > mean like in Lisp? ....
>
>
>
> Yes I mean quoted lists like in Lisp.
>
> Joy has a list datatype which doubles up for quotations ( as does factor )
>
> Forth does not have a list datatype and thus any implementation we forthers create will be limited by the constraints of what we have.
>
> I hope this clarifies my earlier post.
>
> NN
Actually Joy and Factor differ. In Joy lists and quotations are the same with [ ... ] --- in Factor we have quotations with [ ... ] and we have "sequences" with { ... } --- because they are different, the compiler can compile quotations more efficiently because it is never unsure if they are quotations or sequences. AFAIK, Factor was derived from Joy --- making quotations and sequences distinct was the big improvement --- now Factor is used for writing commercial software, but Joy remains only of academic interest.
Sequences are arrays, but they support insertion.
I was impressed with how Factor used sequences as its standard data-type --- it is possible to build other data-types, but this is only done when absolutely necessary --- the programmer is exkpected to use sequences if this is at all reasonable.
I tried to do the same thing with lists in the novice-package, but nobody responded positively. Now I'm going with chains and arrays in Straight Forth. I think it makes programs a lot more readable if everybody is using the same data-structure --- all the programs look similar to each other --- in Forth all the programs look different, and they are generally ugly and hard to read because the programmer hacked together some data-structure as an expedient due to nothing being available already.
[toc] | [prev] | [next] | [standalone]
| From | november.nihal@gmail.com |
|---|---|
| Date | 2016-12-12 07:01 -0800 |
| Message-ID | <de6d2640-215d-4a8a-83f9-5fa62f0819fb@googlegroups.com> |
| In reply to | #53291 |
> I tried to do the same thing with lists in the novice-package, but nobody responded positively. Now I'm going with chains and arrays in Straight Forth. I think it makes programs a lot more readable if everybody is using the same data-structure --- all the programs look similar to each other --- in Forth all the programs look different, and they are generally ugly and hard to read because the programmer hacked together some data-structure as an expedient due to nothing being available already. ..... I agree that other people’s forth code can be hard to read. But thats because the language is flexible and programmers have choice. I think chains and arrays would be a good addition. If they increase productivity then thats a good thing. I don’t know whether rquots are enough or whether you should support lists of quots. You should go with whats easiest for you and let us know. Having tagged data would mean we finally join the world of types. I think it would be good to have GC in forth. I am curious , what makes GC too slow for your needs ? If that hyperspace turtle ran one picosecond slower ( example) would you really care ? NN
[toc] | [prev] | [next] | [standalone]
| From | Paul Rubin <no.email@nospam.invalid> |
|---|---|
| Date | 2016-12-11 21:50 -0800 |
| Message-ID | <87a8c13dcz.fsf@nightsong.com> |
| In reply to | #53287 |
november.nihal@gmail.com writes: > Yes I mean quoted lists like in Lisp. > Joy has a list datatype which doubles up for quotations ( as does factor ) > Forth does not have a list datatype and thus any implementation we > forthers create will be limited by the constraints of what we have. Ok, yeah. I haven't used joy or factor. I think the programs=data aspect of Lisp is overrated by some users and Lisp is really about lambda calculus. Lisp has macros that rely on code-as-data, but its counterpart of quotations would be lexical closures, which are handled by the black-box compiler. Similar with Scheme, Python, etc.
[toc] | [prev] | [next] | [standalone]
| From | polymorph self <jackvanc3@gmail.com> |
|---|---|
| Date | 2016-12-11 06:20 -0800 |
| Message-ID | <00efcfd3-b84f-495e-af89-46066ced8c3c@googlegroups.com> |
| In reply to | #53163 |
On Wednesday, December 7, 2016 at 12:06:10 PM UTC-5, Mark Wills wrote: > On Wednesday, 7 December 2016 11:23:21 UTC, Julian Fondren wrote: > > Youtube vid: https://www.youtube.com/watch?v=QM1iUe6IofM > > > > Probably not that interesting for us, but I did note that the feature > > he wants at the end, which he doesn't think any existing language has, > > is actually what quotations are. Non-Hugh quotations: he explicitly > > doesn't want any of the outer function's environment to seep through > > into the inner function, except by argument passing. > > > > > > -- Julian > > > he explicitly > > doesn't want any of the outer function's environment to seep through > > into the inner function, except by argument passing. > > We had them in the 70s. They were called SUBROUTINES > > :-) didnt chuck moore say no locals? make all vars global? I know lisp book goes on about local vs not... Can forth still beat haskell and lisp and smalltalk and ada? is it concurrent enough?
[toc] | [prev] | [next] | [standalone]
| From | Paul Rubin <no.email@nospam.invalid> |
|---|---|
| Date | 2016-12-07 09:26 -0800 |
| Message-ID | <87mvg7647a.fsf@nightsong.com> |
| In reply to | #53149 |
Julian Fondren <julian.fondren@gmail.com> writes:
> the feature he wants at the end, which he doesn't think any existing
> language has, is actually what quotations are. Non-Hugh quotations: he
> explicitly doesn't want any of the outer function's environment to
> seep through into the inner function, except by argument passing.
I skipped to the end and I think C++11 lambdas is basically what he
wants. If you want a lambda to capture variables from its enclosing
scope, you have to name them explicitly, like:
int x;
auto foo = [x]() { return x+3; }
(I may have the syntax slightly wrong but that's the idea).
The video looks interesting but I don't have the patience to sit through
45 minutes of it. I wonder if he has a blog post or something
somewhere..
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.forth
csiph-web