00:01
themsay has joined #ocaml
00:20
jao has quit [Remote host closed the connection]
00:26
zolk3ri has quit [Quit: Lost terminal]
00:35
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
00:35
jao has joined #ocaml
00:41
jaar has quit [Ping timeout: 252 seconds]
00:48
orbifx has quit [Ping timeout: 244 seconds]
00:50
themsay has quit [Ping timeout: 246 seconds]
01:04
pierpal has quit [Ping timeout: 250 seconds]
01:07
jmiven has quit [Quit: co'o]
01:08
jmiven has joined #ocaml
01:16
al-damiri has quit [Quit: Connection closed for inactivity]
01:44
jao has quit [Remote host closed the connection]
02:01
objmagic has joined #ocaml
02:03
objmagic has quit [Client Quit]
02:05
jao has joined #ocaml
02:11
themsay has joined #ocaml
02:18
kvda has joined #ocaml
02:24
objmagic has joined #ocaml
02:33
mfp has quit [Ping timeout: 240 seconds]
03:29
tormen_ has joined #ocaml
03:32
tormen has quit [Ping timeout: 244 seconds]
03:44
jao has quit [Remote host closed the connection]
03:53
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
04:06
jao has joined #ocaml
04:15
objmagic_ has joined #ocaml
04:16
objmagic has quit [Ping timeout: 250 seconds]
04:24
objmagic_ has quit [Ping timeout: 244 seconds]
04:36
objmagic has joined #ocaml
04:54
nullifidian_ has joined #ocaml
04:58
nullifidian has quit [Ping timeout: 268 seconds]
04:58
ygrek has quit [Ping timeout: 250 seconds]
05:54
esum has joined #ocaml
06:22
jao has quit [Remote host closed the connection]
06:23
jao has joined #ocaml
06:33
jao has quit [Ping timeout: 250 seconds]
06:33
wickedshell has quit [Ping timeout: 250 seconds]
06:41
wickedshell has joined #ocaml
07:12
kalio has quit [Ping timeout: 268 seconds]
07:12
kalio has joined #ocaml
07:17
jaar has joined #ocaml
07:40
sagotch has joined #ocaml
08:19
sgnb has joined #ocaml
08:26
Haudegen has joined #ocaml
08:27
<
ruffy_ >
I wanted to use a standard List function of Haskell in OCaml. I simply copied the source code and adapted the syntax, but I don't know why this is not working. Can anybody help me?
08:27
<
ruffy_ >
let rec permutations xs0 =
08:27
<
ruffy_ >
let rec perms xs is = match xs with
08:27
<
ruffy_ >
| [] -> []
08:27
<
ruffy_ >
| (t::ts) ->
08:27
<
ruffy_ >
let rec interleave' f xs' r = match xs' with
08:27
<
ruffy_ >
| [] -> (ts, r)
08:27
<
ruffy_ >
| (y::ys) ->
08:27
<
ruffy_ >
let (us,zs) =
08:27
<
ruffy_ >
interleave' (f @.@ (cons y)) ys r
08:27
<
ruffy_ >
(y::us, f (t::y::us) :: zs)
08:27
<
ruffy_ >
let interleave xs r =
08:28
<
ruffy_ >
let (_,zs) =
08:28
<
ruffy_ >
interleave' id xs r
08:28
<
ruffy_ >
foldr interleave (perms ts (t::is)) (permutations is)
08:28
<
ruffy_ >
xs0 :: perms xs0 []
08:28
<
ruffy_ >
permutations [1;2] gives [[1; 2]; [1; 1; 2]; []]
08:30
<
ruffy_ >
@.@ is function composition, and foldr an alias to fold_right
08:31
<
ruffy_ >
the desired result for [1;2] would be [[1;2];[2;1]]
08:50
themsay has quit [Ping timeout: 246 seconds]
08:51
sgnb has quit [Remote host closed the connection]
08:52
sgnb has joined #ocaml
08:58
kakadu has quit [Remote host closed the connection]
08:58
kakadu has joined #ocaml
09:19
nullifidian_ is now known as nullifidian
09:22
jaar has quit [Ping timeout: 252 seconds]
09:25
<
octachron >
ruffy_, you should link to a copy-pasting site or from sketch.sh to make your code more readable
09:25
<
vsiles >
ruffy_: can you paste the original haskell code too ?
09:26
sgnb has quit [Remote host closed the connection]
09:27
sgnb has joined #ocaml
09:46
<
vsiles >
ruffy_: foldr in Haskell and List.fold_right in ocaml don
09:46
<
vsiles >
't have the same signature
09:47
<
vsiles >
the last two arguments must be switched
09:47
<
vsiles >
foldr :: (a -> b -> b) -> b -> [a] -> b in Haskell vs (a -> b -> b) -> a list -> b -> b in ocaml
09:50
kjak has quit [Ping timeout: 268 seconds]
10:00
<
ruffy_ >
vsiles: thx, that was my mistake.
10:01
sgnb has quit [Remote host closed the connection]
10:02
sgnb has joined #ocaml
10:07
jaar has joined #ocaml
10:18
<
notnotdan >
yeah the one in ocaml stdlib is not very curry-able
10:18
<
notnotdan >
there is a version in JaneStreet's library which has named arguments
10:36
sgnb has quit [Remote host closed the connection]
10:37
sgnb has joined #ocaml
10:41
kakadu has quit [Remote host closed the connection]
10:43
kakadu has joined #ocaml
10:48
mfp has joined #ocaml
11:02
Haudegen has quit [Read error: Connection reset by peer]
11:09
sgnb has quit [Remote host closed the connection]
11:10
sgnb has joined #ocaml
11:18
zolk3ri has joined #ocaml
11:21
nicoo has quit [Remote host closed the connection]
11:21
nicoo has joined #ocaml
11:44
sgnb has quit [Remote host closed the connection]
11:45
sgnb has joined #ocaml
11:51
sagotch has quit [Quit: Leaving.]
12:00
slamzy has joined #ocaml
12:18
sgnb has quit [Remote host closed the connection]
12:19
sgnb has joined #ocaml
12:24
jao has joined #ocaml
12:25
sgnb has quit [Remote host closed the connection]
12:31
sspi has quit [Ping timeout: 252 seconds]
12:31
sspi has joined #ocaml
12:36
zolk3ri has quit [Ping timeout: 256 seconds]
12:40
KeyJoo has joined #ocaml
13:02
sagotch has joined #ocaml
13:30
FreeBirdLjj has joined #ocaml
13:35
FreeBirdLjj has quit [Ping timeout: 245 seconds]
13:45
objmagic has quit [Ping timeout: 245 seconds]
14:01
spew has joined #ocaml
14:13
pierpal has joined #ocaml
14:23
zolk3ri has joined #ocaml
14:34
slamzy has quit [Quit: Leaving]
14:47
objmagic has joined #ocaml
14:53
jao has quit [Remote host closed the connection]
15:01
jao has joined #ocaml
15:04
al-damiri has joined #ocaml
15:04
slamzy has joined #ocaml
15:08
jao has quit [Remote host closed the connection]
15:19
jao has joined #ocaml
15:25
zolk3ri has quit [Remote host closed the connection]
15:26
zolk3ri has joined #ocaml
15:29
slamzy has quit [Quit: Leaving]
15:36
KeyJoo has quit [Quit: KeyJoo]
15:39
zolk3ri_ has joined #ocaml
15:42
zolk3ri has quit [Remote host closed the connection]
15:42
zolk3ri_ is now known as zolk3ri
15:52
pierpal has quit [Read error: Connection reset by peer]
15:52
pierpal has joined #ocaml
16:08
jonatan has joined #ocaml
16:20
jao has quit [Ping timeout: 244 seconds]
16:23
ziyourenxiang has quit [Ping timeout: 240 seconds]
16:26
bartholin has joined #ocaml
16:31
FreeBirdLjj has joined #ocaml
16:41
gareppa has joined #ocaml
16:41
FreeBirdLjj has quit [Remote host closed the connection]
16:43
FreeBirdLjj has joined #ocaml
16:44
waleee has joined #ocaml
16:48
FreeBirdLjj has quit [Ping timeout: 240 seconds]
16:51
ygrek has joined #ocaml
16:53
FreeBirdLjj has joined #ocaml
17:10
gareppa has quit [Read error: Connection reset by peer]
17:29
sagotch has quit [Quit: Leaving.]
17:33
jao has joined #ocaml
17:34
ygrek has quit [Ping timeout: 240 seconds]
17:36
FreeBirdLjj has quit [Remote host closed the connection]
17:40
jnavila has joined #ocaml
17:53
jnavila has quit [Ping timeout: 252 seconds]
17:53
marsam has joined #ocaml
18:10
jnavila has joined #ocaml
18:13
kakadu_ has joined #ocaml
18:21
kjak has joined #ocaml
18:22
zolk3ri has quit [Ping timeout: 256 seconds]
18:34
marsam has quit [Ping timeout: 252 seconds]
18:52
jaar has quit [Ping timeout: 252 seconds]
19:00
nullifidian has quit [Read error: Connection reset by peer]
19:01
nullifidian has joined #ocaml
19:03
jnavila has quit [Ping timeout: 246 seconds]
19:29
themsay has joined #ocaml
19:35
Haudegen has joined #ocaml
19:51
objmagic has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
19:53
objmagic has joined #ocaml
19:55
themsay has quit [Ping timeout: 250 seconds]
20:02
jnavila has joined #ocaml
20:06
bartholin has quit [Remote host closed the connection]
20:06
zolk3ri has joined #ocaml
20:09
ygrek has joined #ocaml
20:19
slamzy has joined #ocaml
20:45
pierpal has quit [Ping timeout: 240 seconds]
21:08
al-damiri has quit [Quit: Connection closed for inactivity]
21:26
mengu has joined #ocaml
21:30
kvda has joined #ocaml
21:31
Haudegen has quit [Ping timeout: 250 seconds]
21:32
Haudegen has joined #ocaml
21:34
themsay has joined #ocaml
21:37
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
21:40
kvda has joined #ocaml
21:54
mengu has quit [Remote host closed the connection]
21:56
waleee has quit [Quit: WeeChat 2.3]
21:57
objmagic has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
21:58
objmagic has joined #ocaml
22:01
orbifx has joined #ocaml
22:01
objmagic has quit [Client Quit]
22:02
objmagic has joined #ocaml
22:07
nullifidian_ has joined #ocaml
22:09
slamzy has quit [Ping timeout: 256 seconds]
22:10
nullifidian has quit [Ping timeout: 250 seconds]
22:12
jnavila has quit [Remote host closed the connection]
22:13
sonologico has joined #ocaml
22:20
marsam has joined #ocaml
22:22
marsam has quit [Remote host closed the connection]
22:23
marsam has joined #ocaml
22:31
objmagic has quit [Read error: Connection reset by peer]
22:31
objmagic has joined #ocaml
22:32
mengu has joined #ocaml
22:33
steenuil has quit [Remote host closed the connection]
22:34
steenuil has joined #ocaml
22:37
mengu has quit [Ping timeout: 244 seconds]
22:47
jao has quit [Remote host closed the connection]
23:02
objmagic has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
23:04
mengu has joined #ocaml
23:09
mengu has quit [Ping timeout: 240 seconds]
23:11
zolk3ri has quit [Ping timeout: 256 seconds]
23:12
jao has joined #ocaml
23:12
anmonteiro has joined #ocaml
23:12
orbifx has quit [Ping timeout: 268 seconds]
23:18
zolk3ri has joined #ocaml
23:19
kfor has joined #ocaml
23:26
kfor has quit [Ping timeout: 256 seconds]
23:32
kakadu_ has quit [Remote host closed the connection]
23:35
Haudegen has quit [Remote host closed the connection]
23:51
objmagic has joined #ocaml
23:55
objmagic has quit [Ping timeout: 245 seconds]
23:59
objmagic has joined #ocaml