This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-10-19
Channels
- # admin-announcements (2)
- # beginners (24)
- # boot (36)
- # business (1)
- # cbus (3)
- # cider (22)
- # cljs-dev (91)
- # clojure (101)
- # clojure-canada (9)
- # clojure-china (3)
- # clojure-czech (21)
- # clojure-nl (3)
- # clojure-russia (131)
- # clojure-sg (5)
- # clojure-uk (9)
- # clojure-ukraine (4)
- # clojure-za (2)
- # clojurebridge (18)
- # clojurescript (333)
- # clojurex (6)
- # devcards (1)
- # events (37)
- # hoplon (15)
- # ldnclj (23)
- # luminus (3)
- # off-topic (41)
- # om (258)
- # onyx (20)
- # re-frame (46)
- # reagent (7)
- # spacemacs (2)
I’m running through the Clojure Koans right now, and I’m getting an error on 2 when trying to Eval expressions using string.
(ns koans.02-strings
(:require [koan-engine.core :refer :all]
[clojure.string :as string]))
That looks right, but trying to eval something like
(string/reverse "hello”)
gets me a CompilerException java.lang.RuntimeException: No such namespace: string
I am having some trouble translating a java class to clojure using (gen-class)
specifically, all the class does is define a static variable, then call super
with a few args
I think I need to do something with exposes-methods
but I’m not sure what exactly - like what is the name of the parent class’s constructor? just the name of the class?
also (I’m new at Java interop having mostly worked in cljs so far)
how would I translate this into a let
binding? private static final Set<String> supportedApplicationIds = new HashSet<String>();
would it be like (let [supportedIds (HashSet.)] …
? If so, where does Set<String>
come into play here?
@jeremyraines: does the consuming code need a HashSet specifically? Clojure’s set implements Java set interface
I’m not sure. This is the entire class I’m trying to convert (it’s an example that Amazon gives for something you can stick on Lambda to respond to Alexa speech events):
I could try it out as a plain Clojure set, but first I need to understand how to represent that super
call in my -init
function (I think)
basically: :exposes {super-method-name exposed-method-name}
but I don’t know what to put in that map. I assume the latter is -init
or maybe init
but how do I refer to the superclass’s constructor fn?
sorry :expose-methods . . .
all but the middle
I think it would be clear if the function of the superclass were anything other than its constructor. I don’t know how to refer to it
maybe I can just not extend anything and just make my -init
body be (SpeechRequestStreamHandler. (HelloWorldSpeechlet.) supportedIds)