Earlier quoted context omitted.
Here, calling `.Last()` on `ArrayStack ` traverses it from the start. `.Last()` is a static extension method defined on `System.Linq.Enumerable` class and has a signature `static T Last (this IEnumerable source)`. Internally, `.Last()` will try to optimize for the common cases where a type implements `IList ` and uses an indexer to simply get the last element. However, because ArrayStack does not implement IList , .L…
Just the kind of information/expertise I was looking for, awesome!
Show HN: Lisp in C#
11–20 of 70 posts
Re: Show HN: Lisp in C#
#12Earlier quoted context omitted.
Here, calling `.Last()` on `ArrayStack ` traverses it from the start. `.Last()` is a static extension method defined on `System.Linq.Enumerable` class and has a signature `static T Last (this IEnumerable source)`. Internally, `.Last()` will try to optimize for the common cases where a type implements `IList ` and uses an indexer to simply get the last element. However, because ArrayStack does not implement IList , .L…
Just the kind of information/expertise I was looking for, awesome!
Re: Show HN: Lisp in C#
#13Author here. I'm afraid I've been out of the C# loop too long to know what's fast and what isn't these days. Now that maybe I have the attention of some serious C# nerds, any assistance in making this thing run faster would be much appreciated. It's not terrible atm, given a managed host language, but I'm sure there are plenty of knobs left to turn. See the benchmarks section in the README for more info, and the same…
We just roughly doubled the speed by changing one line of code, that means there's plenty more fun before it gets really tricky.
My issue isn't really profiling, its not knowing enough about the platform to do anything constructive with the hot spots.
Re: Show HN: Lisp in C#
#14Re: Show HN: Lisp in C#
#15I don't much like the odds of Lisp vs. Nintendo hardware kickstarters.
Re: Show HN: Lisp in C#
#16It's worth mentioning https://github.com/IronScheme/IronScheme
Curious though, I'm pretty sure it emits MSIL rather than its own bytecode like sharpl? So that would be one difference, in most cases an advantage because of performance.
The other obvious difference is I'm not aiming for any standards, quite the contrary; this is about being so fed up with the alternatives (including Scheme) that spending the rest of my life getting it just right looks like a reasonable deal.
Re: Show HN: Lisp in C#
#17Author here. I'm afraid I've been out of the C# loop too long to know what's fast and what isn't these days. Now that maybe I have the attention of some serious C# nerds, any assistance in making this thing run faster would be much appreciated. It's not terrible atm, given a managed host language, but I'm sure there are plenty of knobs left to turn. See the benchmarks section in the README for more info, and the same…
https://github.com/codr7/sharpl/pull/1 Was: 686 98 1195 Now: 226 79 293 (with net9.0 preview: 201 70 269, another release another free >10%) The reason for such a significant difference is that `ArrayStack ` only implements `IEnumerable `, which prevented the Enumerable.Last(stack) call from seeing that the type has an indexer which can be used to quickly access the last element instead of traversing it in its entire…
Re: Show HN: Lisp in C#
#18Earlier quoted context omitted.
https://github.com/codr7/sharpl/pull/1 Was: 686 98 1195 Now: 226 79 293 (with net9.0 preview: 201 70 269, another release another free >10%) The reason for such a significant difference is that `ArrayStack ` only implements `IEnumerable `, which prevented the Enumerable.Last(stack) call from seeing that the type has an indexer which can be used to quickly access the last element instead of traversing it in its entire…
Alternatively ArrayStack could be modified to implement IList right?
Re: Show HN: Lisp in C#
#19years ago someone posted http://norvig.com/lispy.html here on HN I wrote a lisp in C# based on that, it was only a 100+ ish lines of code. It was a great way to get into Lisp.
I started out designing Forth interpreters, actually calculators and template engines, but Forth was a natural progression.
My design differs a lot from idiomatic Lisp implementations (likewise Forth), and I do sometimes wonder what it would look like if you started in that end and worked your way towards supporting all the features of sharpl.
Re: Show HN: Lisp in C#
#20years ago someone posted http://norvig.com/lispy.html here on HN I wrote a lisp in C# based on that, it was only a 100+ ish lines of code. It was a great way to get into Lisp.
I just went through it over 2-3 days, great practice IMHO to do once in your life from start to finish: https://github.com/metaleap/go-lisp