Tagged DSL
ASM development log 3: DSLs
Posted on by Idorobots
"Kajtek, you incredibly handsome stallion, what have you been doing these past few months?" - you might ask, concerned about the lack of ASM dev logs recently...
Well, I've mostly been studying various PL design quirks and prototyping neat features such as vau calculus flavoured fexprs or the following piece of what I consider art.
As mentioned before, I was working on an extensible reader that would support user-defined reader macros for easy DSL programming. It took me quite some time, effort and researching but eventually I came up with an awesome solution. It's worthy to mention here, that it's in no way a new solution. I prefer to figure stuff out myself and often times it turns out that similar concept already existed a few years before mine. Bummer u_u
.
One of the most distinctive features of Common Lisp and Lisp in general, are its code-generation and code-manipulation capabilities.
Probably the best example is the LOOP
macro - a Swiss Army knife of iteration that can do pretty much anything. The following snippet iterates a list of random numbers collecting some statistics of its contents and does that while being very concise and readable:
(let ((random (loop with max = 500
for i from 0 to max
collect (random max))))
(loop for i in random
counting (evenp i) into evens
counting (oddp i) into odds
summing i into total
maximizing i into max
minimizing i into min
finally (format t "Stats: ~A"
(list min max total evens odds))))
Stats: (0 499 120808 261 240)
Land of Lisp
Posted on by Idorobots
I finally got around to writing a proper review of this book...
Lisp is a unique language that I decided to learn and use daily, so I grabbed the Land of Lisp by Conrad Barski and took off towards Alpha Centauri. It's a mighty fine read indeed, see for yourself:
ASM development log 1: OliviaBOT
Posted on by Idorobots
Hello fellow programmers. Look at your favourite programming language.
Now back to Lisp.
Now back to your favourite language.
Now back to Lisp.
Sadly, it isn't Lisp, but if you stopped wasting your time, it could feel like it's Lisp.
Look down.
Back up.
Where are you?
Reading in OldSpice-guy's voice as I introduce the ASM programming language.
What's on your mind?
Back at me.
ASM has it. The expressiveness and brevity augmented by powerful and extensible features.
Look again.
ASM is now usable.
Anything is possible when your programming language is functional and not imperative.
It's highly munctional.