metacircular

How to implement a meta-circular evaluator to parse `[1..10]` in JavaScript?

大城市里の小女人 提交于 2020-08-10 19:15:09
问题 I want to implement a meta-circular evaluator in JS with support to functional programming. How can I parse this? [1..10] I want to receive 1 and 10 回答1: This is a basic implementation of generating a range. The goal you are talking about is going to be too complex for regex (firmly tongue in cheek). Using tagged template literal syntax. Regex finds two digit sequences, converts to numbers. Fills an array. range = (str,...args) => (([,min,max])=> Array(Math.abs(max-min)+1).fill(+min).map((_,i

Alan Kay's Eval/Apply Einstein Moment

江枫思渺然 提交于 2019-12-17 15:44:47
问题 Alan Kay said that reading the code closely and finding the 1 and only bug in the code on page 13 of the Lisp 1.5 manual, helped him understand Computer Science by a factor of 100 better. The code in question is the 1st release of eval & apply that looks anything remotely like modern lisp (that I'm aware of). Since the correct answer is likely known but lost (my google-fu is decent and I've searched for 20 mins at least) I will award the 1st correct answer (I will be looking at edit times so