[過去ログ] プログラミングのお題スレ Part13 (1002レス)
前次1-
抽出解除 レス栞

このスレッドは過去ログ倉庫に格納されています。
次スレ検索 歴削→次スレ 栞削→次スレ 過去ログメニュー
153: 2019/02/12(火)21:33:58.92 ID:4uAoJeXz(1)調 AAS
>>99 Ruby
def hoge(str)
  return str if str.match?(/\A[^{}\/]*\z/)
  raise 'ERROR' if str.match?(/\A[^{]*}|{[^}]*\z/)
  a, *b = str.scan(/(?<={|\A)[^{}]*(?=}|\z)/).map{|s| s.empty? ? [''] : s.split(?/)}
  s = str.gsub(/(?:{|\A)[^{}]*(?:}|\z)/, '%s')
  a.product(*b).flat_map{|e| hoge(s % e)}.uniq.sort
end

%w[
  {あ{いう/え}/お{か/き}/く}け{こ}
  さ{し/す}せそ{{た/ち}つ/て}と]
].each{|s| puts hoge(s), $/}
# =>
あいうけこ
あえけこ
おかけこ
おきけこ
くけこ

さしせそたつと
さしせそちつと
さしせそてと
さすせそたつと
さすせそちつと
さすせそてと
199
(3): 2019/02/14(木)13:56:13.92 ID:iDdALKjs(1/2)調 AAS
abcd
badc

abab
cdcd

aaba
babb

abbb
aaab

同じパターンで埋めるのって色々できそうだけどこういうの全部いいの?
259: 2019/02/20(水)01:16:40.92 ID:SyQ4jkRO(2/3)調 AAS
>>258 Perl5
require LWP::UserAgent;
$ua = LWP::UserAgent->new;
$ua->agent('Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Win64; x64; Trident/6.0)');
use HTTP::Cookies;
$ua->cookie_jar(HTTP::Cookies->new(file => 'lwp-cookies.txt', autosave => 1));
$url = 'http://ftp.iij.ad.jp/pub/linux/centos/7.6.1810/isos/x86_64/0_README.txt';
$file = './0_README.txt';
$res = $ua->mirror($url, $file);
print $res->status_line, "\n";

実行例
~ $ perl 13_258.pl
200 OK

(※こういうのは、別に今急に考えたわけじゃなく、日常的に作って使っているのですぐ投稿できました)
365: 2019/02/24(日)09:18:40.92 ID:FkqnBGPg(1)調 AAS
>>364
ruby -e "'hello'.split('').each do |c| puts c end"
449: 2019/03/01(金)18:05:43.92 ID:nsJzseJ0(3/3)調 AAS
>>441 なんかプログラムの練習の前に、日本語のおさらいをした方が良い人間が見受けられるな。

プログラムはチームワークだから、他人に仕様が正確に伝えられなければその時点でそのプロジェクトは失敗。
理解しやすい言葉で混乱が起きない様に示すのが当たり前では?
それができない人はプログラムで問題を出しなさいよ。
548: 2019/03/08(金)04:41:32.92 ID:JrzgN4oN(1)調 AAS
#!/bin/sh
infile="aB.txt Ab.txt xx cd cD CD"
for f in ${infile}; do
echo $f $(echo $f | tr [:lower:] [:upper:])
done | awk '
{ save[$2] = save[$2] " : " $1 }
END {
for (i in save) print save[i]
}' | sed 's/^ : //' | sort | awk 'NF > 1 {print}'
586: 2019/03/10(日)21:12:33.92 ID:ObNpfzdX(1)調 AAS
ここっておっさんが多いイメージ
678
(1): 2019/03/14(木)20:14:25.92 ID:vvVzV1YI(1/3)調 AAS
>>671 どこにそんな決まりがあるの?

普通 ver.1 が出て、その後ver.1.0 が出れば、ver.1.0 の方が新しいのは明らかだろ。
総称として、ver.1という場合もあるが、その場合はver.1.9も含まれる。
740: 2019/03/17(日)23:35:38.92 ID:QL30OvU4(1)調 AAS
許さないからな
748: 2019/03/21(木)22:33:42.92 ID:4Lv8Ku6J(2/2)調 AAS
>>723 Squeak Smalltalk

| fn |
fn := [:int1 :int2 |
| strings width digits interms ans max line |
strings := {int1. int2} collect: #asString.
width := (strings detectMax: #size) size.
digits := strings collect: [:str |
(str forceTo: width paddingStartWith: $0) reversed asArray collect: #asString].
interms := (digits reduce: #+) collectWithIndex: [:interm :idx |
interm, (String new: idx-1 withAll: Character space)].
ans := interms polynomialEval: '10'.
strings atLast: 1 put: '+ ', strings last.
max := ((strings, {ans}) collect: #size) max.
line := String new: max withAll: $-.
(strings, {line}, interms, {line. ans} collect: [:str |
(str forceTo: max paddingStartWith: Character space) withoutTrailingBlanks
]) asStringWithCr
].

fn value: 987 value: 65. "=>
' 987
+ 65
----
12
14
9
----
1052' "
913
(3): 2019/05/15(水)23:43:58.92 ID:jmndeABE(1)調 AAS
>>877 c
https://ideone.com/tIcQPK

>>877 ruby
https://ideone.com/qMREyy

>>877 ocaml
https://ideone.com/uaNmRF

>>877 octave
https://ideone.com/psnXl5
前次1-
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル

ぬこの手 ぬこTOP 0.033s