Archive for the Everything old is new again Category

DrRacket is a racket

Posted in Everything old is new again on December 6, 2015 by asteriondaedalus

What a way to get people through their prejudices.

Change the name from Scheme to Racket and bank on people not having a history of being misinformed to believe Lisp and Scheme are dead.

They ain’t of course.  Been hanging on for a Renaissance.

Go figure functional languages have resurged.  You remember those.

Of course Erlang does Lisp (aka lfe).

But what ballsy misdirection. Just don’t call it Scheme no more no more, just don’t call it Scheme no more.

Still.

Bad form in the examples:

(define (reply-more s)
  (cond
     [(equal? “hello” (substring s 0 5))
       “hi!”]
     [(equal? “goodbye” (substring s 0 7))
       “bye!”]
     [(equal? “?” (substring s ( (string-length s) 1)))
       “I don’t know”]
     [else “huh?”]))
> (reply-more “hello racket”)
“hi!”
> (reply-more “goodbye cruel world”)
“bye!”
> (reply-more “what is your favorite color?”)
“I don’t know”
> (reply-more “mine is lime green”)
“huh?”

The problem being  the test for “?” and that one is forced to fall through the first two tests and so it cracks up when a string shorter than 5 char comes through as there is an overrange condition.

For example:

(reply-more “bug?”)
. . substring: ending index is out of range
ending index: 5
starting index: 0
valid range: [0, 4]
string: “bug?”
>

Still takes me back.  I did knock up a lisp interpreter in FORTH years ago … for the shear fun of it.

The safer version thus (forgive the loss of indenting):

(define (reply-more s)
  (cond
    [(equal? “?” (substring s ( (string-length s) 1)))  
      “I don’t know”]
     [(equal? “hello” (substring s 0 5))       
      “hi!”]
     [(equal? “goodbye” (substring s 0 7))
      “bye!”]
     [else “huh?”]))

> (reply-more “bug?”)
“I don’t know”

I will leave it to the reader to work out if there is a bug if a 6 character string is used.

Now why I like lisp/scheme/forth?  The same reason I like python.  Very productive code and test and code and test and code and test.

So, now I like Racket too.

 

 

Advertisements

The anti-pattern becomes the new anti-anti-pattern

Posted in Everything old is new again, Software on May 15, 2014 by asteriondaedalus

Functional thinking.

So, I played with lisp years ago, and other functional languages.

Somewhere along the line the notion of thinking functionally became an anti-pattern – at least from the OO camp.

So, functional thinking has returned!  Apparently.

I have been watching in the background, it would always have come back IMHO.

OO tried to be the Panacea.  But the biggest problem, I felt, it obfuscated the functional model for the application.

We still end up with a functional model, even if its a tacit one.

In fact, sequence diagrams, activity diagrams and even robustness diagrams of UML – not to mention BPMN, all are functional modelling approaches.

The problem is you need the right orientedness for the problem expression.

It harks back to my chattering on Jason vs Jack in the Agent Oriented world.  Jack obfuscates the Agent Orientedness of the problem, making you develop with Java OO libraries.

DSL are in vogue, even if its just @nnotations in Java or Python – allowing you to create you’re own “orientedness”.

Now, don’t get me started on parallel computing – recall I used to code in OCCAM and Transputers decades ago.  It is been driven by multi-core world somewhat but, of course, they haven’t architected for parallelism.  Just stuck lots of cores on a substrate hoping someone would sort out the coding problem.

So, how do we do it?  We don’t use OCCAM!?  Although Go! is a great alternative I am thinking.   Still no one gets behind mature ideas like Plan 9?!  We just start afresh with same stale old ideas.