[pro] Lisp and DSLs

Marco Antoniotti antoniotti.marco at disco.unimib.it
Thu Jul 21 07:08:39 UTC 2011


Another cut example I did many years ago (showing my NYU colors) along the lines of what Pascal shows here is the "SETL syntax" in CL.  I still have the code.  Here is the stupid PRIMES

(defun primes (max)
  [n in (range 3 max 2)
   such-that (not (exist m in (range 3 (min (1- n) (+ 2 (sqrt n))) 2)
                         such-that (= (mod n m) 0)))])

Cheers

MA





On Jul 21, 2011, at 01:57 , Pascal J. Bourguignon wrote:

> Didier Verna <didier at lrde.epita.fr> writes:
> 
>>  Dear friends,
> 
> http://groups.google.com/group/comp.lang.lisp/browse_frm/thread/0245342429c61800/f7966bf3df9f716c#f7966bf3df9f716c
> 
> Notably, in this type of DSL, you'll note how you can mix Lisp
> expressions with expressions in the new languages, at several levels.
> 
> 
> @[Icals method:(pressPop:(:id)sender)   ;
>        resultType:(:id)                ; objcl
>        body:                           ;
>        (declare (ignore sender))           ; 
>        (loop                               ; lisp
>           :for i :from 0 :below 3          ;
>           :do [(aref (icals-stack self) i) setIntValue:[(aref (icals-stack self) (1+ i)) intValue]])]
>               ^^                                       ^^ 
>               ||                                       ||
>               |+-- lisp                                |+--- lisp
>               +--- objcl                               +---- objcl
> 
> It might be worthwhile comparing the sources of an early Objective-C
> front-end such as POC (that includes only the parsing of Objective-C
> syntax, and generation of the C code for the usual C compiler, and thus
> is functionnaly equivalent to ObjCL),  with the lisp sources of ObjCL.
> 
> http://users.telenet.be/stes/compiler.html
> (objc-3.2.11.tar.gz)
> 
> 
> -- 
> __Pascal Bourguignon__                     http://www.informatimago.com/
> A bad day in () is better than a good day in {}.
> 
> 
> _______________________________________________
> pro mailing list
> pro at common-lisp.net
> http://lists.common-lisp.net/cgi-bin/mailman/listinfo/pro

--
Marco Antoniotti, Associate Professor				tel.	+39 - 02 64 48 79 01
DISCo, Università Milano Bicocca U14 2043		http://bimib.disco.unimib.it
Viale Sarca 336
I-20126 Milan (MI) ITALY

Please note that I am not checking my Spam-box anymore.
Please do not forward this email without asking me first.









More information about the pro mailing list