0

I installed curly-fn by raco pkg install curly-fn then started REPL with racket -I curly-fn then tried on the REPL

Welcome to Racket v8.4 [cs].
> (#{list 1 % 2} 3)
string:1:0: #%top-interaction: unbound identifier;
 also, no #%app syntax transformer is bound
  at: #%top-interaction
  in: (#%top-interaction #(list 1 % 2) 3)
 [,bt for context]
> 

Usually I use the REPL inside emacs by running the command run-racket and then using C-x C-e to evaluate s-expressions as needed, I'm looking for a way to get curly-fn working inside emacs too.

For example

#lang curly-fn racket

(#{list 1 % 2} 3) ;; C-x C-e here, expects '(1 2 3) but get this error :
; application: not a procedure;
;  expected a procedure that can be applied to arguments
;   given: '#(list 1 % 3)

I'm trying also with rackjure

#lang rackjure

(printf "~a" (#fn(+ % 1) 1))

If I run $ racket foo.rkt in the terminal I got 2, but if I open the buffer inside emacs using Geiser, with C-c C-a then try evaluating (#fn(+ % 1) 1) I get this error

stdin::573: read-syntax: bad syntax `#fn`
  context...:
   /home/geckos/.emacs.d/elpa/geiser-racket-20210421.125/src/geiser/user.rkt:89:0
   /usr/share/racket/collects/racket/repl.rkt:11:26
racket@foo.rkt> %: undefined;
 cannot reference an identifier before its definition
  in module: "/home/geckos/code/racket/foo.rkt"
  context...:
   body of "/home/geckos/code/racket/foo.rkt"
   /usr/share/racket/collects/racket/repl.rkt:11:26
racket@foo.rkt> 1
racket@foo.rkt> stdin::585: read-syntax: unexpected `)`
  context...:
   /home/geckos/.emacs.d/elpa/geiser-racket-20210421.125/src/geiser/user.rkt:89:0
   /usr/share/racket/collects/racket/repl.rkt:11:26
racket@foo.rkt> 
geckos
  • 5,687
  • 1
  • 41
  • 53

1 Answers1

0
;;C-c C-a loads #lang module into REPL (save before loading)
;;C-u C-c C-z is faster than C-c C-a
;;https://docs.racket-lang.org/sicp-manual/index.html
;;https://stackoverflow.com/questions/21008623/setting-language-with-lang-in-the-repl

from here. So you have to load curly-fn in that way first.

Gwang-Jin Kim
  • 9,303
  • 17
  • 30
  • I tried, still doesn't work. I'm trying with `rackjure` I update the question with the error – geckos Apr 28 '22 at 13:17