This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-24
Channels
- # babashka (19)
- # beginners (43)
- # calva (10)
- # clj-kondo (3)
- # cljsrn (8)
- # clojure (106)
- # clojure-europe (8)
- # clojure-hungary (5)
- # clojure-nl (1)
- # clojure-uk (1)
- # clojurescript (14)
- # core-typed (1)
- # graalvm (2)
- # graphql (1)
- # malli (2)
- # membrane (9)
- # observability (2)
- # off-topic (66)
- # polylith (3)
- # practicalli (3)
- # re-frame (17)
- # reagent (3)
- # remote-jobs (7)
- # rewrite-clj (17)
- # sci (29)
- # shadow-cljs (45)
- # sql (5)
- # tools-deps (15)
- # vim (8)
In lack of an #edamame channel. When I try the README example:
(parse-string "#(* % %1 %2)" {:fn true})
;;=> (fn [%1 %2] (* %1 %1 %2))
I instead get
(fn*
[%1 %2]
(* %1 %1 %2))
Is there a way I can force it to give me the same thing as in the example?ah it should be fn*
actually, this was changed at some point to be more like the original
My use case is translating tests from 4Clojure and I would like them to not use the rather confusing fn*
. But it is just my use case so probably not something that should direct the development of edamame.
user=> (e/parse-string "#(+ 1 2 3)" {:fn true :postprocess (fn [{:keys [obj]}] (if (and (seq? obj) (= 'fn* (first obj))) (list* 'fn (rest obj)) obj))})
(fn [] (+ 1 2 3))
I'm getting an Exception when trying to evaluate a defrecord
that implements protocols that were defined outside of sci
Example defrecord:
(defrecord
My-comp
[extra context]
membrane.ui/IBounds
(-bounds
[this__25094__auto__]
(:membrane.component/bounds this__25094__auto__)))
The protocol, membrane.ui/IBounds
was defined and loaded outside of sci.
The exception I'm getting is https://gist.github.com/phronmophobic/6603dbf9d7ea3a74ecd8b757aba1b41f@smith.adriane protocols need a bit of special attention in sci. Internally they are piggy-backing on multi-methods (since multi-methods don't need any compilation, but protocols do).
I can show you how you can have a protocol outside of sci and inside sci, I have several examples of that
@smith.adriane Note that this is quite "implementation" detail-ish, but here you go:
https://github.com/borkdude/sci/blob/master/src/sci/impl/core_protocols.cljc
IDeref
, etc is implemented as a protocol in SCI and also outside of SCI (in CLJS, but in CLJ it's an interface)
awesome!
here's the Coercions
protocol impl from
:
https://github.com/babashka/babashka/blob/2282b2922d2588599e9c2fd7b2096cc365c15bf5/src/babashka/impl/clojure/java/io.clj#L56
something like this:
(defmethod as-file :default [x]
(io/as-file x))
takes care of calling the "outside SCI" protocolI should perhaps one day expose and document this better, but so far nobody ever asked for it :)
Is this a bug?
(edamame/parse-string "#{'(:x) '(:y)}")
; Execution error (ExceptionInfo) at edamame.impl.parser/throw-reader (parser.cljc:102).
; Set literal contains duplicate key: '