6 ms·
Anarki – Community-managed fork of the Arc dialect of Lisp
- georgewsinger 8y agoWhat are the core features that differentiate Arc from other lisp dialects?
- sctb 8y agoTo me, one of the most fundamental features of Arc is taking the unification of code and data much further. I don't know of other Lisps that do this! K is another language that does. arc> (= l '(1 2 3)) (1 2 3) arc> (= f [+ _ 1]) #<fn: f> arc> (map l '(0 1 2)) (1 2 3) arc> (map f '(0 1 2)) (1 2 3)
- prospero 8y agoClojure’s maps, sets, and vectors are all functions.
- hjek 8y agoFirst public release of Arc came not long after Clojure. Clojure is definitely better thought out as a language, and while Arc has some interesting ideas around web development, it also doesn't have a module system, so everything is just loaded into the same global namespace, which is pretty insane.
- christianbryant 8y agoKeep in mind that Arc is the start of something with long-term goals; further, it's part of a lifecycle that didn't necessarily start with Arc but with the first Lisp. PG points to an early essay titled "The Hundred-Year Language" [1] as an indicator of where Arc is intended to go and some future outlooks that might inspire more evolution. I don't know that any programming language can be everything it needs to be from the outset, but it certainly needs inherent featured supporting longevity, a framework that supports change and evolution, while still having a pleasing and useful function that can be taken advantage of immediately. [1] http://www.paulgraham.com/hundred.html http://www.paulgraham.com/hundred.html
- stingraycharles 8y agoIt would be more correct to say that they can be coerced to a function with a special purposes (e.g. using a set as a function is an alias for checking whether an item exists). To say they are functions would be incorrect. By the same logic, a keyword is would be a function.
- jffry 8y agoThey're callable as functions, i.e. they implement clojure.lang.IFn. So unless you want to shave hairs on what it means to say they're not "functions", they _are_ functions. Sets, vecs, maps, keywords, and IIRC symbols are all IFn Oh and (#{1 2} 3) is equivalent to (get #{1 2} 3) not (contains? #{1 2} 3)
- stingraycharles 8y agoI think that it depends upon what you interpret it when you say “it’s a function”; it’s data as well. Which, now that I reconsider it, was kind of the point that the parent was trying to make, that they’re also very much unified. So point taken.
- sctb 8y agoAh, that makes sense. The next main difference in my mind is ergonomic, but relies on this regularity: functional syntax for composition, negation, quoted application. There are also other syntax additions and in my experience they're well-chosen and go a long way.
- agumonkey 8y agoThis was discussed a lot before (according to Queinnec book at least) but people were worried that too much overloading would yield confusing code and bugs.
- sago 8y agoI don't know Arc, so this confuses me: arc> (map l '(0 1 2)) (1 2 3) What is the logic here? Is l made into a function that holds state and returns each element in turn (like an iterator function)? Because I would've expected: arc> (map l '(0 1 2)) ((1 2 3) (1 2 3) (1 2 3)) In what way is map being applied here?
- sago 8y agoAfter RTFM, I can answer my own question: > In Arc, data structures can be used wherever functions are, and they behave as functions from indices to whatever's stored there. (quoted from the Arc tutorial) So arc> (l 0) 1 and so on. So the GP makes sense.
- dmead 8y agothat's confusing as hell. there's a reason this didn't take off (Besides the competition from clojure)
- quadcore 8y agoIt's kinda cool to be able to write (myarray i).
- etatoby 8y agoI don't like the Arc language because it's dynamically typed and thus inherently unsafe (see other threads for this sort of discussion.) But I like this particular feature. If you think about it, an array is a mathematical function, or map, from indices to values. So it makes sense to be able to apply it to indices to get the respective values.
- DavidSJ 8y agoIn that sense, map just composes its two arguments.
- 8y ago
- jlarocco 8y agoNo offense, but I found your example code really confusing. For the benefit of people familiar with Common Lisp: * (= ...) is assignment, not equality testing * (map list index-list) is equivalent to (loop for index in index-list collecting (nth index list)), or in a more FP style (mapcar (rcurry #'nth list) index-list) * (map function list) is equivalent to (mapcar function list) I think your example would have been less confusing if it used larger numbers to highlight where addition was happening and where indexing was happening: arc> (= l '(4 5 6)) (4 5 6) arc> (= f [+ _ 10]) #<fn: f> arc> (map l '(2 1 0 0)) (6 5 4 4) arc> (map f '(0 1 2)) (10 11 12)
- lifeisstillgood 8y agoThank you the map <list> makes more sense now. And looks like an easy trap for misreading code ...
- jessaustin 8y agoWow next time don't use 1 and l in the same code listing.
- malloryerik 8y agoKind of like pattern matching in Elixir?
- christianbryant 8y agoIf you take a look at the code for HN written in Arc, you can compare it against other Lisp dialects. I point to this as it is possibly the most widely-used and familiar application to most here written in Arc. https://github.com/wting/hackernews https://github.com/wting/hackernews This is a great place to start with understanding Arc, as the jump to Anarki (an Arc fork) will make more sense as it comes bundled with News - a Hacker News style app - which is fun to play with if you have experience with HN and want to try a variation of this site.
- quadcore 8y agoIt is more concise thanks to "sugar" in the language.
- gtdthrow 8y agoAm I understanding right that Arc is a Lisp-1, like Clojure?
- sctb 8y agoYes, or like Scheme.
- gtdthrow 8y agoI don't really get why you'd ever want a Lisp-2. Is there an argument/explanation somewhere that I could read up on? (I've used Clojure and JS, which also seems like a "Lisp"-1 in that you can just put fns into variables and call them like 1st class fns, I just don't get why the distinction is in any way positive rather than confusing, and in Lisp-2s you now need to dereference everything all the time, like in Ruby).
- sctb 8y agoIf I understand it correctly, Lisp-2 is a way (not the only way!) of maintaining more intuitive semantics in the face of macros. If I write the following: (your-macro (let ((x (foo y)) (bar x)))) I probably don't want the meaning of FOO or BAR to be up for grabs based on the expansion of YOUR-MACRO, and certainly not LET. Lisp-1s often have hygienic macros to deal with this concern, but not always.
- hollerith 8y agoCompleting your thought (please let me know if I misunderstood you) Y _is_ up for grabs because what you wrote might macroexpand to for example (let ((y 5)) (let ((x (foo y))) (bar x))). Where your comments falls down is that all the Lisp-2s I know allow the "function definition" of a symbol to be overriden in a similar way, e.g., in Common Lisp the macro might expand to (flet ((bar (arg) (* 5 arg))) (let ((x (foo y))) (bar x))) where FLET is a macro similar to LET but for function definitions.
- 8y ago
- dreamcompiler 8y agoThe curse of Common Lisp is that every good programmer who tries it wants to improve it. Which always results in a weird product with less, rather than more, appeal.
- andreareina 8y ago> The intention is to be extremely permissive in accepting patches. Interesting to see what this will lead to.
- krapp 8y agoI'm not nearly versed enough in either lisps or Arc to comment on it as a language, but as far as the architecture of the forum is concerned, what is the rationale for functions that appear to just print CSS and javascript[0]? Wouldn't it be better to separate CSS and JS into separate, static files and only have the forum deal with, at best, IDs and classes in HTML? I'm asking because I'm tempted to actually try to fork it and make a PR for it but it seems like such a simple and obvious bit of housekeeping that I have to assume there's a reason no one else has bothered yet. [0]https://github.com/arclanguage/anarki/blob/master/lib/news.arc#L482 https://github.com/arclanguage/anarki/blob/master/lib/news.a...