Having fun with booleans

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Having fun with booleans

Igor Stasenko
Hello,
I just realized, that one can completely avoid using ifTrue/ifFalse
branches, but use #or: and #and: instead.

a > b ifTrue: [ ... ]
could be written as:
a > b and: [ ... ]

a > b ifFalse: [ ... ]
could be written as:
a > b or: [ ... ]

and
a > b ifTrue: [ self foo ] ifFalse: [ self bar ]
could be written as:

a > b and: [ self foo]; or:[ self bar ]

:)

--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: Having fun with booleans

Michael Haupt-3
Hi Igor,

On Fri, Mar 5, 2010 at 8:22 AM, Igor Stasenko <[hidden email]> wrote:
> I just realized, that one can completely avoid using ifTrue/ifFalse
> branches, but use #or: and #and: instead.

oh please. This programming style is why I have a certain dislike for
the HTDP book; its authors advocate this. I think it's totally unclear
and obfuscating, in Scheme or elsewhere.

Yuck,

Michael

Reply | Threaded
Open this post in threaded view
|

Re: Having fun with booleans

Chris Cunnington
In reply to this post by Igor Stasenko
How To Design Programs from MIT is annoying. Scheme The Programming Language is much easier to take.

The reason I read this board is mainly to glean lessons like Igor's. That post is perfect example of something I can throw in a Workspace, play with, and learn a little more about Squeak. Groovy. 

Chris 


Reply | Threaded
Open this post in threaded view
|

Re: Having fun with booleans

Benjamin L. Russell
Chris Cunnington <[hidden email]> writes:

> Scheme The Programming
> Language is much easier to take.

Unless I'm mistaken, there is no book of this title; instead, there is a
book of a very similar title, entitled _The Scheme Programming Language._

Is this the book to which you are referring?

-- Benjamin L. Russell
--
Benjamin L. Russell  /   DekuDekuplex at Yahoo dot com
http://dekudekuplex.wordpress.com/
Translator/Interpreter / Mobile:  +011 81 80-3603-6725
"Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^


Reply | Threaded
Open this post in threaded view
|

Re: Having fun with booleans

Chris Cunnington
In reply to this post by Igor Stasenko
"there is a
book of a very similar title, entitled _The Scheme Programming Language._"

Yes. Dybvig's book. I have the third edition, though I understand a fourth has appeared. It seems a lot easier to me to learn about Scheme from that book than HTDP, which I think has some kind of pedagogical framework that at odds with my own hacker "break it to learn it" mentality. 
The only reason I care about Scheme at all is to learn about continuations and then see what applies in Seaside. I want a strong multimedia future for Squeak. I love pumping code from Beginning OpenGL Game Programming into Croquet, but I spend most of my time looking at Seaside code. How ResponseContinuation was replaced by WARenderContinuation and WARedirectContinuation (and has changed again in Seaside 3.0), which I supposed might be an example of Continuation Passing Style, explained by Dybvig, because they aren't continuations at all ...
Yes. Web development is important to this Squeaker. 
Chris 


Reply | Threaded
Open this post in threaded view
|

Re: Having fun with booleans

Benjamin L. Russell
Chris Cunnington <[hidden email]> writes:

> <span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: medium; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; ">
> "there is a
> book of a very similar title, entitled _The Scheme Programming Language._"
> Yes. Dybvig&#39;s book. I have the third edition, though I understand
> a fourth has appeared. It seems a lot easier to me to learn about
> Scheme from that book than HTDP, which I think has some kind of
> pedagogical framework that at odds with my own hacker "break it to
> learn it" mentality. 

I think that I know what you mean.  I have had problems in reading HtDP
as well, mainly because I have found that book far too boring to read
through; it does not encourage exploration, and tends to take the fun
out of programming.  While SICP relies on too much domain knowlege (although I
still like SICP very much, some of the exercises in that book assume too
much "ad hoc insight" (to quote page 11 of "The Structure and
Interpretation of the Computer Science Curriculum (see
http://www.ccs.neu.edu/scheme/pubs/jfp2004-fffk.pdf))), HtDP does not
encourage exploration enough.

The closest balance between the two extremes that I have discovered so
far is the textbook _Concrete Abstractions: An Introduction to Computer
Science Using Scheme_ (see
http://gustavus.edu/+max/concrete-abstractions.html), by Max Hailperin,
Barbara Kaiser, and Karl Knight.  However, even that book is somewhat
too elementary for my taste.

> The only reason I care about Scheme at all is to learn about continuations and then see what applies in Seaside. I want a strong multimedia future for Squeak. I love pumping code from Beginning OpenGL Game Programming into Croquet, but I spend most of my time looking at Seaside code. How ResponseContinuation was replaced by WARenderContinuation and WARedirectContinuation (and has changed again in Seaside 3.0), which I supposed might be an example of Continuation Passing Style, explained by Dybvig, because they aren&#39;t continuations at all ...
> Yes. Web development is important to this Squeaker. Chris </span>

Interesting.  Your interests seem to coincide with my own interests in
Scheme, which mainly focus on continuations, too.  I am interested in
learning Cobalt for its multimedia applications; it seems well-suited to
creating a certain kind of virtual world.  It's too bad that active
development for Croquet has stopped since late 2006 in favor of Cobalt
(see http://www.opencroquet.org/index.php/Croquet_SDK).  On another
note, it is unfortunate that Scheme is weak in the area of multimedia
support.

I am currently looking for volunteer collaborators to help create a
certain kind of virtual world application in Cobalt.  Byy any chance,
are you interested in creating a virtual world in Cobalt?

-- Benjamin L. Russell
--
Benjamin L. Russell  /   DekuDekuplex at Yahoo dot com
http://dekudekuplex.wordpress.com/
Translator/Interpreter / Mobile:  +011 81 80-3603-6725
"Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^


Reply | Threaded
Open this post in threaded view
|

Re: Having fun with booleans

Chris Cunnington
In reply to this post by Igor Stasenko
Thanks for this link to Concrete Abstractions. It looks great. I downloaded the pdf and plan to explore it. 

Yes, I'd like to build a Cobalt world. That sounds like a good idea. I figure that's where the active development is, and I should be. But I made a few inroads with Croquet and just sort of played around with it more. I'll email you tomorrow. At the moment it's Friday night and I need to turn off my brain. 

Chris