2012.08.23 10:36 AM
hi, it's been quiet here for a while, so I'll ask you for some code golf tips.
any thoughts how to shorten this k bit :
if[&/x in".",l:(a;A)90>*x;1@/(1_,/|_[0,l?x;l]),'" \n"@#x]
link to requirements:
http://codegolf.stackexchange.com/questions/7036/print-custom-alphabet
ASCII arithmetic extends code too much.
some more tacit p may help, as well as inner map, instead of reduce ,'
2012.08.23 08:48 PM
2012.08.24 02:10 AM
2012.08.24 07:51 AM
hi, it's been quiet here for a while, so I'll ask you for some code golf tips.
any thoughts how to shorten this k bit :if[&/x in".",l:(a;A)90>*x;1@/(1_,/|_[0,l?x;l]),'" \n"@#x]
link to requirements:
http://codegolf.stackexchange.com/questions/7036/print-custom-alphabet
ASCII arithmetic extends code too much.
--
some more tacit p may help, as well as inner map, instead of reduce ,'
You received this message because you are subscribed to the Google Groups "Kdb+ Personal Developers" group.
To post to this group, send email to personal-kdbplus@googlegroups.com.
To unsubscribe from this group, send email to personal-kdbplus+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/personal-kdbplus?hl=en.
2012.08.24 08:14 AM
On Fri, Aug 24, 2012 at 3:36 AM, Patryk Bukowinski <p.bukowinski@gmail.com> wrote:hi, it's been quiet here for a while, so I'll ask you for some code golf tips.
any thoughts how to shorten this k bit :if[&/x in".",l:(a;A)90>*x;1@/(1_,/|_[0,l?x;l]),'" \n"@#x]
I can't get it to work - a and A are undefined. �is l the output?
2012.08.24 08:23 AM
if[&/x in".",l:(a;A)90>*x;1@/(1_,/|_[0,l?x;l]),'" \n"@#x]
I can't get it to work - a and A are undefined. �is l the output?
Just run it from .Q namespace:
q)\d .Q
q.Q)A
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
q.Q)a
"abcdefghijklmnopqrstuvwxyz"
2012.08.24 09:03 AM
2012.08.24 11:14 AM
true, but to be fair-play one should just use of the mill stuff.
there are plenty of guys down-voted for answers like:
"cstmAZ()" write compiler/interpreter on your own ...
(beyond John Skeet on SO - but that's 1st place karma...;-) )
I've already punished myself for global variable...
can't beat this fancy GolfScript...
2012.08.24 04:13 PM
2012.08.26 04:48 AM
2012.08.26 12:12 PM
2012.08.29 05:06 AM
2012.08.29 06:08 AM
This may help reduce the code, and it has the advantage of not needing .q workspace:� x:3 �/"C"� 10h$65+25#<x>!26"DEFGHIJKLMNOPQRSTUVWXYZAB"
2012.08.29 08:14 AM
<x> that's neat 🙂
I didn't go this direction because of input param conversion, so decided to stick with string ops, namely: _
Tried simmilar aproach in second� email, it was aware of U/L case; even though was still missing input check...which takes most of the chars.
As I've mentioned, without char array arithmetic ("a"+65 - like c guys did, very clever stuff with masks etc..), it will be v. difficult to zip it more....
EMEA
Tel: +44 (0)28 3025 2242
AMERICAS
Tel: +1 (212) 447 6700
APAC
Tel: +61 (0)2 9236 5700
KX. All Rights Reserved.
KX and kdb+ are registered trademarks of KX Systems, Inc., a subsidiary of FD Technologies plc.