Arc Forumnew | comments | leaders | submit | jsgrahamus's commentslogin
2 points by jsgrahamus 5232 days ago | link | parent | on: possible bug involving len and nil?

Jarc and rainbow also return 0 for these.

-----


And it does not have eval: http://axisofeval.blogspot.com/2011/07/on-absence-of-eval-in...

-----

2 points by rocketnia 5246 days ago | link

There's a bigger list of things it doesn't have here: https://github.com/clojure/clojurescript/wiki/Differences-fr...

I'm not worried about its lack of 'eval so much. They're placing a strong emphasis on ClojureScript's ability to leverage the Closure Compiler to weed out dead code. Inasmuch as they encourage dynamic programming techniques at all, they'll end up with dynamically minded libraries that make their compile-time efforts seem weaker than they are. Apparently they draw the line at reflection, and 'eval is beyond that point.

What I'm more worried about is that under the current plan, it looks like there "won't [ever] be" any "thread-related things" (http://cloud.github.com/downloads/clojure/clojurescript/cloj...). I don't find Clojure remarkable for static analysis, for syntax, or for collaboration between programmers. What I find remarkable about Clojure is the way it furnishes its standard libraries with things that anticipate concurrency, so that when people write their own concurrency-related Clojure libraries, they're all likely to synergize with each other.[1] Even if ClojureScript doesn't get to have shared-state concurrency thanks to the JavaScript platform,[2] I think it would be great if its biases could somehow be repurposed for use with web workers or AJAX.

[1] At least I imagine they synergize. I haven't used Clojure or stumbled upon many concurrency-related Clojure libraries, so I hardly know how well they work together in practice.

[2] Go JavaScript platform! XD

-----

2 points by thaddeus 5246 days ago | link

I see the value in (hopefully) having a lisp equivalent of sproutcore technology (http://www.sproutcore.com).

For example, here's a demo, which is a little stale, that shows capturing touches and gestures from mobile devices.

http://touch.sproutcore.com/hedwig/

Having a lisp version of this would rock and correct me if I am wrong, but not having eval or such features would not be a problem.

-----

2 points by Pauan 5246 days ago | link

In practice, in both my Arc and JS code, I use eval only when I absolutely have to... which is almost never. It's usually when I'm doing something incredibly hacky, like trying to eval macros at runtime...

Anyways, the traditional wisdom in JS is to avoid eval as much as possible. 99.99% of the time, eval is bad. It slows down your code, makes things like static analysis harder (or impossible), and it's usually completely unnecessary.

So, I don't see any practical problems with removing eval, but I do see some philosophical problems. eval has been a part of Lisp for so long, that it almost feels like a Lisp without eval isn't really a Lisp...

In any case, from a practical perspective, a lack of eval isn't a big deal at all. But I can see why some people might want eval (for non-practical reasons).

-----

3 points by evanrmurphy 5246 days ago | link

Having both macros and eval always seemed redundant to me, because they're both for letting you treat code as data. Also, since the eval in most lisps (Arc included) doesn't accept a second parameter for the environment context, they might as well not have eval in the first place.

1. A good theoretical lisp should be fexpr-based and have an eval which accepts both parameters.

2. A good practical lisp wants to be fast, so it should use macros instead of fexprs. Eval is basically irrelevant here.

-----

2 points by Pauan 5246 days ago | link

"...they might as well not have eval in the first place."

Although I agree with you in principle, eval is needed in at least one place: load. So I don't think we can necessarily get rid of it completely, unless we used a different method of loading/evaling files...

eval is also used in a few other places in ar, but not very many. So rather than getting rid of it, I think a better solution is to say, "eval is generally a bad idea, so use something else unless you absolutely positively must use eval" which is exactly what we do.

By the way, I'll note that when I tried to use eval to expand a macro at runtime, it ended up being horrendously slow. I changed it to use a function (which did the same thing, but with thunks) and suddenly my code ran at least 100 times faster than it did with eval.

-----

2 points by evanrmurphy 5246 days ago | link

Ah, you're right. You may not be able to do away with eval.

And do you know what you just helped me realize? If we've already identified ourselves as a practical lisp, why should we try to get rid of features like eval in the first place?

A theoretical lisp tries to get rid of unnecessary features to approach being as minimal as possible. A practical lisp has already decided that it would rather be useful than theoretically minimal.

So a practical lisp probably shouldn't worry about getting rid of things unless they are actively causing problems. If it wants to be as useful as possible, it might as well leave in unnecessary features. Because they're probably still useful some of the time to some people, even if they're not totally necessary.

-----

2 points by jsgrahamus 5252 days ago | link | parent | on: Arc vs. Clojure on Google AdWords

Interesting.

-----

1 point by jsgrahamus 5294 days ago | link | parent | on: Problem with factorial

Thanks, everyone, for the help. It works great now:

C:\Users\Steve\Documents\Programming\Lisp\arc\arc3.1>"c:\Program Files (x86)"\racket\racket -f as.scm

Use (quit) to quit, (tl) to return here after an interrupt.

arc> (def factorial (n) (if (< n 2) 1 (* n (factorial (- n 1)))))

#<procedure: factorial>

arc> (factorial 50)

30414093201713378043612608166064768844377641568960512000000000000

arc>

-----

2 points by jsgrahamus 5294 days ago | link | parent | on: Problem with factorial

In my case, I typed everything into Arc. And I still got that error.

-----

1 point by rocketnia 5294 days ago | link

Nice. Since we're on different versions of Windows, I can totally believe that. But you only got it for one definition of factorial and not the other? Did you type them in differently somehow? (Say, by putting a newline at the beginning of the second one, or by entering the first one as the very first command of the REPL session?)

-----

[deleted]
1 point by rocketnia 5294 days ago | link

Actually, there's a chance I may be able to even though I'm on XP, since it may have more to do with the version of MzScheme being used. I'll see what I can do.

EDIT: Nope, no luck.

-----

1 point by jsgrahamus 5294 days ago | link | parent | on: Problem with factorial

Odd that this did work, when the other did not.

(def factorial (n)

   (if (< n 2) 

      1 

      (* n (factorial (- n 1)))))

-----

2 points by akkartik 5294 days ago | link

Very odd indeed. I gather you're on windows. What version of arc and mzscheme do you have?

On my setup both examples work.

-----

1 point by zck 5294 days ago | link

Both work for me too. I'm using Ubuntu 11.04, Arc 3.1, and I tested both with Racket 5.1.1 and mzscheme 4.2.1 .

jsgrahamus, can you see if it works for a lower call to factorial? Does it work at all? Even (factorial 0) ?

-----

1 point by jsgrahamus 5294 days ago | link

Having loaded Racket 5.1.1, Arc 3.1 and made a change in ac.scm, everything works, even (factorial 0).

-----

1 point by jsgrahamus 5294 days ago | link

I'm on Windows 7x64, mzscheme 372 and I just downloaded arc this morning.

-----

1 point by rocketnia 5294 days ago | link

This is a bit off-topic, but despite your best efforts, you are probably not using the latest version of Arc. Sounds like you've been following the instructions at http://www.arclanguage.org/install for the whole time you've been posting here, and those are out of date by almost two years, even linking to a version of Arc 3 (one of a few Arc 3s, I think :-p ) instead of Arc 3.1. I think this is a better starting resource: http://sites.google.com/site/arclanguagewiki/.

Old versions of Arc needed to run on MzScheme 372 because it was the last MzScheme with mutable lists, but now Arc 3.1 uses some pointer manipulation to mutate lists behind Racket's back, meaning any version of Racket is fine. However, this actually introduced a rare garbage collection bug, if you can believe it. ;) That means there is actually a legitimate reason to keep using MzScheme 372, but as described at http://sites.google.com/site/arclanguagewiki/arc-3_1/known-b..., pretty much every Arc setup besides the official one avoids this bug, and it's possible to patch the official one too.

Anyway, you're the first person I've heard of who's tried Arc on Windows 7 (which isn't to say there aren't Arc Forum lurkers in the same position ^_^ ). If you encounter Arc-on-Windows-7 stumbling blocks, please continue talking about them like you have in this thread!

-----

1 point by jsgrahamus 5294 days ago | link

Just downloaded arc3.1 and am trying to run it against Racket 5.1.

C:\Users\Steve\Desktop\arc3\arc3.1>c:"\Program Files (x86)"\Racket\Racket -m -f as.scm main: not defined or required into the top-level environment

C:\Users\Steve\Desktop\arc3\arc3.1>c:"\Program Files (x86)"\Racket\mzscheme -m - f as.scm main: not defined or required into the top-level environment

C:\Users\Steve\Desktop\arc3\arc3.1>

-----

1 point by rocketnia 5294 days ago | link

The -m option means to call the "main" function now. Just leave it out. It used to mean "--mute-banner", which suppressed the "Welcome to MzScheme" line.

-----

1 point by jsgrahamus 5294 days ago | link

C:\Users\Steve\Documents\Programming\Lisp\arc\arc3.1>"c:\Program Files (x86)\Racket"\racket

Welcome to Racket v5.1.1.

> user break

=== context ===

c:\Program Files (x86)\Racket\collects\racket\private\misc.rkt:85:7

>

C:\Users\Steve\Documents\Programming\Lisp\arc\arc3.1>"c:\Program Files (x86)\Racket"\racket -d as.scm

default-load-handler: expected a `module' declaration for `as', found: something else in: #<path:C:\Users\Steve\Documents\Programming\Lisp\arc\arc3.1\as.scm>

=== context ===

standard-module-name-resolver

C:\Users\Steve\Documents\Programming\Lisp\arc\arc3.1>"c:\Program Files (x86)\Racket"\racket -f as.scm

ffi-obj: couldn't get "setuid" from #f (The specified

procedure could not be found.; errno=127)

=== context ===

c:\Program Files (x86)\Racket\collects\ffi\unsafe.rkt:176:2: get-ffi-obj*

C:\Users\Steve\Documents\Programming\Lisp\arc\arc3.1\ac.scm: [running body]

C:\Users\Steve\Documents\Programming\Lisp\arc\arc3.1>

-----

2 points by rocketnia 5294 days ago | link

That "racket -f as.scm" command is the right one. The 'setuid issue is one of a few known issues on Windows, and it has a known fix: http://arclanguage.org/item?id=10625.

I give a whole step-by-step process for setting up Arc on Windows XP at http://www.arclanguage.org/item?id=12397. This link actually appears on http://sites.google.com/site/arclanguagewiki/, but it's okay if you didn't read that far down. :-p

By the way, I committed a 'setuid fix to Anarki a while ago, and unlike the fix above, this version of 'setuid should still work as usual on Linux: https://github.com/nex3/arc/commit/3201b34f3ed89e6305b0d9906...

-----

1 point by jsgrahamus 5294 days ago | link

Thanks for the tip and the understanding ;-)

Works great.

-----

1 point by rocketnia 5294 days ago | link

Erm, make sure to take another look. I've been ninja-editing that post for the last ten minutes. XD

-----


Getting 404 on link

-----

2 points by rocketnia 5296 days ago | link

Guess Pauan broke the link by replacing the master branch with one that could be pull-requested back into awwx/ar. Here's import.arc on the "old" branch: https://github.com/Pauan/ar/blob/old/lib/import.arc

By the way, Pauan, how did you manage to make that switch? Your GitHub history has an entry that says "master is now 2be9ac7", and your pull commit worked out better than mine did. I'd like to know your secret. ^_^

-----

2 points by Pauan 5296 days ago | link

Yeah, sorry, that was intentional, but I didn't realize the links would break. In hindsight, I should have.

Well, it's pretty simple[1], really. I used git fetch upstream to grab all the changes from ar. Then I used git reset --hard to reset my master branch to ar's branch, completely destroying everything on my branch, including commits.

Then I used git push -f to force my changes onto GitHub. Voila, now my fork is in the exact same state as ar. Of course, before I did all that, I created the old branch, so I wouldn't lose my work. Here's roughly what I did:

  git branch old
  git push origin old
  ... do stuff ...
  git fetch upstream
  git reset --hard 2be9ac75f67edfe9b3c43a9515dd78acebba6f1c
  git push -f origin
At least, I think that's what I did. I actually had to experiment and mess up some stuff before I figured out how to do it. So my directions may be wrong and you may bork your repo!

By the way, while I was trying to do that, I found this: http://stackoverflow.com/questions/772846/create-git-branch-...

But their directions are somewhat different from mine. I don't think I needed git pull for instance, and git push origin :master didn't work for me. So I had to use -f to force the push, since git was kindly telling me that it might destroy my commits (which I wanted to do).

---

After using git for a while, I gotta say, I like it a lot more than Mercurial. git gives you the power to do stuff, whereas Mercurial seems to hold your hand a lot more, and say, "no I can't let you do that, Dave"

Now, I'm not saying Mercurial is bad, just that I like the raw power of git, in the same way that I like the raw power of Arc. So for me personally, git seems to be the winner.

---

* [1]: s/simple/obtuse black magic/

-----

2 points by rocketnia 5295 days ago | link

Thank you so much. ^_^ Between that, http://book.git-scm.com/1_the_git_object_model.html, and http://blog.nelhage.com/2010/01/git-in-pictures/, Git's starting to make more sense.

It's too bad the links break. But wait, the pull requests' links don't break, because they link directly to the blobs.... I bet the blobs will stick around as long as at least some branch points to them, so playing fast and loose with lots of branch-renaming is only going to hurt tip-of-branch links. Too bad GitHub doesn't have some way to specify redirects (or at least I think it doesn't).

-----

2 points by akkartik 5296 days ago | link

I know that git lets you rename branches. And apparently github lets you configure the default branch as well. http://support.github.com/discussions/repos/5390-how-to-rena...

-----

1 point by Pauan 5296 days ago | link

Also, I'm not actually sure how well my old branch actually works, since I've moved onto working on ar. I do plan to port import.arc so it works on ar, since ar now has defcall (yay).

-----

1 point by jsgrahamus 5633 days ago | link | parent | on: Initial problems

The first 3 examples of hello all functioned as I thought they should. But when I got to the fourth one, I expected a form with some prompts and a link. Rather, all I got was a web page saying It's alive. Where did that come from?

The code follows:

  arc> (defop hello req (aform [w/link (pr "you said: " 
  (arg _ "foo"))
                               (pr "click here")]
                               (input "foo")
                               (submit)))
  #<procedure: gs1709>
  arc> (asv)
  ready to serve port 8080

-----

1 point by evanrmurphy 5632 days ago | link

"It's alive." is just a tongue-in-cheek message printed by default to the root page (probably http://localhost:8080/) of a running instance of the Arc server. You can see where it comes from if you open the file srv.arc in your arc directory and look for the line:

  (defop || req (pr "It's alive."))
The || from that is a symbol for empty, so just as your (defop hello ...) command puts a page at http://localhost:8080/hello, (defop || ...) puts a page at http://localhost:8080/. (Nothing comes after that final slash since we used the empty symbol instead of "hello".) You could replace the default "It's alive." message by running a command like

  (defop || req (pr "jsgrahamus rox!"))
at the REPL.

Were you able to get this stuff working, by the way, or are you still stuck??

-----

1 point by akkartik 5632 days ago | link

Go to http://localhost:8080/hello

-----

1 point by jsgrahamus 5633 days ago | link | parent | on: Initial problems

In running through the tutorial, I did the following:

  arc> (defop hello req (pr "hello world"))
  #<procedure: gs1709>
  arc> (asv)
  ready to serve port 8080

  ^Z
  [1]+  Stopped                 ./goarc
  mint@mint ~/bin $ ./goarc
  Use (quit) to quit, (tl) to return here after an   
  interrupt.
Then I wanted to try some more, and it seems that the port is still in use.

  arc> (defop hello2 req (w/link (pr "there") (pr "here")))
  #<procedure: gs1709>
  arc> (asv)
  Error: "tcp-listen: listen on 8080 failed (Address   
  already in use; errno=98)"
  arc> (load "blog.arc")
  nil
  arc> (bsv)
  Error: "tcp-listen: listen on 8080 failed (Address 
  already in use; errno=98)"
Is there some way to turn the port off, or stop whatever is listening on it?

Thanks, Steve

-----

2 points by jsgrahamus 5633 days ago | link

Answered my own question, again. Had a stopped job.

Sorry.

-----

1 point by jsgrahamus 5633 days ago | link | parent | on: Initial problems

Thanks for your help.

Another question. I assume that this line is trying to change "99" into a number base 16, but it doesn't seem right.

  arc> (coerce "99" 'int 16)
  153

-----

2 points by jsgrahamus 5633 days ago | link

I got it. It's trying to output in decimal what 99 base 16 is.

-----

More