Arc Forumnew | comments | leaders | submit | zck's commentslogin
4 points by zck 46 days ago | link | parent | on: Tell Arc: Arc 3.2

Whoa, that's awesome. Thanks!

Anything we can do to help get more Arc out?

reply

3 points by zck 83 days ago | link | parent | on: About lobste.rs

I've never signed up for lobste.rs. Could I get an invite? What do you need to invite me? (email in profile)

-----

3 points by akkartik 82 days ago | link

I'll invite you.

-----

3 points by zck 82 days ago | link

Thanks! I'll spend some time checking it out. :)

-----

3 points by zck 92 days ago | link | parent | on: With and withs

Similarly to this, when I'm writing Java, I use `final`^1 everywhere I can. It's nice to be able to know that anywhere later where the variable declared final is in scope, it will have the same value as at the point it's set. I don't need to look through any code to see if it's rebound; I know it hasn't been.

[1] "final" is kind of like "const", if I understand `const` right. `final int x = 3;` means that it is an error to later have the line of code `x = 4;`.

-----

2 points by zck 97 days ago | link | parent | on: Installation on windows?

I wish arc had better integration with Emacs. I'd love a SLIME/Cider-style integration. With infinite time, I'd like to write one.

-----

3 points by zck 97 days ago | link | parent | on: Vouch

> Maybe is just needs to be dead first.

Yeah, if you have enough karma, you can see "vouch" links on dead submissions. The easiest way to see this is to go to https://news.ycombinator.com/newest; many of those links will be dead.

-----

3 points by hjek 95 days ago | link

So you need to have `showdead` enabled for vouch to ever be visible, I guess?

-----

4 points by zck 102 days ago | link | parent | on: Anarki Reference Documentation

Very cool! I might make some changes, like links, categories, a TOC.

Obviously feel free to make any of these; I'm not sure when I'll get to them.

-----

3 points by rocketnia 100 days ago | link

Yeah, these would be great! I focused on shipping something, but there are many ways it can be improved. :)

-----

4 points by zck 109 days ago | link | parent | on: Separation of concerns

> Run the unit tests.

Certainly a lot of things could be tested more; this would help.

But also, we might want to set Github to require the tests to pass on a PR before letting it be merged. I could be wrong, but I think a PR can be merged even if the tests fail.

This is a slight step away from "anyone can commit anything", I acknowledge. But it's also a step towards stability. At least the person would have to fix or delete the failing tests before merging.

-----

5 points by rocketnia 109 days ago | link

Fixing other people's test breakage is one of the only things I can do for Anarki that doesn't make me feel like I'm breaking things myself. :-p

-----

4 points by zck 107 days ago | link

Well, it's a great help! Writing tests can help too, but just being around and helping is wonderful.

-----


Arc is definitely not going to be able to use IOLib. If you want to find some libraries, you might be able to use some Racket libraries.

I'm not sure if you're looking to write the server component, or the code that contacts the server.

If you want to make a webpage that returns the current date and time, it's either straightforward or complicated, depending what exactly you want.

If you want a webpage that returns the current date and time _in UTC_, it's straightforward:

    arc> (thread (serve 8080))
    #<thread>
    arc> ready to serve port 8080
    arc> (defop hello req (let (sec min hour day month year) (timedate) (prn year "-" month "-" day " " hour ":" min ":" sec)))
    #<procedure: g20474>
If you want it in your local timezone, that's more complicated. You might have to pull in Racket libraries.

-----

3 points by akkartik 149 days ago | link

I just went through this exercise as well. Once you define the server, you can then query it with this code:

    arc> (load "lib/client.arc")
    arc> (cdr (mkreq "http://localhost:8080/"))

-----

3 points by zck 149 days ago | link

Ooh, interesting! We might want to figure out a long-term documentation system for Anarki; the existing arclanguage.github.io documentation is for Arc 3.1. And while that's great, it's suboptimal for cases like this, because it says "...there is no support for outgoing network connections." (https://arclanguage.github.io/ref/networking.html).

-----

2 points by akkartik 149 days ago | link

Yeah, there's a reason why the documentation isn't linked on the right side at http://arclanguage.github.io :/

-----

3 points by christianbryant 149 days ago | link

How about UDP calls? I sucked this CL snippet a while back (sorry I don't have the author info at hand). Creates a socket, sends data and receives data:

  (defun create-client (port buffer)
     (let ((socket (usocket:socket-connect "127.0.0.1" port
					 :protocol 
                                         :datagram
					 :element-type 
  '(unsigned-byte 8))))
    (unwind-protect
	 (progn
	   (format t "Sending data~%")
	   (replace buffer #(1 2 3 4 5 6 7 8))
	   (format t "Receiving data~%")
	   (usocket:socket-send socket buffer 8)
	   (usocket:socket-receive socket buffer 8)
	   (format t "~A~%" buffer))
      (usocket:socket-close socket))))

-----

2 points by hjek 123 days ago | link

Check the Racket docs on UDP[0]. Arc itself is very high-level, but you can do more low-level stuff via Racket interop.

[0]: https://docs.racket-lang.org/reference/udp.html

-----

2 points by christianbryant 149 days ago | link

Appreciate it. I want to just write the code that contacts the server. Some Python pseudocode to represent the basics is below, but that just represents basic socket foo, minus the code for authentication, etc. The code would run through a list of 20+ systems and just connect one by one and log that system's local datetime. The assumption is we're doing UDP communication.

  client = socket
  host = local_system
  data = datetime_query
  remotedata = datetime_response
  target = remote_system

  client.connect (remotehost, port)
  client.send (data, target)
  remotedata.receive (remotedata, host)

  if remotedata:
	print 'Remote system date and time is:', remotedata
	else print 'No data received.'

-----


Also on reddit: https://www.reddit.com/r/lisp/comments/8z34az/anarki_communi....

-----

3 points by zck 313 days ago | link | parent | on: Next steps

> My first thought is a package system based on melpa / use-package from emacs.

That would be great! Use-package is amazing, and that (combined with similar loading things from package.el) could make loading dependencies way easier. I know that when I'm writing arc code, I'm reluctant to use libraries -- even libraries included with arc -- because they're (afaik) impossible to automatically load.

> We could also experiment with some avant garde packaging ideas, such as akkartik's thoughts on avoiding version pinning...

Amusingly, the Emacs ecosystem can be thought of as a package manager that avoids version pinning; the standard package repositories (GNU Elpa, Melpa) only keep the latest version of a package around; you can't install older versions.

Of course, I know of no package foo.el that introduced _foo2.el_ when breaking backwards compatibility. So we can maybe do better that way.

-----

More