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

Code from Arclanguage tutorial does not work #2

Open
alexispurslane opened this issue Jul 25, 2017 · 3 comments
Open

Code from Arclanguage tutorial does not work #2

alexispurslane opened this issue Jul 25, 2017 · 3 comments

Comments

@alexispurslane
Copy link

Almost none of the library functions from the language reference at arclanguage.org work.
For instance, the code:

(w/socket s 8888 (let (i o ip) (socket-accept s)
  (w/stdout o (prn "Hello") (close i o))
  (prn ip)))

complains about none of these functions existing.

@akkartik
Copy link
Member

Thanks for reporting that; good to know. If you ended up implementing some of them we'd love that. I'll probably also look into implementing some of them, though it might be a while. I imagine many of them would be easy to implement in terms of Common Lisp primitives.

/cc @malisper (original author at https://github.com/malisper/Clamp)

@malisper
Copy link
Contributor

Did you do (in-package :clamp)? prn should definitely be defined. I don't think I defined an equivalent to w/stdout because Common Lisp has dynamic variables. The pattern for doing that with Clamp is instead (let *standard-output* o ....

As for the socket functions, I never defined Common Lisp equivalents to them. You should instead use a library such as usocket that provides socket related functions. Looking at the API, I think you can use the macro with-socket-listener as a substitute for w/socket.

@alexispurslane
Copy link
Author

Awesome, thanks guys.
@akkartik, I will probably get around to implementing the Arc language's OS functions eventually, I had already been planning to do that, but I have a two other rather large projects going right now so I might be sluggish.
@malisper I was planning on doing just that. After all, this is Common Lisp we're talking about! (:

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

No branches or pull requests

3 participants