GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

# Demonstrate significant-whitespace / "l0" syntax set 'x 3 set 'y 7 set 'array [ + y x - y x * y x / y x % y x ] set 'noop {return nil} set 'iter { set 'iter-array (get args 0) set 'iter-idx (get args 1) set 'iter-continue (has iter-array iter-idx) # Index exists? # Two functions: Noop does nothing; anonymous fn recurses iter. # Due to a language design oversight, to write [1,2] you must # write [return 1, return 2]. ("return" is identity combinator) set 'func-pair [ return noop, return { print "at idx: " iter-idx sp \ "value: " (get iter-array iter-idx) ln iter iter-array (+ iter-idx 1) }, ] (get func-pair (to-int iter-continue)) # Call function 0 or 1 }

Download link

https://files.mastodon.social/media_attachments/files/114/308/909/950/705/843/original/9c5c90a0da7b84fd.png

Notices where this attachment appears

  1. Embed this notice
    mcc (mcc@mastodon.social)'s status on Friday, 11-Apr-2025 03:06:44 JST mcc mcc
    in reply to

    Now, since *I'm* the one writing this LISP, I do get to make some changes. The main thing I wanted to change, as it's the #1 thing that infuriates me writing LISP, is parentheses. This "LISP" has a syntax where each line (as separated by newlines or commas) implicitly has () around it. Meanwhile, {} and [] are shorthand, for

    {x,y,z} => '((x)(y)(z))

    [x,y,z] => (make-array [(x),(y),(z)])

    In other words {} is functions (quoted lists) and [] is array literals.

    Is this still a LISP? I don't care!

    In conversation about a month ago from mastodon.social permalink
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.