pytudes
paip-lisp
Our great sponsors
pytudes | paip-lisp | |
---|---|---|
99 | 65 | |
22,331 | 7,005 | |
- | - | |
7.7 | 0.8 | |
2 days ago | 6 months ago | |
Jupyter Notebook | Common Lisp | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
pytudes
- SQL for Data Scientists in 100 Queries
-
Ask HN: Where do I find good code to read?
Peter Norvig's Pytudes was recently posted here. I think that's some of the best code I've read, although they're only small problems and not a bigger project. Still very much worth a read, he goes through the whole problem solving through code process.
-
Pytudes
I have the same impression. Reading the code, he uses global variables [1], obscure variable (k, bw, fw, x) and module names ("pal.py" instead of "palindromes.py"), doesn’t respect conventions about naming in general (uppercase arguments [2], which even the GitHub syntax highlighter is confused about). This feels like code you write for yourself to play with Python and don’t plan to read later.
Some parts of the code feel like what I would expect from a junior dev who started learning the language a couple weeks ago.
[1]: https://github.com/norvig/pytudes/blob/952675ffc70f3632e70a7...
[2]: https://github.com/norvig/pytudes/blob/952675ffc70f3632e70a7...
Kinda hard to answer as that depends on your definition of new. But most likely yes, https://github.com/norvig/pytudes/commits/main
-
Using Prolog in Windows NT Network Configuration (1996)
Prolog is excellent for bikeshedding, in fact that might be its strongest axis. It starts with everything you get in a normal language such as naming things, indentation, functional purity vs side effects, where to break code into different files and builds on that with having your names try to make sense in declarative, relational, logical and imperative contexts, having your predicates (functions) usable in all modes - and then performant in all modes - having your code be deterministic, and then deterministic in all modes. Being 50 years old there are five decades of learning "idiomatic Prolog" ideas to choose from, and five decades of footguns pointing at your two feet; it has tabling, label(l)ing, SLD and SLG resolution to choose from. Built in constraint solvers are excellent at tempting you into thinking your problem will be well solved by the constraint solvers (it won't be, you idiot, why did you think that was a constraint problem?), two different kinds of arithmetic - one which works but is bad and one which mostly works on integers but clashes with the Prolog solver - and enough metaprogramming that you can build castles in the sky which are very hard to debug instead of real castles. But wait, there's more! Declarative context grammars let you add the fun of left-recursive parsing problems to all your tasks, while attributed variables allow the Prolog engine to break your code behind the scenes in new and interesting ways, plenty of special syntax not to be sneezed at (-->; [_|[]] {}\[]>>() \X^+() =.. #<==> atchoo (bless you)), a delightful deep-rooted schism between text as linked lists of character codes or text as linked lists of character atoms, and always the ISO-Standard-Sword of Damocles hanging over your head as you look at the vast array of slightly-incompatible implementations with no widely accepted CPython-like-dominant-default.
Somewhere hiding in there is a language with enough flexibility and metaprogramming to let your meat brain stretch as far as you want, enough cyborg attachments to augment you beyond plain human, enough spells and rituals to conjour tentacled seamonsters with excellent logic ability from the cold Atlantic deeps to intimidate your problem into submission.
Which you, dear programmer, can learn to wield up to the advanced level of a toddler in a machine shop in a mere couple of handfuls of long years! Expertise may take a few lifetimes longer - in the meantime have you noticed your code isn't pure, doesn't work in all modes, isn't performant in several modes, isn't using the preferred idiom style, is non-deterministic, can't be used to generate as well as test, falls into a left-recursive endless search after the first result, isn't compatible with other Prolog Systems, and your predicates are poorly named and you use the builtin database which is temptingly convenient but absolutely verboten? Plenty for you to be getting on with, back to the drawing boar...bikeshed with you.
And, cut! No, don't cut; OK, green cuts but not red cuts and I hope you aren't colourblind. Next up, coroutines, freeze, PEngines, and the second 90%.
Visit https://www.metalevel.at/prolog and marvel as a master deftly disecting problems, in the same way you marvel at Peter Norvig's Pytudes https://github.com/norvig/pytudes , and sob as the wonders turn to clay in your ordinary hands. Luckily it has a squeaky little brute force searcher, dutifully headbutting every wall as it explores all the corners of your problem on its eventual way to an answer, which you can always rely on. And with that it's almost like any other high level mostly-interpreted dynamic programming / scripting language.
-
Git and Jupyter Notebooks Guide
I think it depends a lot on what your git repository is.
If it's specifically source code for anything that's intended to run, then avoiding including the outputs is a smart move. But then, if that's the case, there's a good chance you'd just be committing a .py file.
I like notebooks because they include output alongisde input. For example, Peter Norvig's Pytudes are all brilliant, quick notebooks that solve a particular puzzle[0]. The code itself might not be that interesting to run (unless you really want to confirm his strategy for wordle checks out) but reading through the notebooks makes for a great experience of simultaneously understanding his thought process, and seeing the solution.
I do a bunch of generative art stuff and have recently been experimenting with using notebooks as quick sketches[1]. I really like the workflow and end up with something like a journal that isn't necessarily intended to be ran repeatedly, but read over, where I can see the visual output created, as well as the method for it.
[0] Norvig's extremely cool pytudes, wordle example: https://github.com/norvig/pytudes/blob/main/ipynb/Wordle.ipy...
- Ask HN: What are some of the most elegant codebases in your favorite language?
-
The Law of Large Numbers, or Why It Is a Bad Idea to Go to the Casino
I love how lightweight and interactive this is.
Related: Norvig's runnable intro probability notebooks at https://github.com/norvig/pytudes#pytudes-index-of-jupyter-i...
paip-lisp
-
Ask HN: Guide for Implementing Common Lisp
PAIP by Peter Norvig, Chapter 23, Compiling Lisp
https://github.com/norvig/paip-lisp/blob/main/docs/chapter23...
-
Towards a New SymPy
Sounds like a great project idea to make a toy demo of this direction you'd like to see. Maybe comparable to https://github.com/norvig/paip-lisp/blob/main/docs/chapter15... and https://github.com/norvig/paip-lisp/blob/main/docs/chapter8.... which are a few hundred lines of Lisp each, but do enough to be interesting.
-
A few newbie questions about lisp
You could look into Paradigms of AI Programming by Peter Norvig which might interest you regardless of Lisp content.
- Peter Norvig – Paradigms of AI Programming Case Studies in Common Lisp
-
A lispy book on databases
Origen: Conversación con Bing, 4/4/2023(1) gigamonkey/monkeylib-binary-data - GitHub. https://github.com/gigamonkey/monkeylib-binary-data Con acceso 4/4/2023. (2) paip-lisp/chapter4.md at main · norvig/paip-lisp · GitHub. https://github.com/norvig/paip-lisp/blob/main/docs/chapter4.md Con acceso 4/4/2023. (3) bibliography.md · GitHub. https://gist.github.com/gigamonkey/6151820 Con acceso 4/4/2023.
-
sbcl and Let Over Lambda
Worth mentioning it is on github with corrected code (I've already run into mistakes in the printed version) https://github.com/norvig/paip-lisp
-
The Janet Language
Reading Peter Norvig's PAIP (https://github.com/norvig/paip-lisp) in 1998 totally blew my mind. It completely changed how I think about programming in every other language I use(d). I love it still, and always will. And yes, my experience is the same as yours: learning lisp made me a better programmer in every other language I use (especially -- but not only -- Python).
The simplicity and symmetry of the syntax is a big part of that love for me. Being able to manipulate lisp code as lisp data, using the full power of the language to do so, is just brilliant.
Janet looks lovely! Looking forward to the book.
-
How exactly would you go about writing a program to simplify algebraic expressions?
PAIP has some chapters on this. Here is one: https://github.com/norvig/paip-lisp/blob/main/docs/chapter8.md
-
A Few Examples of Lisp Code Typography
For Common Lisp, there are several free books available:
- Practical Common Lisp (aimed at people who know how to program in a more mainstream language already) [1]
- Paradigms in Artificial Intelligence Programming (my personal favorite) [2]
- Common Lisp: A Gentle Introduction to Symbolic Computation (aimed at absolute beginners of programming) [3]
I highly recommend the r/lisp reddit community. Reddit as a platform has its issues, but the (Common) Lisp community there is very responsive and very helpful.
Lastly, you might be interested in checking out a game written entirely in Common Lisp, to be released imminently on Steam. It's called Kandria, and it's effectively 100% Lisp. [4]
[1] https://gigamonkeys.com/book/
[2] https://github.com/norvig/paip-lisp
-
Common Lisp vs Racket
https://github.com/norvig/paip-lisp - Peter Norvig's Paradigm's of AI Programming
https://github.com/norvig/paip-lisp/search?l=Markdown&q=defm... - all references to defmacro in the markdown files
Chapter 3 shows a simple macro, just adding a while loop to the language.
Chapter 9 shows some more complex ones, including a with- macro and a grammar compiler macro.
Chapters 11 and 12 show the development of a Prolog implementation in CL using defmacro to aid in compilation again in Chapter 11.
Chapter 12 shows adding an OO system to the language. Technically not needed with CLOS, but a good demonstration of what can be done with macros.
There are other examples (why I included that search link). Macros let you change the language in ways large and small. Many uses could probably be replaced with functions, though you'd end up having to throw a bunch of quotes about or closures in order to delay processing things.
What are some alternatives?
mal - mal - Make a Lisp
30-days-of-elixir - A walk through the Elixir language in 30 exercises.
Crafting Interpreters - Repository for the book "Crafting Interpreters"
coalton - Coalton is an efficient, statically typed functional programming language that supercharges Common Lisp.
picolisp-by-example - The source code of the free book "PicoLisp by Example"
slime - The Superior Lisp Interaction Mode for Emacs
common-lisp-by-example - Repo for Common Lisp by Example [Moved to: https://github.com/ashok-khanna/lisp-notes]
babashka - Native, fast starting Clojure interpreter for scripting
asgi-correlation-id - Request ID propagation for ASGI apps
deprecated-coalton-prototype - Coalton is (supposed to be) a dialect of ML embedded in Common Lisp.
janet - A dynamic language and bytecode vm
julia - The Julia Programming Language