Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
LightMachine
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
39 ms
·
301.
▲
LJSON now has a safe parser
(maiavictor.github.io)
1 points
by
LightMachine
11y ago
|
0 comments
302.
▲
by
LightMachine
11y ago
I think it doesn't make sense for it not to be. It seems like a very good way to transfer data with almost no drawback given a decent setup. I don't understand why that isn't used more often.
303.
▲
by
LightMachine
11y ago
Mutable what?
304.
▲
by
LightMachine
11y ago
I added a file, `examples.js`, which shows how you can encode some array algorithms on λJSON. It may look extremely inexpressible due to so lack of loops, math, etc - but it is still able to encode any conceivable algorithm, although more c
305.
▲
by
LightMachine
11y ago
Ah, fair enough. The user should avoid using native JS constructs on the code to be stringified, though - it is an interesting/useful side effect of the method that you are able to, but ideally you would define your functions using onl
306.
▲
by
LightMachine
11y ago
There are many possibilities since you can pass any program/algorithm through LJSON while still having a good level of safety. You could it, for example, to allow your users to pick an AI strategy for their bots in a game, among billio
307.
▲
by
LightMachine
11y ago
Very good catch. Any suggestion how I could improve the usage of null for determining the end of a call list?
308.
▲
by
LightMachine
11y ago
There is no protection against non-termination. For example, an user could give you this function: f = (function (x){ return x(x); }) Now, if you call `f(function(f){return function(x){ return f(f(x)) }})`, it'll not halt. But
309.
▲
Show HN: LJSON: JSON extended with pure functions
(github.com)
39 points
by
LightMachine
11y ago
|
17 comments
310.
▲
by
LightMachine
11y ago
Done.
311.
▲
by
LightMachine
11y ago
The point of ADT syntax is to allow deriving many functions on different data structures automatically. For example, lists and some functions can be defined as: cons = (x list cons nil -> (cons x (list cons nil))) nil
312.
▲
Show HN: Caramel – a modern syntax for the lambda calculus
(github.com)
130 points
by
LightMachine
11y ago
|
22 comments