I have just recently started to learn some clojure and in order to make something like types (more like contracts) for validations etc, the go-to solution is a library named schema.
Recently I learned that clojure 1.9 however will have something similar named clojure.spec
Can anyone please tell me the differences between them?
When should I use one or the other, pros and cons, etc?
Eric Normand did this comparison, but as already pointed out you should definitely check the rationale, and there is also the guide and a podcast where Rich Hickey talks abouts clojure.spec.
The spec rationale is quite in-depth, I would suggest reading it: https://clojure.org/about/spec after that feel free to compare it with any other library you may be considering.
Chapter 5 of SICP explains the scheme meta circular evaluator interns of a register machine.
Is there anything that provides a similar type of Mini-Kanren in terms of Scheme primitives?
I know that there is a Thesis written on Mini-Kanren (however, I only care about building a mental model; not all the gory optimizations details). I also know that there is the reasoned-schemer -- however, I'm not looking for a bunch of examples -- I just want to understand Mini-kanren in its' very very basic form, much like how one can understand scheme by understanding: eval, apply, if, set!, env
Thanks!
I think reading The Reasoned Schemer is actually the right way to learn the basics. You could also try watching Dan Friedman and William Byrd's miniKanren talk from Clojure Conj.
Since miniKanren only has seven forms total, understanding the basic forms is really just understanding the whole thing. The implementation is only about a page of macros, so you could try to understand that. You could also try reading the introductory parts of William Byrd's PhD thesis.
In the book The Reasoned Schemer there's an implementation of a very simple logic system on top of Scheme. It's self-contained, the only thing needed for understanding it is the book itself, which - in the style of the other books in the series, is extremely easy to follow.
I would like to know "anti-design". Please suggest an e-book for anti design pattern.
You may like to check out:
The daily wtf & Anti patterns
Not an e-book, but the only book I know: “AntiPatterns: Refactoring Software, Architectures, and Projects in Crisis” (the link is to Wikipedia's book review).
For some reason I always thought that book was by Martin Fowler, but it wasn’t.
Wikipedia also has an incomplete list of common antipatterns.
Cheers & hth.,
I have seen books on refactoring.
But I don't think I have ever seen a book on presenting bad code.
The closest thing you can find that shows examples of bad code is in Code Complete by Steven McConnel. The author puts in these little snippets called "Coding Horror" that are examples of bad code. He then explains how to write good code instead, in those situations.
This book is simply the best book on good coding practices I have ever seen.
You may find the articles from SourceMaking interesting.
I want to write regular expression library in C/C++.
What is the good starting point , any books or articles.
I know there are may libraries are available , but I want to write my own version.
A good starting point is to use existing implementations and criticize them.
Pay attention to data structures and design decisions you don't like.
Avoid them when you write your version.
[Edit 16-Jan-2015] I recently encountered this beautiful book Beautiful Code. I recommend you go through Chapter 1, "A Regular Expression Matcher" by Brian Kernighan.
You can read the classic paper by Ken Thompson, "Regular expression search algorithm" ... http://portal.acm.org/citation.cfm?doid=363347.363387 ... this paper should give you a good understanding on how regular expressions are matched using finite automata.
This is another page giving some detailed information by Russ Cox ... http://swtch.com/~rsc/regexp/
Hope these help you get started.
I don't know a book that will help you with the implementation details -- and I'm sure there are tons of details to make it efficient. However, the book Languages and Machines, by Thomas A. Sudkamp, will be of help to understand the ideas behind an implementation.
I think what you'll need to do is compile a regular expression into a finite automata. If you don't know much about grammars and automatas, then part II of that book "Grammars, Automata, and Languages" will be of great help.
The book Compilers, principles, techniques, & tools; by Alfred Aho, Monica Lam, Ravi Sethi and Jeffrey Ullman (also refered to as the dragon book), may also be of help. It's oriented towards making a compiler for a computer language, not for regular expression language. However, you'll probably find it helpful, specially the part about parsing, as it has more of a practical nature (as opposed to Languages and Machines that is very theoretical).
Anyway, if I was to write a regular expression language, those would be my starting points. I recommend you borrowing both from the library you have access to. Other than that, you should take a look at working implementations. I'm just guessing here, but I think there'll be probably good documentation regarding Perl regular expression implementation. Seeing they're so popular and work so well.
Good luck.
I have been learning C++ for three months now and in that time created a number of applications for my company. I consider myself fairly comfortable with C++ / MFC and STL, however I don't just want to be an OK programmer, I want to be a good programmer. I have a few books on best practices but I was wondering if anyone could suggest reading materials that helped them and any disciplines which should be encouraged?
Thanks!
I would start with the Pragmatic Programmer, Code Complete, Refactoring and Design Patterns.
For C++, Scott Meyers books are very good, and will help take you to the next level.
If you don't already have it C++ by Bjarne Stroustrup, 3rd Edition
Uhm... Teach Yourself Programming in Ten Years (Peter Norvig)
3 months into c++ and you're already comfortable with it? Sheesh, I've been learning c# for over a year and have taken numerous Microsoft courses and I'm nowhere near comfortable with it.
That being said, you'll hear Code Complete tossed about as a very good book. I'm in the process of reading it now.
Marshall Cline's C++ FAQ Lite.
Herb Sutter's Exceptional C++.
Large Scale C++ Software Design by John Lakos gives guidance on design methods that will make your C++ more maintainable. It is pretty hefty but you can dip in and still get some benefits.
Somewhat off-topic: rather than suggesting books to learn, I'd like to mention some broad topics to consider.
Threading. This one is not much in demand if you use MFC, but in many other areas it's indispensable. The mechanics of threading APIs are easy to pick up, but learning all the corner cases takes a lot of time and practice.
Closures, Map-Reduce and other lisp-like techniques. Find out what they are, why they are not supported in C++, and how they are imitated in C++ (functors, and many other cases of stateful callback objects). For this I actually have a book: "Structure and Interpretation of Computer Programs".
Command Line. This gives you an idea on when not to code your own programs. Command line would be Unix command line - I don't know about MS's latest experimentation in this are, but cmd.exe is awful. Get Cygwin and start experimenting.
Scripting languages. This gives you an idea on when not program in C++. My favorite is Perl, but many people say Python, Ruby and whatnot. Hey, learn XSLT if you're so inclined!
I am sure I left out other areas. I'll mark this as Community Wiki - feel free to add.
Good blogs:
Guru of the Week, and all the books by Herb Sutter. Those will give you quite a lot to chew already.
Modern C++ Design by Alexandrescu if you want to get a good feel for what you don't yet know, and probably don't want to know.
Code Kata's for practice!
I have read several (not complete but some parts) of oreilly books on VB.net they are quite good, but if you want to be pro and have the time...
You can try out MSDN forums, help other people and discuss with them hard and complex problems, I think it's the best way..
learn another language. even if you won't use it, it's great for mind-opening.
I'd advice Lua, Scheme and Python. but almost anything else would do. (the most different from C, the best)
Josuttis and Vandevoorde - Templates: The Complete Guide
As I see, nobody mentioned Bruce Eckel brilliant books "Thinking in C++". IMHO, it`s one of the best books to start your C++ development from. From my point of view, first volume is more helpful that the second, but both of them worth reading.
http://www.amazon.com/Thinking-C-Introduction-Standard-One/dp/0139798099/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1227890306&sr=8-1
I lot of folks can suggest more modern, up-to-date books. But I still recommend The Annotated C++ Reference Manual by Margaret A. Ellis & Bjarne Stroustrup.
The ARM was published back in '90. It's become somewhat outdated with respect to templates. STL is (obviously) absent. (Though the website at sgi.com does a good job of covering STL!)
However, the ARM is dirt cheap (used). (Shipping will exceed the cost of the book.) Its signal-to-noise ratio remains off the scale. It's very good at digging into C++'s dirty areas, explaining what was done & why.
I still use it as a reference. I rank it up there with K&R.
Dietel/Dietel "How to program C++"... I still have this book on my desk (10 years in).. Every once and a while I re-read a chapter. I'd definatly get the Code Complete, as other have suggested. Infact read that first.
To get a better understanding of object orientation, spend some time in a Smalltalk. Squeak is a free download. Then read Richard P. Gabriel's Patterns of Software and thereafter his Objects have Failed.
Thinking in C++ - Bruce Eckel
Symfonia C++ Standard - Jerzy Grębosz
If you do nothing else, program.
When you are not doing that read about programming and when something strikes you as interesting, go implement something with that knowledge. I've found that this is the only way to really set the principals.
Staying up to date on blogs can be fun, but it is scattered knowledge. It seems to distract more than help. But combined with google and a desire to research something specific can really cough up tons of information. But dont' just subscribe to alot of rss feeds and expect to get better.
I think really studying specific topics helps expand your ability. Research topics that intrigue you, meet people doing things like you (conferences, user groups, irc, facebook, stackoverflow, etc) and above all practice your art.
You can check out the Boost library and a number of the books written about it. While this may not have been what you had in mind, IMO, the Boost libraries are examples of well-designed modern C++ libraries that use the features of the language in pretty much the way they should be used to create among the most effective solutions for their problem domain. Granted of course, there are bizarre libraries like preprocessor and MPL which make you wonder if you'll ever have any use for them, but they're all round quite good. From my own experience, exploring the library and its literature has given me insight into how C++ can be used effectively.
Boost
Beyond the C++ Standard Library: An Introduction to Boost