joker

Discuss all things joker, the Clojure interpreter/linter on top of Go. https://github.com/candid82/joker
2019-01-24T21:34:08.012200Z

How does one parse numbers in Joker? In Clojure, I’d call a Java constructor for a numeric type, but that approach obviously won’t work in Joker.

jcburley 2019-01-24T21:44:35.012300Z

Joker really needs a much larger standard library, and I hope to provide (relatively soon) a version that wraps at least half of Go's std library (to address issues like this) -- not yet up to that %, but slow progress is being made.

jcburley 2019-01-24T21:45:03.012500Z

In the meantime, here ya go:

user=> (with-in-str "123" (read))
123
user=>
(Wrap in try as needed.)

jcburley 2019-01-24T21:56:07.012900Z

If you want to be ahead of the not-even-bleeding-yet-it's-such-a-fresh-cut edge, you could try my fork of Joker (see https://github.com/jcburley/joker) and use something like this:

user=> (sort (keys (ns-publics 'go.std.strconv)))
(Atoi CanBackquote FormatBool FormatInt Itoa ParseBool ParseInt ParseUint Quote QuoteToASCII QuoteToGraphic Unquote)
user=>  (doc go.std.strconv/Atoi)
-------------------------
go.std.strconv/Atoi
([_s])
  Atoi returns the result of ParseInt(s, 10, 0) converted to type int.

Go input arguments: (s string)

Go return type: (int, error)

Joker input arguments: [^String s]

Joker return type: [Int Error]
nil
user=>
(go.std.strconv/Atoi "123")
[123 nil]
user=>
I'd like to think that'd be a lot faster, but have not measured it yet!

2019-01-24T23:21:37.013200Z

read or read-string will work just fine for my purposes. Thanks!

1👍