Arc Forumnew | comments | leaders | submitlogin
1 point by akkartik 3052 days ago | link | parent

Still no luck, sorry. I'm on Ubuntu 14.04 as well, and I'm running sbcl 1.1.14.debian. I did the following:

  $ sudo apt-get install emacs
  $ emacs --version
  GNU Emacs 24.3.1

  $ cat .emacs
  ; from http://melpa.org/#/getting-started
  (require 'package) ;; You might already have this line
  (add-to-list 'package-archives
               '("melpa" . "https://melpa.org/packages/"))
  (when (< emacs-major-version 24)
    ;; For important compatibility libraries like cl-lib
    (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
  (package-initialize) ;; You might already have this line

  ; from https://www.common-lisp.net/project/slime/doc/html/Installation.html
  (setq inferior-lisp-program "/usr/bin/sbcl")

  $ pwd
  /home/akkartik
  $ ls common-lisp
  Clamp/

  $ emacs
  M-x package-install RET slime RET
  # some errors
  M-x slime
  # seemed to work
  * (require :clamp)
  Don't know how to REQUIRE CLAMP.
     [Condition of type SB-INT:EXTENSION-FAILURE]
I think I might be missing some step in between that you implicitly have..


3 points by malisper 3052 days ago | link

What asdf version are you running?

-----

1 point by akkartik 3052 days ago | link

Ah yes, I meant to ask: how would I answer that?

-----

3 points by malisper 3052 days ago | link

(asdf:asdf-version)

-----

2 points by akkartik 3052 days ago | link

3.0.3

-----

3 points by malisper 3052 days ago | link

That's why you have been having issues. All you need to do is download a more recent version and load it in your .sbclrc file.

-----

4 points by akkartik 3052 days ago | link

Interesting! This is precisely what you need to record in the Readme!! "You need asdf 3.1 or higher." I assume you mean 3.1, right? According to http://www.cliki.net/ASDF the current version is 3.1. Is that really such a big difference?

I didn't think this was a problem since https://common-lisp.net/project/asdf/#downloads suggested just using the version that comes with my CL. Should I upgrade my sbcl as well?

Everytime I consider installing asdf manually I'm stymied by that last link. It provides an asdf.lisp but doesn't say what to do with it. Do I just load it? I just tried that without luck. I also tried various incantations from these tabs I have open: https://www.common-lisp.net/project/asdf-install/tutorial/in...; https://www.common-lisp.net/project/asdf-install/tutorial/se....

Common Lisp's crap documentation is culturally recursively turtles all the way down, just like all the good things about it.. :/ This is why I'm rooting for you to break out of this cycle of suck and improve things. Would you consider starting with a pristine Ubuntu 14.04 without sbcl or anything on it, and saving all the commands you type in until you get to a working Clamp? That would be wonderful to include in the Readme.

Another option might be to eschew asdf since the default versions on the most common Ubuntu release interact so poorly. Just dump all notion of dependencies and directly include all the code you need in the appropriate relative paths. Give me a single "sbcl --load" command to rule them all, just like Arc 3.1's classic "racket -f as.scm".

(It's not just Common Lisp, by the way. I have yet to meet a language-specific package manager that didn't suck. Pip, RubyGems, CPAN, it's all utter garbage. NPM hasn't started to suck yet, but I'm constantly looking for signs of incipient over-complexification.)

Edit: I'd be happy to provide a temporary Ubuntu server on Linode or something for this work.

-----

3 points by malisper 3051 days ago | link

> Is that really such a big difference?

No. It's just that asdf >=3.1.2 will check the ~/common-lisp directory by default. Prior to 3.1.2, you had to manually specify the directories you wanted asdf to check.

> https://common-lisp.net/project/asdf/#downloads suggested just using the version that comes with my CL. Should I upgrade my sbcl as well?

It looks like the version of sbcl you are using is old enough that the asdf version it comes with is older than 3.1.2. From that link, there is https://common-lisp.net/project/asdf/asdf.lisp Copy paste that into a file and add `(load "/foo/bar/asdf.lisp")` to your .sbclrc. I believe that Quicklisp comes with a more recent version of asdf, so you can also try setting that up and seeing if that configures asdf properly.

> I also tried various incantations from these tabs I have open

Those are for asdf-install which IS NOT asdf: http://www.cliki.net/asdf-install

asdf-install was the previous version of Quicklisp, but you should now be using Quicklisp instead.

I should spend the time to make Clamp a Quicklisp package so that you would be able to install it with just `(ql:quickload :clamp)` instead of needing to deal with asdf.

-----

1 point by akkartik 3051 days ago | link

That would be great, thanks.

> Those are for asdf-install which IS NOT asdf: http://www.cliki.net/asdf-install

O_O

-----

1 point by akkartik 3050 days ago | link

Ah, I FINALLY managed to get Clamp loaded. Here are the steps I followed from my home directory on Ubuntu 14.04:

  $ sudo apt-get install sbcl
  $ wget https://beta.quicklisp.org/quicklisp.lisp  # following instructions at https://quicklisp.org
  $ sbcl --load quicklisp.lisp
  * (quicklisp-quickstart:install)
  * (ql:add-to-init-file)
  * (quit)
  $ cd quicklisp/local-projects
  $ git clone https://github.com/malisper/Clamp
Now, from any directory:

  $ sbcl
  * (ql:quickload :clamp)
  * (in-package :clamp)
  * (use-syntax :clamp)
Now it's ready!

  * (map [+ _ 1] '(1 2 3))
  (2 3 4)
Woohoo! I'll send you a pull request. Is there some way we can provide an "Arc repl" that's already in the right package and uses the right syntax? I tried this, but it didn't work:

  $ cat quicklisp/local-projects/Clamp/init.lisp
  (ql:quickload :clamp)
  (in-package :clamp)
  (use-syntax :clamp)
  $ sbcl --load quicklisp/local-projects/Clamp/init.lisp
  ; Loading "clamp"
  * (map [+ _ 1] '(1 2 3))
  The variable [+ is unbound.

-----

3 points by malisper 3050 days ago | link

Reader macros work on a per file basis so I don't think there is a way to set the proper syntax from a separate file.

You might want to consider trying to setup Slime, as it provides some really amazing Smalltalk-esque features. I detailed most of them in my blog series, Debugging Lisp[0]. Some of the ones I covered in the post are: recompilation of code at runtime, restarting of a stack frame at runtime, an object inspector, interactive restarts (restarts are a better form of try/catch), various forms of function lookup (e.g. list all functions who call function X). I haven't yet covered it, but I eventually want to, is slime-macrostep[1]. It lets you interactively expand parts of a macro step by step.

[0] http://malisper.me/2015/07/07/debugging-lisp-part-1-recompil...

[1] http://kvardek-du.kerno.org/2016/02/slime-macrostep.html

-----

1 point by akkartik 3048 days ago | link

I'm trying to work through http://malisper.me/2015/07/07/debugging-lisp-part-1-recompil... but I got this error when I tried to restart from any of the stack frames:

  Cannot restart frame: #<SB-DI::COMPILED-FRAME EVAL>

-----

1 point by akkartik 3049 days ago | link

Ah, I figured out a way to run it with just:

  $ clamp
https://github.com/malisper/Clamp/pull/5

-----

1 point by akkartik 3050 days ago | link

Yes, I'll certainly try to add Slime back now that I have the foundation working well together.

-----

1 point by akkartik 3048 days ago | link

I've gotten Slime working, but so far I'm still doing the same things I would do in an interactive session:

  $ emacs
  M-x slime RET
  # in the slime buffer
  * (ql:quickload :clamp)
  * (in-package :clamp)
  * (use-syntax :clamp)
Is that what do you typically do?

Also, when I try to C-x C-e an arc expression in some random buffer after the above steps, it doesn't seem to remember the above commands anymore. The only thing that works is running commands at the repl.

-----

4 points by malisper 3048 days ago | link

> I've gotten Slime working, but so far I'm still doing the same things I would do in an interactive session:

Yes, that's what I typically do. If you wanted to, you could add those instructions to your .sbclrc, and that should load Clamp on start up.

> Also, when I try to C-x C-e an arc expression in some random buffer after the above steps, it doesn't seem to remember the above commands anymore.

You need to have slime-mode enable in the buffer you are editing. You can add the following code to your .emacs:

    (require 'slime)
    (add-hook 'lisp-mode-hook (lambda () (slime-mode t)))
and then whenever you open a file that ends in .lisp, it will enable slime-mode.

If you are going to get into programming Lisp with Emacs, you should look into Evil (vim bindings for Emacs), paredit (smart paren editing), ac-slime (autocomplete for slime), show-paren-mode (shows matching parens), and undo-tree (a better version of undo/redo). Although I've never used it, you might want to look at Spacemacs which is supposed to supply sane defaults for Emacs.

-----

3 points by zck 3047 days ago | link

>If you are going to get into programming Lisp with Emacs, you should look into Evil (vim bindings for Emacs), paredit (smart paren editing), ac-slime (autocomplete for slime), show-paren-mode (shows matching parens), and undo-tree (a better version of undo/redo).

Yes, customizing Emacs is really useful for making it better to use. To help with that, here are some of my config's settings for things you've mentioned. My show-paren-mode settings are here (https://bitbucket.org/zck/.emacs.d/src/default/init.el?filev...).

Instead of paredit, I use smartparens. They do similar things, but when I looked at the two, I thought smartparens was better, although I can't remember why right now. My config is here (https://bitbucket.org/zck/.emacs.d/src/default/init.el?filev...).

I should similarly check out the other things you've mentioned (except Evil, 'cause I don't like modal editing).

-----

1 point by akkartik 3048 days ago | link

Ah, that hook was what I needed. Thanks! I'll check out all your tips.

-----

1 point by akkartik 3050 days ago | link

Draft changes to Readme: https://github.com/malisper/Clamp/pull/3/commits/d4e89140b9

Everyone please try out the instructions and/or suggest improvements to the prose.

-----