Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jun 15 07:25
    ABeltramo commented #66
  • Jun 15 07:24
    ABeltramo synchronize #66
  • Jun 15 07:07
    ABeltramo commented #65
  • Jun 13 21:28
    metasoarous commented #66
  • Jun 13 21:26
    metasoarous commented #65
  • Jun 11 08:47
    ABeltramo opened #66
  • Jun 11 08:44
    ABeltramo opened #65
  • May 24 06:23
    mahinshaw commented #35
  • May 24 06:22
    mahinshaw synchronize #35
  • May 24 06:08
    mahinshaw commented #35
  • May 24 05:13
    mahinshaw commented #64
  • May 22 06:29

    metasoarous on master

    Fix for #61 Merge pull request #62 from mah… (compare)

  • May 22 06:29
    metasoarous closed #62
  • May 22 06:29
    metasoarous commented #62
  • May 22 06:28
    metasoarous commented #64
  • May 22 04:45
    metasoarous commented #64
  • May 21 20:02
    mahinshaw commented #64
  • May 21 20:01
    mahinshaw commented #64
  • May 21 17:15
    urzds commented #64
  • May 21 16:23
    mahinshaw commented #64
Benjamin Rosas
@ballPointPenguin
ok
Christopher Small
@metasoarous
Can just assume those are doubles as far as I'm concerned
Benjamin Rosas
@ballPointPenguin
I wanted to test the 2nd col gets cast as int if you sniff-lines 1-2, then maybe test the "error-handler" on the 3rd item in that case.
I mean the 3rd col
Christopher Small
@metasoarous
(in theory we could check to see if the precision would make them ints, but it's more trouble than it's worth for such a candy function like this)
Benjamin Rosas
@ballPointPenguin
"candy function" with sugar
Christopher Small
@metasoarous
Heheh
"curry function" with extra sauce
I would actually say that if there are any decimals, cast as doubles
Benjamin Rosas
@ballPointPenguin
sure
Christopher Small
@metasoarous
Even for the 1.0, 2.0, 3
Benjamin Rosas
@ballPointPenguin
That was my intention
Christopher Small
@metasoarous
If someone put those decimals in the file, it probably means they wanted them interpretted as doubles
Benjamin Rosas
@ballPointPenguin
agreed
Christopher Small
@metasoarous
If someone put a bunch of 12323,2872387,28937,...
Then we can assume they really wanted ints
In theory, we could let people specify their own sniffer configurations, but again... candy rots your teeth
Benjamin Rosas
@ballPointPenguin
and if (1 2 "three" 4 5), we can only assume String
Christopher Small
@metasoarous
Hahah
Yes...
We are not catering to that insanity
Benjamin Rosas
@ballPointPenguin
Well, if we attempt to "sniff" and there is a string in there, our sniff fails and we return all strings, no?
or, well, I guess that's up to the fail-handler
wait. the fail-handler only gets called if we sniff x rows and find a pattern, but then a row x + * does not conform. Something else happens if the sniff fails (we don't cast at all, I think).
Benjamin Rosas
@ballPointPenguin
ok so my test is failing how it should:
(not (= ("1" "2" "3") [1 2 3]))
now I just need to actually implement somehting...
Christopher Small
@metasoarous
Yes; the fail-handler would only get called after the first N rows have been "sniffed". And yes, if something doesn't match in the first N, we just leave them as strings and don't cast.
Awesome! Time to codez!
Benjamin Rosas
@ballPointPenguin
my impulse is to do something naive and OO-like. Thinking about a more lispy approach...
Christopher Small
@metasoarous
One thing you may not be aware of yet: The semantic-csv/impl/core.clj file is a space for implementation details. So anything you end up writing that isn't part of the core API (that is, that you would expect our users to call themselves) should go in there. If there is a bunch of such things, we could also add a semantic-csv/impl/sniffers.clj file/ns.
Benjamin Rosas
@ballPointPenguin
makes sense.
Christopher Small
@metasoarous
Just think about it as a bunch of functions
Benjamin Rosas
@ballPointPenguin
haha yeah. not that I have any other choice.
aren't we all, truly, just a bunch of functions?
Christopher Small
@metasoarous
Also, those things you put in semantic-csv.core.impl can be accessed in the main api namespace as impl/the-function-name
heheh
Benjamin Rosas
@ballPointPenguin
I see
Christopher Small
@metasoarous
Well, there are Records and Protocols
Could possibly use those
They carry some of the better patterns you get from OO in a rather clean and extensible way. There are some advantages to doing that, but for now, let's just keep things simple. As we refactor we can decide whether or not we want to do something fancy with those.
Benjamin Rosas
@ballPointPenguin
I need to learn more clojure.
I've heard good things.
Christopher Small
@metasoarous
:-)
Benjamin Rosas
@ballPointPenguin
as a last-ditch move before going off-grid, I MR'ed two failing-tests.
although you may chose to just close them, or write your own, or wait until I get back.
Wish I could have written some actual features or even a bug-fix :) but, it's been a good exercise nonetheless. Hopefully I'll have more momentum in a week.
Christopher Small
@metasoarous
Yo!
Just looked at that; thanks!
Left you a comment on GH in case you want to look at it