Arc Forumnew | comments | leaders | submitlogin
4 points by highCs 3902 days ago | link | parent | on: Bin from arc

Yup it's with top-of-tree Anarki on github using racket downloaded this weekend (70Mb install) under windows 8. Oh by the way, arc/anarki doesnt seems to run with "Racket minimal" (5Mb install).

I've used both mzc (from racket) and raco.exe, same error message. (I've tried to run create-embedding-executable from repl without success because I've not figured out how to call that correctly.)

Racket/Arc think the symbol is not bound - the symbol being the first symbol in arc.arc coming from scheme (xref disp). It's yet-another error due to namespace+eval I think.

I think it almost works. It creates an exe and calls everything. There is just that namespace thing to fix - hopefully nothing bad gonna happen after that. I've not figured out how to solve this though. Tried many combinations of current-namespace-pass-to-eval...

2 points by akkartik 3902 days ago | link | parent | on: Bin from arc

Wow, that is from before the racket days. Were you trying it with mzc or racket? Were you trying it with arc 3.1? I wonder if the original post was with an earlier version..

Found on HN via https://blog.ycombinator.com/y-combinator-is-hiring-hackers (comments: https://news.ycombinator.com/item?id=10465852)

As the blog post says, HN still is Arc, but not software used to run YC.

I'd be really interested what tools YC has built for itself.


Sadly nobody here has access to official arc or this forum :/

Thanks for that list! Maybe we should point people to the stable branch rather than vanilla arc 3.1 at http://arclanguage.github.io?

Edit 1 hour later: Check out the updated frontpage. Feel free to revert or ask me to do so.


"Does Arc 3.1 run properly though on MzScheme 372 or does it need to run on Racket?"

The only problem I've had running on MzScheme 372 is that it can be awkward to track down documentation for that version. Newer versions sometimes have more features available.

Arc doesn't have all the I/O primitives that Racket has -- Racket has an almost ridiculous variety of primitives for file manipulation, sockets, garbage collection, delimited continuations, FFI, concurrency, UI, etc. -- so Arc programmers have often hacked on the language implementation to support their applications. This hacking happens in Racket (aka MzScheme), so having a nice version of Racket is helpful.


Anarki's "stable" branch is Arc 3.1 plus 15 extra commits (so far). There's a list of all the commits here:

https://github.com/arclanguage/anarki/commits/stable

I actually thought there were more crucial bug fixes on this branch, like akkartik said, but it seems that the rest of the commits are various improvements to Arc's usability from editors and from the command line.

Here's a holistic summary of the changes, so you don't have to trudge through the commits one by one:

- Adds a CHANGES/ directory which is supposed to host a summary of changes like this one. Anarki's master branch makes use of this directory, but so far it's been neglected on the stable branch. (I should probably add this list to it!)

- Adds an extras/ directory containing Vim and Emacs extensions.

- Adds arc.sh, a nicer way to run Arc from the command line. (Many of the other changes were made to support this.)

- Doesn't display the REPL when stdin is not interactive. (https://github.com/arclanguage/anarki/commit/eb55979588bb01d...)

- Outputs error messages to stderr rather than stdout. (https://github.com/arclanguage/anarki/commit/e518e3b323a63bc...)

- Makes it possible to execute Arc at the command line from directories other than the Arc directory. (https://github.com/arclanguage/anarki/commit/4df89245bb49ae2...)

- Interprets command line arguments as filenames of Arc scripts to load. (https://github.com/arclanguage/anarki/commit/5ac5d567bce0800...)

- Fixes a bug where mutating a list would sometimes fail depending on the state of the garbage collector. (https://github.com/arclanguage/anarki/commit/b683a84a6831fd4...)


That's awesome that you've introduced it to that many people. I haven't really been able to get people interested more than tangentially. Good for you.

>Does Arc 3.1 run properly though on MzScheme 372 or does it need to run on Racket?

I haven't tried running it on MzScheme 372; once I could just use the most recent version of Racket, I decided to just do that. It seems easier than staying on an old version.


Great - I was wondering, what is the specific difference between the anarki branch and arc 3.1 provided at /install?

zck: I would probably say about ten to fifteen people. I was working on designing a LISP/ML like language which had a lot of similarities to Arc, so I went on a bit of an Arc binge and showed it to a bunch of friends at school. I found that it was a little difficult for some people to set up.

Does Arc 3.1 run properly though on MzScheme 372 or does it need to run on Racket?


Thanks rocketnia - sorry I was afk for a few days. I had no idea that installation details changed. Is it possible to update the instructions on /install? I may update my setup to install racket first. Thanks!

Some gotchas to be aware of with arc 3.1: https://sites.google.com/site/arclanguagewiki/arc-3_1/known-...

In particular the second issue will cause random failures so it's worth guarding against. The stable branch of anarki has it along with a few other crucial bugfixes to arc 3.1.


Thanks for putting up with the installation instructions you found, and thanks for trying to make life easier for the next person. :)

The instructions at /install are actually more than six years out of date. As of August 2009 (http://arclanguage.org/item?id=10254), Arc officially stopped depending on MzScheme 372. Shortly after that, the official releases of the language ran dry, and the Arc website (this website) entered a more preservational mode of maintenance. It even preserves those obsolete instructions!

Development of Arc continues thanks to unofficial efforts like yours. The most up-to-date material for Arc newcomers is on a community-maintained website: http://arclanguage.github.io/


Interesting. How many people have you gotten into Arc? You mention that you "found it difficult to explain to beginners how to get an Arc REPL up and running".

Arc 3.1 actually doesn't require an old version of mzscheme -- you can just use racket, and start it with `racket -f as.scm`. And no, the instructions on this site don't say anything about that.

Anarki also has a nice quickstart (https://github.com/arclanguage/anarki).

1 point by hjek 3933 days ago | link | parent | on: POST requests in Arc

Thanks a lot for helping clear that up. Those limitations of Arc are definitely not immediately obvious from reading the docs and essays available on the language.
3 points by aw 3936 days ago | link | parent | on: POST requests in Arc

> So, for Nginx/Apache, are you suggesting Arc might be able to handle uploads if it's sitting behind Nginx/Apache acting as reverse proxy doing buffering?

Nope, that won't help.

> so it's better to have a separate setup of Nginx/Apache (with PHP or whichever) handling file the uploads

That's the easiest approach. Not that you'd need PHP, just pop in a module to handle file uploads for you.

> Or is it more like doing anything with big files in Arc is a no-go

Not Arc as such but the implementation in srv.arc isn't designed for large files. You could read the old MZScheme documentation at http://docs.racket-lang.org/mzscheme/index.html and figure out how to read an input stream into a binary buffer, but it would be more work.

2 points by hjek 3936 days ago | link | parent | on: POST requests in Arc

Interesting! Arc is reading the request one character at the time. I think I see where it's happening, in the handle-request-thread function where readc is called. So, for Nginx/Apache, are you suggesting Arc might be able to handle uploads if it's sitting behind Nginx/Apache acting as reverse proxy doing buffering? Or is it more like doing anything with big files in Arc is a no-go, so it's better to have a separate setup of Nginx/Apache (with PHP or whichever) handling file the uploads?
4 points by aw 3937 days ago | link | parent | on: POST requests in Arc

Arc handles HTTP requests character by character, which is fine for form submits or REST APIs, but not what you want for handling large binaries.

To be able to handle image uploads directly in Arc, you'd want an HTTP server implementation which supported binary buffers.

But, not everything needs to be implemented directly in Arc. Instead you could use e.g. Ngnix or Apache to handle the image uploads, or upload the images directly to AWS S3 from the browser.

2 points by hjek 3938 days ago | link | parent | on: POST requests in Arc

I love Arc as a language. A friend asked me to set up a web board for artists, so I thought it would be nice to work in Arc, and extend news.arc (instead of just using PHP or whatever) with some basic functionality for handling small-to-medium sized images (<1MB per image). However Arc 3.1 (and Rainbow and Anarki) seem to choke on POST requests larger than ~100KB, and become unresponsive afterwards. Would there be some other, more arcish way handling files over network?
2 points by akkartik 3939 days ago | link | parent | on: Newlisp

Previously:

http://arclanguage.org/item?id=244

http://arclanguage.org/item?id=2887

http://arclanguage.org/item?id=8199

2 points by zck 3961 days ago | link | parent | on: Arc News deployement

Are you familiar with how to run it locally? There's decent beginning instructions in the README: https://github.com/arclanguage/anarki/blob/master/README.mar...
2 points by akkartik 3962 days ago | link | parent | on: Arc News deployement

There was some discussion recently about running it on OpenShift: http://arclanguage.org/item?id=18900. I also changed some of the documentation/scripts in response. If you wrote up how you did it for some other service after you succeeded, that would be most appreciated.
2 points by philophil 3962 days ago | link | parent | on: Arc News deployement

Found this document in french about it http://bzg.fr/forum-a-la-hacker-news-en-francais.html

Interesting, there's already a prototype compiler generating it: https://github.com/WebAssembly/ilwasm

This is a spec and reference implementation in the really early stages for an assembly language intended to replace javascript as the underlying 'machine code' of the internet, supported by Microsoft, Google, and Mozilla.

It's not much, but they have an sexp. based parser, so it should be at least as easy to build a lisp on top of it as vanilla js.

Here's an example: https://github.com/WebAssembly/spec/blob/master/ml-proto/tes...

2 points by akkartik 3975 days ago | link | parent | on: Best place to learn Arc?

Can you give more details? Do you have some prior programming experience? Do you mean in-person, in a classroom, online or something else?

I spent some time teaching programming using arc (might not be what you're asking for): http://arclanguage.org/item?id=19039. However, after some time I ended up moving away from arc: http://akkartik.name/post/mu. If you have some programming experience already, though, that might not be for you either.

2 points by rocketnia 3989 days ago | link | parent | on: Why parents?

"I assume Haskell got it from ML."

I think so. I'm primarily familiar with Haskell, but I hope those examples at least work in SML too.

A lot of the syntactic similarity starts to break down once the examples include lambdas, pattern matching, and top-level declarations, but I think that's similar to how the similarity between Lisp dialects breaks down when we look closely enough.

---

"It conflates calling a function (by surrounding it in parentheses) with converting an infix function to prefix."

I was making it look similar to Lisp syntax for the sake of argument, but parentheses aren't actually used like Lisp function calls there. In that example, parentheses are just used for two purposes:

- Grouping.

- Referring to infix variables (+) without applying them, which would otherwise be impossible to do.

The syntax for function application is juxtaposition with left associativity, so "gcd a b" is grouped as "(gcd a) b".

Agda[1] and some notes on Epigram 2[2] track "spines" of elimination contexts for the purposes of type inference and implicit argument elaboration. I think Haskell might use spines to resolve type class instances as well. In that case, the meaning of gcd in ((gcd a) b) can depend on the types known for a and b. With this kind of trick, Haskell's instance resolution can supposedly be used to write what are effectively varargs functions[3].

[1] http://www2.tcs.ifi.lmu.de/~abel/talkIHP14.pdf

[2] http://mazzo.li/epilogue/index.html%3Fp=1079.html

[3] https://wiki.haskell.org/Varargs

2 points by zck 3989 days ago | link | parent | on: Why parents?

> gcd a + b c - (square d)

> In this example, the + and - look like punctuation separating the phrases "gdc a", "b c", and "(square d)", and it takes me a moment to realize "b c" isn't a meaningful expression.

Agreed. This is possibly my main complaint with mixing infix syntax with prefix syntax.

> gcd (a + b) (c - square d) (* ML ) (gcd ((+) a b) ((-) c (square d))) ( ML again *)

This is the same in Haskell^1. But I really dislike how this is done. It conflates calling a function (by surrounding it in parentheses) with converting an infix function to prefix. And if the function is unfamiliar, you don't know which it is. I assume this is taken care of by the parser, so it's into the arbitrariness of syntax, not the clear standard of function application^2.

[1] I assume Haskell got it from ML.

[2] This is unless you assume some insane return type that's basically "if called infix with two arguments, return a number; if called with zero arguments, return a prefix function of two arguments that returns a number".

1 point by zck 3989 days ago | link | parent | on: Why parents?

I prefer the parentheses-based Lisp notation to any notation I've seen that removes them. Perhaps I haven't seen a notation that is simple enough for my taste.

The big benefit that parentheses have is that they make the correct parsing of the text obvious, especially when combined with decent automatic indentation^1. If I never have to read something like `[x * 2 if x % 2 == 0 else x for x in a_list]` or `[x * (2 - x % 2) for x in a_list]` again^2, I'll be thrilled.

So my question is: unless you can make the correct parsing obvious, why skip the parens?

[1] Hello, Emacs!

[2] Both from http://stackoverflow.com/questions/7619868/python-list-compr... .


Thank for the help, to summarise create .h and .c files:

  //StackArray.h

  #ifndef STACKARRAY_H
  #define STACKARRAY_H

  #define MAX 10

  typedef struct _stackarray{
	int array[MAX];
	int size;
  } StackArray;

  StackArray * newStackArray();
  int pushStackArray(StackArray *, int );
  int popStackArray(StackArray *);
  int fullStackArray(StackArray *);
  int emptyStackArray(StackArray *);
  void displayStackArray(StackArray *);
  void delete(StackArray *);
 
 #endif

  //StackArray.c

  #include <stdio.h>
  #include <stdlib.h>
  #include <string.h>
  #include "StackArray.h"

  StackArray * newStackArray(){
	StackArray * stack = malloc(sizeof(StackArray));
	int i;
	for(i = 0; i < MAX; i++){
		stack->array[i] = 0;
	}
	stack->size = 0;
	return stack;
  }

  int pushStackArray(StackArray * stack, int item){
	if(stack->size < MAX){
		stack->array[stack->size] =  item;
		stack->size++;
		return item;
	} else {
		printf("The stack is full\n");
		return 0;
	}
  }

  int popStackArray(StackArray * stack){
	if(stack->size > 0){
		int top = stack->array[stack->size-1];
		stack->size--;
		return top;
	} else {
		return 0;
	}
  }

  int fullStackArray(StackArray * stack){
	return stack->size == MAX ? 1 : 0;
 }
  int emptyStackArray(StackArray * stack){
	return stack->size == 0 ? 1 : 0;
  }

  void displayStackArray(StackArray * stack){
	if(stack->size > 0){
		int i;
		for(i = 0; i < stack->size; i++){
			printf("%d ", stack->array[i]);
		}
		printf("\n");
	} else if (stack->size == 0) {
		printf("The stack is empty\n");
	}
  }

  void delete(StackArray * stack){
	free(stack);
  }

  Compile and create the Shared Library (Linux):
  gcc -c -fPIC StackArray.c
  gcc -g -Wall -shared -o libStackArray.so StackArray.o

  In Anarki type in:
  
  ($:require ffi/unsafe
    ffi/unsafe/define
    ffi/unsafe/alloc)

  ;Define the library
  ($:define-ffi-definer define-StackArray (ffi-lib "/home/conan/Documents/Arcprojects/ffi/stack/libStackArray"))

  ;Define the functions input and ouput

  ($:define-StackArray newStackArray (_fun -> _pointer ))
  ($:define-StackArray delete (_fun _pointer -> _void ))
  ($:define-StackArray pushStackArray (_fun _pointer _int -> _void))
  ($:define-StackArray popStackArray  (_fun _pointer  -> _int))
  ($:define-StackArray fullStackArray  (_fun _pointer -> _int))
  ($:define-StackArray emptyStackArray  (_fun _pointer  -> _int))
  ($:define-StackArray displayStackArray  (_fun _pointer -> _void))

  ;assign the functions a symbol to use in Anarki
  (= newSA $.newStackArray)
  (= deleteSA $.delete)
  (= pushSA $.pushStackArray)
  (= popSA $.popStackArray)
  (= fullSA? $.fullStackArray)
  (= emptySA? $.emptyStackArray)
  (= displaySA $.displayStackArray)
  
  ;To use the functions
  (= stack (newSA))
  (emptySA? stack) 
  (pushSA stack 1)
  (displaySA stack)
  (fullSA? stack)
  (emptySA? stack)
  (popSA stack)
  (deleteSA stack)

 ;A lispy solution using closures with very little effort... a macro can be used to clean up the middle.
  (def Stack ()
    (with (items nil acc 0)
      (fn msg
        (let it (car (cdr msg))	
          (case (car msg)
             set
              (=  acc (len it) items it )
            empty?
              (is items nil)
            push 
              (do (= acc (inc acc)) (= items (join items (list it))) )
            pop 
              (if (> acc 0) (do (= acc (inc acc -1)) (= items (butlast items))))
            peek
              items
            size	
               acc)))))
 
  (= stack (Stack))
  (stack 'empty?)
  (stack 'push 1)
  (stack 'peek)
  (stack 'pop)
  (stack 'set '(1 2 3 4 5 6 7 8 9 10))
More