Fork me on GitHub
#clojure
<
2016-07-04
>
scriptor01:07:35

what parser library would people recommend if I wanted to write a basic language?

scriptor01:07:41

instaparse looks pretty active

aengelberg01:07:35

I'm biased but I recommend instaparse especially for basic use cases.

scriptor01:07:22

@aengelberg: I'd like it to have an ML-like syntax eventually, would instaparse still be easy to work with for something like that?

aengelberg01:07:37

@scriptor: I'm not familiar with ML but I will still claim yes :)

scriptor01:07:07

@aengelberg: sounds good, thanks!

aengelberg01:07:38

Let me know on #instaparse or the instaparse Google group if you have any questions!

hiredman03:07:23

I happen to be playing with writing a parser for standard ml at the moment. ML has some some features that make parsing it difficult. instaparse will help a lot with dealing with ambiguities in the grammars you find online, but there are some features like being able to declare certain operators as infix inside specific lexical scopes which are going to be challenging, if you choose to support those features

maxp05:07:17

what's wrong with (String/format "%.f" 1.0)

maxp05:07:34

and how to make it correctly?

maxp05:07:28

answer: (String/format Locale/ROOT "%.1f" (into-array [1.0]))

aengelberg06:07:24

@maxp anything wrong with (format "%.1f" 1.0)?

maxp06:07:56

wrong default locale

maxp06:07:41

I had to use Locale/ROOT to fix incorrect decimal point issue

myguidingstar09:07:04

let's say (deftype X [])

myguidingstar09:07:26

(isa? X Object) returns true. Now given (deftype Y []), how do I make (isa? X Y) return true, too?

seylerius09:07:05

I need to parse foo^2 x^{x+1} to ["foo" [:super "2"] " x" [:super "x+1"]] with instaparse. Tips?

seylerius09:07:22

The key is that the ^ needs to immediately follow a word character (or maybe a symbol), but not be included in that parse. It needs to be part of the previous parse entry.

seylerius09:07:36

So I need something like lookback, rather than lookahead

cycle33710:07:54

can you help me with reading up on boot, any documentation besides the official website would be helpful (mainly book recommendations please?)

martinklepsch10:07:27

@avabinary: the wiki is full of good docs, have you seen it?

cycle33710:07:57

I'll take a peak, thanks @martinklepsch

martinklepsch10:07:19

@avabinary: if you have any questions there are usually people in #C053K90BR happy to help

lopalghost11:07:22

Hey, could someone explain to me why this code blows up the heap?

(with-open [rdr ...]
  (let [lines (line-seq rdr)
          [labels & data] (map parse lines)]
    (run! (partial f labels) data)))
I'm reading a large csv file, f is a passed-in function. It works fine if I use something clever like (eduction (map parse) lines). Why does the lazy sequence cause me to run out of memory?

cycle33712:07:42

@martinklepsch: oh ! i found your talk on youtube :))

bcbradley13:07:52

how do I convert from a sequence or collection like (a b c d e f g h i ...)

bcbradley13:07:15

into ([a] [b] [c] [d] [e] [f] [g] [h] [i] ...)

gerrit13:07:56

(map vector ...)

bcbradley13:07:52

thankyou! i was trying to make it too hard Xd

bronsa13:07:36

@lopalghost: which version of clojure?

lopalghost15:07:39

@bronsa 1.8, with Java 8

tom18:07:11

With schema, is there an easy way to take a schema and wrap all keys in (s/optional ...)? :flag-us: :flag-us:

bensu18:07:07

@tom: since schemas are maps, you could try (into {} (map (fn [[k v]] [(s/optional k) v]) schema)) and call that defn all-optional-keys [schema]

tom19:07:12

@bensu: ah yes, thanks!

montanonic23:07:17

Can transducers currently parallelize computations like reducers/fold can?

alexmiller23:07:35

Although the reduce phase of fold can use transducers