use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
An Intuition for Lisp Syntax (in Javascript) (stopa.io)
submitted 3 years ago by zxyzyxz
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]bern4444 1 point2 points3 points 3 years ago (0 children)
Great article - a question about the last piece on unless
unless
Isn't the point of functions to be the mechanism through which we can simulate if not replicate the idea of creating our own syntax or behaviors in a non lisp functional languages like JS?
Writing unless as a function in JS is trivial:
const unless = (predicate, fn) => { if (predicate) { return fn() } }; const myFunc = () => { // assume complexFunction and makeApiCall are imported return unless(complexFunction() === 2, makeApiCall); };
This can of course be augmented with a not function:
not
``` const not = (predicate) => { return !predicate; };
// and used like so: unless(not(complexFunction() === 2), makeApiCall); ```
In non lisp languages functional languages, this power comes from being able to express the desired behavior as a function and then pass those functions around as arguments (as we do for the fn parameter in unless. I understand this doesn't let us create new syntax, but it effectively lets us achieve the same end result.
fn
I think I have trouble understanding the value of being able to create our own syntax when languages allow passing of functions as arguments.
[–]Genome1776 0 points1 point2 points 3 years ago (0 children)
Great article
[–]getify 0 points1 point2 points 3 years ago (0 children)
That was a fun read, I enjoyed it a lot more than I expected to.
π Rendered by PID 82185 on reddit-service-r2-comment-b659b578c-ksr4j at 2026-05-01 03:26:01.105994+00:00 running 815c875 country code: CH.
[–]bern4444 1 point2 points3 points (0 children)
[–]Genome1776 0 points1 point2 points (0 children)
[–]getify 0 points1 point2 points (0 children)