

Common Lisp, Clojure and Evolution - amouat
http://www.adrianmouat.com/bit-bucket/2011/02/common-lisp-clojure-and-evolution/

======
mahmud
Clojure struct constructor needs keywords badly. Right now it's position-
dependent and only way to know what each sub-expression is doing is to look up
the definition of the structure.

    
    
      (struct person  6.3 63 63)
    

What do the magic numbers mean? Dunno, you need to look up defstruct
definition. In Common Lisp, it's:

    
    
      (make-person :height 6.3 :age 63 :weight-in-kg 63)  
                             ;; or better :weight (kg 63)
    

Then

" _Clojure doesn’t have the parse-integer function, but I was quickly able to
implement something that did the job by calling out to the Java parseInt
method._ "

This has to be remedied. You need to have native control over basic
reading/writing; don't offshore that to another language, even one your
language is implemented on-top of.

I agree with the sentiment against ASH (Arithmetic-SHift); seriously,
division/multiplication as 2^N shifts is a performance hack, and a useless one
at that (smart compilers already do this, and stupid ones are bytecode
compilers.)

Common Lisp already has about 9 division operators (yes, NINE) and it would
have been a good opportunity to introduce them and their various uses. They
are: /, floor, ffloor, ceiling, fceiling, truncate, ftruncate, round, fround
-- for integers and floats respectively[1], along with MOD and REM

[1] excellent candidates for removal in future CL with CLOS-based type
hierarchy; type-dispatch ftw! With ML-style type annotations it would even be
feasible to do type hints inline, like (values (/@double-float 22 7) (/@int 22
7)) using @ because colon is a package separator.

~~~
gcv
First of all, Clojure has struct-map, which supports keywords, much like
default Common Lisp struct constructors.

Second, Clojure's defstruct is on its way out. defrecord provides similar
functionality with far better performance. By default, however, it does have
the positional-arguments-only flaw. My personal favorite workaround is a small
macro from this post:
<http://groups.google.com/group/clojure/msg/5206fac13144ea99>

No comment about numerical operations in Clojure: it's a sensitive topic. :)

~~~
mahmud
Even the manual recommends records in lieu of struct-map.

And yes, that flaw is icky; one of the few in Hickey's otherwise excellent
track-record in good taste.

~~~
amouat
The manual? What's the manual?

~~~
whateverer
Here: <http://clojure.org/data_structures>, see the entry for StructMaps. The
page on datatypes* also implies heavily that structs have been phased out in
favor of records, as no reason to use structs over records is presented.

* <http://clojure.org/datatypes>

