Live data from Hacker News

Show HN: A tool that transforms your whole list with just one example

transformy.io

131–140 of 151 posts

Re: Show HN: A tool that transforms your whole list with just one example

#131

As mentioned by others, this is implemented in Excel 2013 as Flash Fill feature. https://www.youtube.com/watch?v=UccfqwwOCoY

I just attended a talk but Sumit Gulwani where he demo'd FlashFill, FlashExtract and walked through their underlying architecture. His talk had much cooler demos than any I could find online but from what I can tell it seems like they provide a superset of transformy's functionality (not to detract from it, this is very cool, and I'd be curious to see how related the underlying theories are). Apparently current work by that team at Microsoft is focused on abstracting out functionality into a system called FlashMeta so that it can be applied to a bunch of domain specific problems. Overall very exciting work, from both parties.

Re: Show HN: A tool that transforms your whole list with just one example

#132

Good concept but doesn't work. Example, type different variations of legal well formatted addresses. 1 Microsoft Way Apt 43, Redmond, WA 98065, U.S.A. 1-1/4 Palm Hwy, Colino, MA 87009, USA 500 Potasium Cloride, Sunshite-Big Blow City, PA 30000, United States of America First line output should look like: 1 Redmond 98065 U.S.A. Also having country-specific obscure sports terminology on landing page example can cause l…

We intend to support this in future versions but haven't gotten to it yet. It makes things a little more complicated.

Re: Show HN: A tool that transforms your whole list with just one example

#133

Good concept but doesn't work. Example, type different variations of legal well formatted addresses. 1 Microsoft Way Apt 43, Redmond, WA 98065, U.S.A. 1-1/4 Palm Hwy, Colino, MA 87009, USA 500 Potasium Cloride, Sunshite-Big Blow City, PA 30000, United States of America First line output should look like: 1 Redmond 98065 U.S.A. Also having country-specific obscure sports terminology on landing page example can cause l…

Figuring out a format for addresses is actually really hard.

https://www.mjt.me.uk/posts/falsehoods-programmers-believe-a...

Re: Show HN: A tool that transforms your whole list with just one example

#134
post #63

Nice tool and concept dude. But it doesn't seems to look properly at the meaning of content though. I mean, I think it just finds the first presence of what the given pattern is and generates the result. For example, I attempted this, with input data as date/time. input data: 2015-09-15T09:15:17-05:00 1998-11-05T08:15:21-05:00 1999-01-03T04:33:30-05:00 2000-11-05T09:16:00-05:00 pattern: 09:15 on 09-15 result: 09:15 o…

With the TXR language:

  @(collect)
  @year-@month-@{day}T@hh:@mm:@ss-@tzh:@tzm
  @(end)
  @(output)
  @  (repeat)
  @hh:@mm on @month-@day
  @  (end)
  @(end)
Or:

  @(repeat)
  @year-@month-@{day}T@hh:@mm:@ss-@tzh:@tzm
  @(do
     (put-line `@hh:@mm on @month-@day`))
  @(end)
On the command line:

  $ txr -c '@(repeat)
  blah
  ...
  @(end)' - # dash for stdin or file name
From a file:

  $ txr script.txr file
I see we have a mistake in the handling of time zones; the minus sign is part of the time zone offset. Perhaps a small dash of regex, maybe:

  @year-@month-@{day}T@hh:@mm:@ss@{tzh /[+-]\d\d/}:@tzm

Re: Show HN: A tool that transforms your whole list with just one example

#135

Earlier quoted context omitted.

Sketching is a superset of programming by example. In examples, you only get input/output pairs, which as this thread shows, infers frustratingly close but wrong programs. In sketching, the input and output can also includes partial programs (sketches), so you can mark what you like, tweak, etc, and it fills in the rest. Increasing usability, the fragments can be in different languages. For example, input can be simp…

Cool. I have been mulling what it would be like to have a semigraphical tool to generate SQL queries (Spark,Hive,VoltDB,etc) where the user would drive a keyboard applying operators over columns, rows and relations for mapping, filtering, joining. Like VIM plus ZPL and the goal is a statistical result over some range. Why can't prolog programs generate our programs? One of my query visualizations is an origami like s…

Indeed -- check out my strangeloop talk on places we did this :) http://www.infoq.com/presentations/dsl-visualization

Re: Show HN: A tool that transforms your whole list with just one example

#136
post #50

This is a great idea! It didn't behave the way I expected with some URLs as input, though: http://example1.org/path/index.html http://www.example2.org/path/index.html http://www.example3.org/ https://www.example4.org/a/b/c/d/e/f/g/hijklmnop The pattern I gave was: example1.org, path/index.html So I expected to get: example1.org, path/index.html www.example2.org, path/index.html www.example3.org, www.example4.org, a/b…

TXR language:

   @(repeat)
   @proto://@domain/@path
   @(do (put-line `@domain, @path`))
   @(end)

Re: Show HN: A tool that transforms your whole list with just one example

#137
Buggy, all I did is add Dean middle name to third line

  In:
  3, Roberto Carlos, soccer, Brazil
  35, Michael Jordan, baseball, USA
  6, James Dean Lebron, basketball, USA
  10, Shinji Kagawa, soccer, Japan

  Ex: Carlos is number 3 playing soccer

  Out:
  Carlos is number 3 playing soccer
  Jordan is number 35 playing baseball
  Dean is number 6 playing Lebron (what??)
  Kagawa is number 10 playing soccer
I guess you can't really solve the ambiguity of Carlos meaning the second word on the second column versus the last word of the second column; but the commas should at least hint a tabular pattern, no?

Re: Show HN: A tool that transforms your whole list with just one example

#138
post #104

On your main screen, make the example editable. It would be nice to be able to just enter into the green box to see how it works rather than have to click through the "Get Started" Also, your instructions makes it seem like the example is editable: SUPER EASY TO USE 1. Paste your source data in the white box on the left. 2. Type in the green box on the right how you would like the first line of your data to look. 3.…

+1

Re: Show HN: A tool that transforms your whole list with just one example

#139

Great tool, but too bad it can't handle code very well. An example (converting C++ to C): Input: void FileStream::write(char* , int); void VirtualMachine::cycle(int); Example: void FileStream_write(char* , int); Output: void FileStream_write(char* , int); void VirtualMachine_cycle(int* , ); Also, is it open-source?

TXR script:

  @(repeat)
  @type @class::@ident(@params);
  @  (output)
  @type @{class}_@ident(@params);
  @  (end)
  @(end)
Do this kind of thing regularly over C code, when it's too much for Vim macros.

I do it out of Vim. That is: first, select a range of text, then pipe it out:

  !txr some_transform_script.txr -
Done. For example, when adding functions to TXR Lisp's library, I start with a declaration like:

  static val foo(val x, val y);
I pipe this through a script which will produce this:

  reg_fun(intern(lit("foo"), user_package), func_n2(foo));
("Intern a symbol called "foo" in the user_package, and register a two-argument function object with this symbol, hosted from the C function foo.")

It's a little complicated:

  @(deffilter sym ("_" "-"))
  @(collect)
  @  (cases)
  @/(static )?/val @fun(void);@(bind arg nil)
  @  (or)
  @/(static )?/val @fun(@(coll)@{type /[^ ,]+/} @{arg /[^ ,)]+/}@(until))@(end));
  @  (end)
  @(output)
    reg_fun(intern(lit("@{fun :filter sym}"), user_package), func_n@(length arg)(@fun));
  @(end)
  @(end)
I filter underscores to dashes, because I want a C function like foo_bar to look like foo-bar in the Lisp dialect. The (void) argument list is handled as a special case.

I need to parse the arguments because the output part needs to know how many there are. Note how "func_n2" is generated, where the 2 comes from the argument count.

Re: Show HN: A tool that transforms your whole list with just one example

#140
This is pretty neat. Since were asking for features: smarter date conversions. For instance on the input: '2015-04-24', and for example output: '26 April 2015'. The if another line has '2015-03-01' it would output '1 March 2015'. This seems like a somewhat difficult problem, but it'd be magical if it worked.
Post reply on HN