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

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 3093 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 3091 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 3092 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 3093 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 3091 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 3091 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 3091 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 3091 days ago | link

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

-----

1 point by akkartik 3093 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.

-----