As mentioned by others, this is implemented in Excel 2013 as Flash Fill feature. https://www.youtube.com/watch?v=UccfqwwOCoY
Show HN: A tool that transforms your whole list with just one example
131–140 of 151 posts
Re: Show HN: A tool that transforms your whole list with just one example
#132Good 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…
Re: Show HN: A tool that transforms your whole list with just one example
#133Good 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…
https://www.mjt.me.uk/posts/falsehoods-programmers-believe-a...
Re: Show HN: A tool that transforms your whole list with just one example
#134Nice 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…
@(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/}:@tzmRe: Show HN: A tool that transforms your whole list with just one example
#135Earlier 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…
Re: Show HN: A tool that transforms your whole list with just one example
#136This 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…
@(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 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
#138On 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.…
Re: Show HN: A tool that transforms your whole list with just one example
#139Great 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?
@(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.