nand2tetris
mal
nand2tetris | mal | |
---|---|---|
9 | 94 | |
46 | 9,808 | |
- | - | |
4.4 | 0.0 | |
8 months ago | about 1 month ago | |
F# | Assembly | |
- | GNU General Public License v3.0 or later |
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.
nand2tetris
-
OCaml at First Glance
Yes, please do! Warning: F# will ruin other languages for you. I find it rather painful to work in basically anything else after using F#, with gradients of pain for different languages. Haha.
And that's a good question. I have basically every book written on F#, but I can't say I have ever used them for anything more than reference.
The official docs/guide/reference are actually really good, and I refer to them a lot when using some feature I'm not familiar with: https://docs.microsoft.com/en-us/dotnet/fsharp/what-is-fshar...
F# For Fun and Profit is well-known, but I can't say I use it a lot: https://fsharpforfunandprofit.com/
The same author's (Scott Wlaschin) book is very good: https://pragprog.com/titles/swdddf/domain-modeling-made-func...
As for books, I have always liked:
* Functional Programming Using F# by Hansen and Rischel (might be too simple if you are already comfortable with functional programming and is out of date every now and then with changes to F# that's happened)
* Expert F# 4.0 by Don Syme and others (contains a lot of nice things by the designer of F#
One of the latest books is Stylish F# 6: Crafting Elegant Functional Code for .NET 6 by Kit Eason. I have the first edition but haven't read it.
My personal recommendation is to take the approach of type/domain driven design. That is, I start off every F# module the same:
1. Define my types with discriminated unions, records, type aliases (such as for tuples) or single case discriminated unions. Use classes when necessary but try to prefer the more functional types.
2. Start writing functions against these.
And that's basically it. One thing to recognize with F# is that it mixes OOP rather nicely. Even discriminated unions and records, which are immutable, can have members defined on them, including operator overloading (something F# is pretty good about). They can even implement interfaces and be defined with generic types, which is also nice and powerful.
I have some projects that might of interest, since they're simple enough and illustrate the above process.
https://github.com/bmitc/the-ray-tracer-challenge-fsharp
https://github.com/bmitc/nand2tetris
Lastly, I'd suggest just starting up some projects. You could also take the Programming Languages course on Coursera by Dan Grossman. Part A uses SML, and you could port the examples and homework solutions to F# (I did so when I took the course). I also take books written for other languages and port the code to F#, usually taking a more idiomatic functional style. .NET Interactive notebooks (https://github.com/dotnet/interactive) are a great way to get started. You just need to install the .NET 6 SDK (which gets you F#) and then install the .NET Interactive Notebook extension in VS Code. That's it. There is also the book The Little MLer which gets people comfortable with discriminated unions (sum types), and I used the book and ported the examples to F#. I need to go back and finish that annotation project (https://github.com/bmitc/the-little-fsharper). I'll probably convert the script files to .NET Interactive notebooks if I do.
- Really great example projects?
- What are F#'s advantages?
-
Learning FPGA design, specifically creating a computer.
See references here: https://github.com/bmitc/nand2tetris
- Recommended books/online courses for getting in FPGA/VHDL?
-
Can anyone suggest any interesting F# projects?
One project I have been doing is implementing the software stack from the Nand2Tetris course in F#. You can find my repository here: https://github.com/bmitc/nand2tetris
-
The Elements of Computing Systems, Second Edition
I love this book (the first edition), project, and course.
It is incomplete, but I thought I would share my implementation of the software stack in F#. Currently, only the assembler is implemented, but in my personal opinion, I think it showcases the beauty of F# for domain modeling. When I return to the project, I hope to restart the VM implementation and continue adding to the FPGA implementation as well. My eventual goal is to have the entire software stack built using F# that can than be run on an FPGA implementation of the CPU.
https://github.com/bmitc/nand2tetris
-
making illegal states unrepresentable with types
I even have a comment mentioning this: https://github.com/bmitc/nand2tetris/blob/3e145df44a97e2df094c585a1e97b7b1713dc582/dotnet/Nand2Tetris/Assembler/Types.fs#L90
-
Don Syme on why C#'s new pattern matching is a bad design
If you scroll down to #2 in this repository, I show an example of active patterns in use. The active pattern is defined here. This particular active pattern is described in the docs even, but I find it extremely useful for parsing. It basically allows you to build a sane parser that takes in a string and maps it, via regular expressions, to a discriminated union. That means that your parsing step will generate known types that can be exhaustively pattern matched, making it basically impossible for your downstream functions to have an error due to an unhandled parsing step.
mal
-
Ask HN: Is Lisp Simple?
>Would be interesting to see how the interpreter works actually...
It's quite easy to see, there are interpeters for Lisp in like 20 lines or so.
Here's a good one:
https://norvig.com/lispy.html
(It has the full code in a link towards the bottom)
There's also this:
https://github.com/kanaka/mal
- GitHub - kanaka/mal: mal - Make a Lisp
-
Build Your Own Lisp
Here is one implementation of a lisp (mal specifically) in matlab: https://github.com/kanaka/mal/blob/dcf8f4d7b9cf7b858850a04a0...
Only 260 lines of code, pretty concise :)
-
Found inside my compiler I've been writing for about 2 years
have a look at the crafting interpreters book, plus make a lisp (lisp is a great first language to make a compiler/interpreter for, just google "lisp compiler/interpreter" and you'll find lots of resources)
- Ce proiecte for-fun ati facut in timpul facultatii ca sa invatati ceva nou si practic singuri?
-
Crafting Interpreters or Writing an Interpreter in Go? Given context
If you're really okay with the limitations of a tree-walk interpreter, you might want to check out MAL, which will teach you how to write a tree-walk interpreter for a LISP. The code for MAL has been translated to most popular languages, so you can work through the creation of an interpreter in the language of your choice. JLox would give you a bit more detail and a more complex language, but I'm not convinced that it's all that important.
-
What do I do now?
Write a small programming language (lisp (https://github.com/kanaka/mal) or brainfuck) in C++ to learn the syntax more. This will teach you a lot about programming languages in general.
- Ask HN: What projects did you build to get better as a programmer?
-
Can you beat my dad at Scrabble?
So I started some hobbyist game dev using Unity and realised that the full process of making a game has dependencies on a mass of lower-level skills including lighting virtual environments. As a hobbyist photographer I could see some useful analogies from lighting studios and other scenes
So I pivoted, and eventually made money, not from selling a game, but from developing tutorials about digital lighting. I was also able to contribute to a project at work that was making a product based on commercial games engine, not by actually coding it, but by helping to better estimate the costs of the asset generation required.
Coding Unity object scripts in C# also got me back into programming, and I went on to successfully build a self-hosting lisp interpreter following the Make a Lisp guidelines [0].
[0] https://github.com/kanaka/mal/blob/master/process/guide.md
-
Advice for a first-time designer of my own original programming language? Presently writing the interpreter!
Hijacking the top comment to add https://buildyourownlisp.com and https://github.com/kanaka/mal
What are some alternatives?
the-ray-tracer-challenge-fsharp - F# implementation of the ray tracer found in The Ray Tracer Challenge by Jamis Buck
paip-lisp - Lisp code for the textbook "Paradigms of Artificial Intelligence Programming"
fslang-suggestions - The place to make suggestions, discuss and vote on F# language and core library features
Lua - Lua is a powerful, efficient, lightweight, embeddable scripting language. It supports procedural programming, object-oriented programming, functional programming, data-driven programming, and data description.
WebApiTest - Sustainable Web API written in F# that showcases the language's strengths via a functional style.
sectorlisp - Bootstrapping LISP in a Boot Sector
CardManagement
project-based-learning - Curated list of project-based tutorials
adventofcode - Advent of Code solutions of 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 and 2023 in Scala
hy - A dialect of Lisp that's embedded in Python
UnionArgParser - A declarative CLI argument parser for F#
wisp - A little Clojure-like LISP in JavaScript