Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various work #145

Closed
wants to merge 1 commit into from
Closed

Various work #145

wants to merge 1 commit into from

Conversation

shawwn
Copy link
Member

@shawwn shawwn commented Jan 22, 2019

  • Arc lists are now scheme lists. No more niltree/denil
  • Use racket's REPL, letting users type ^C without exiting the program (this is handy for interrupting a long-running computation)
  • Add a STR function that prints things out nicely[1]

[1] ... well, for some definition of "nicely".

This PR should not be merged. I'm submitting it because it's mostly-working and it has some interesting ideas. The STR function
spits out a string like this:

["%tag", "tem", ["item", {by: "shawn", 
               id: 140, 
               ip: "2600:6c40:5e00:1714:0:8f0e:424f:e94d", 
               keys: ["nokill", "/l/scp", "/l/writing", "/l/humor"], 
               kids: [141], 
               score: 1, 
               sockvotes: 0, 
               text: "", 
               time: 1545781744, 
               title: "SCP-1933", 
               type: "story", 
               url: "http://www.scp-wiki.net/scp-1933", 
               votes: [[1545781744, "2600:6c40:5e00:1714:0:8f0e:424f:e94d", "shawn", "up", 0]]}, {}]]()

Obviously this isn't readable by racket, and it's not readable by a JSON reader, ~and it's not very readable by humans~~.

Feel free to "test" this "dev version", if you dare. It's kind of neat in some ways but kind of bad in other ways.

- Arc lists are now scheme lists. No more niltree/denil
- Use racket's REPL, letting users type ^C without exiting the program
  (this is handy for interrupting a long-running computation)
- Add a STR function that prints things out nicely[1]

[1] ... well, for some definition of "nicely".
@akkartik
Copy link
Member

I too have been thinking about my old akkartik/arc@c5f528cb6a

@shawwn
Copy link
Member Author

shawwn commented Jan 22, 2019

Let’s do it IMO. Did it cause problems?

There are two points in favor of axing niltree: it makes interop with racket infinitely easier, and opens the way for keyword arguments. And the other point is that laarc’s codebase has already done this about 10 days ago without exploding.

I was shall we say very “fn” nervous to deploy that change, but it’s gone well. The only place I notice diffs is on the repl (since nil is an empty list and prints () not nil) and when editing items (an empty list of flags shows up as () instead of nil on the page itself now).

But everything in general seems to just work. I haven’t been able to break it. But if it caused problems for anarki then let me know because it’ll bite me eventually.

Eventually I want to try turning predicate outputs from t nil to #t #f. This isn’t quite as crazy as it sounds. You end up only seeing the difference in Boolean / truthy contexts like <=, AND, etc. And somewhat shockingly, updating car cdr and cons to treat #f as empty list is enough for it all to work flawlessly*.

Without that, you’ll notice calling racket’s SORT wont work if you pass in a predicate, because racket only wants true and false. I initially got around that by writing (def tnil (x) (if x #t #f)) Which is fine, but it’s nice not to have to wrap all the interop code with it.

  • may not actually be flawless. symptoms include dry mouth, chills, and ok I’ll cut the humor.

@akkartik
Copy link
Member

I finally managed to dig up the thread where I originally proposed it: http://arclanguage.org/item?id=11723. Looking at it now I don't think there's any compelling reasons to not try it. I think I was scared away by Paul Graham stating a preference.

The only real incompatibility is (type nil). Currently it's sym. If we make nil evaluate to () that seems weird. But so does a type of cons. In my repo and later in Wart, I went the route of having the type of nil be nil. That seemed symmetric with car and cdr of nil. It was originally proposed by @waterhouse: http://arclanguage.org/item?id=12650.

Anyways, let's ask some of our existing users. I'll post this thread on the Forum.

@akkartik akkartik mentioned this pull request Jan 29, 2019
@kennethrapp
Copy link
Contributor

I just started a project for the forum. Might I suggest moving this to its own project, rather than sitting on a PR that's never intended to be merged?

@akkartik akkartik closed this May 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants