<zennist>
on the question 'a string representation of binary trees (medium)'
<zennist>
The question asks 'Write an OCaml function which generates this string representation, if the tree is given as usual (as Empty or Node(x,l,r) term). Then write a function which does this inverse; i.e. given the string representation, construct the tree in the usual form. Finally, combine the two predicates in a single functiontree_string which can be used in both directions.'
<zennist>
The last part is what baffles me apparently
badon has joined #ocaml
badon_ has quit [Ping timeout: 260 seconds]
<ggole>
You could type t = Text of string | Tree of tree and then write convert : t -> t
<Drup>
yeah
<ggole>
Seems pretty useless to me.
<Drup>
it's a completly useless function, but you can do it
<ggole>
Doing the tree->string and string->tree functions is a useful exercise though.
samrat has quit [Quit: Computer has gone to sleep.]
<Drup>
(also, these functions are not predicates ...)
<ggole>
They are in Prolog, the origin of the exercises.
<ggole>
Bit of a lazy translation, I guess.
<Drup>
oooh
<Drup>
hence the exercise.
<Drup>
it's a prefectly valid thing in prolog
<ggole>
Oh, I guess so
<Drup>
bidirectionnal functions are a thing in prolog :)
englishm has quit [Ping timeout: 245 seconds]
thomasga has joined #ocaml
_0xAX has quit [Remote host closed the connection]
<zennist>
All right, I see (you guys are really knowledgeable by the way!)
<Drup>
prolog is a fun language, it's interesting to at least try it
<Drup>
(I wouldn't use it for anything serious though)
zennist has quit [Ping timeout: 250 seconds]
rand000 has quit [Ping timeout: 245 seconds]
Thooms has quit [Quit: WeeChat 0.4.3]
slash^ has left #ocaml [#ocaml]
jprakash has joined #ocaml
rand000 has joined #ocaml
Nahra has quit [Ping timeout: 240 seconds]
badon_ has joined #ocaml
badon has quit [Ping timeout: 240 seconds]
Nahra has joined #ocaml
badon__ has joined #ocaml
badon_ has quit [Ping timeout: 272 seconds]
lordkryss has joined #ocaml
rand000 has quit [Ping timeout: 260 seconds]
rand000 has joined #ocaml
thomasga has quit [Quit: Leaving.]
jprakash has quit [Read error: Connection reset by peer]
<orbitz>
hrm, does nix-env --description -qa work for anyone?
<orbitz>
wrongplace!
maattdd has joined #ocaml
Nahra has quit [Remote host closed the connection]
<MercurialAlchemi>
I'm looking at the eliom documentation
Nahra has joined #ocaml
<MercurialAlchemi>
It doesn't seem to offer support for any kind of middleware, but maybe I'm missing something
<MercurialAlchemi>
ah, I see there is something about Actions
<MercurialAlchemi>
maybe that's what I'm looking for
<Drup>
MercurialAlchemi: define "middleware"
<Drup>
everyone has a different definition
<MercurialAlchemi>
something which can set a variable by looking at the request before the service handler is executed
<MercurialAlchemi>
(urls start with /$language/, all service handlers want to know what $language is)
<MercurialAlchemi>
(side note: I'm very impressed by what I see so far, though it does sound awfully complicated)
<Drup>
MercurialAlchemi: read carefully the tutorial (and the documentation) about services
<Drup>
if you see a usecase that is not covered by the concept of services, I will be very interested to hear about it :p
ivan\ has quit [Ping timeout: 245 seconds]
typedlambda has quit [Ping timeout: 250 seconds]
<MercurialAlchemi>
Drup: I'll let you know :)
rand000 has quit [Quit: leaving]
typedlambda has joined #ocaml
<Drup>
MercurialAlchemi: you may also want to look at eliom references and scoping
<Drup>
and yes, it's complicated, I agree ...
ivan\ has joined #ocaml
<MercurialAlchemi>
well, probably no more than something like gwt :)
<Drup>
I don't know gwt
<MercurialAlchemi>
I have seen a little bit of it, and it did not seem pleasant
<MercurialAlchemi>
On the other hand, typechecked HTML5? Totally kicks ass
<Drup>
<3
<MercurialAlchemi>
What I'm a little worried about is persistence
<Drup>
MercurialAlchemi: Since you are in the middle of learning it, if you have any feedback at all, do not hesitate, I will collect it. Especially about the documentation.
<MercurialAlchemi>
It sucks in every language
<Drup>
There is out-of-the-box persistence, but it doesn't handle 1) changing types of the data 2) upgrading ocaml
<MercurialAlchemi>
just found macaque, which looks like... exactly what I was looking for
Submarine has quit [Remote host closed the connection]
<rom1504>
what a weird name
<MercurialAlchemi>
fourberie is an actual English word? awesome
<MercurialAlchemi>
one thing I would suggest, for the ocsigen tutorial, is to stay with we/our and not switch to 'I' occasionally
tane has quit [Quit: Verlassend]
msaegesser has quit [Ping timeout: 240 seconds]
<MercurialAlchemi>
it's a bit shocking to read so much doc for an ocaml project, since the doc for most of the libraries I've used so far was more like 'read the .mlis on Github'
<Drup>
ahah, imagine "just read the .mli" for eliom
<Drup>
nobody would use it
<MercurialAlchemi>
well, you would need a biiiig example folder
<MercurialAlchemi>
:D
thomasga has joined #ocaml
<MercurialAlchemi>
I need to try it for real, but I think I have a problem with ocsigen/eliom
<MercurialAlchemi>
It's going to be impossible to go back to a 'traditional' web framework after that
<Drup>
ahah
<Drup>
yes, that's a ""problem""
<MercurialAlchemi>
yes, it's the kind of problem I'm looking for
dsheets has quit [Ping timeout: 245 seconds]
<Drup>
I'm not sure if it's something we will want to fix, though
<Drup>
:D
<MercurialAlchemi>
problems like that can be solved with a judicious application of PHP
<MercurialAlchemi>
totally unrelated question, is there anything like joda-time for Ocaml?
<Drup>
what is it ?
<MercurialAlchemi>
a date/datetime/timedelta library which doesn't suck
<MercurialAlchemi>
(as opposed to Java's Date/Calendar, which is... not very good)
<Drup>
calendar
<Drup>
It's a bit verbose, and changing timezone is a bit dangerous, but it mostly doesn't suck.
oriba has joined #ocaml
<MercurialAlchemi>
it doesn't seem too terrible
<MercurialAlchemi>
timezones...
<MercurialAlchemi>
as long as you can convert anything in UTC, and then convert it out to $timezone for presentation, that's all I need
<Drup>
MercurialAlchemi: links in basicwebsite tutorial should be fixed
<MercurialAlchemi>
so they are
<MercurialAlchemi>
bravo!
<MercurialAlchemi>
however, I think I'm going to work on my sleep deficit
<MercurialAlchemi>
thanks for your assistance
<MercurialAlchemi>
and for making all that
<Drup>
ahah, I didn't make it really, just working on some tiny parts :]
<MercurialAlchemi>
well, anyway, it looks totally awesome
madroach has quit [Ping timeout: 250 seconds]
<MercurialAlchemi>
hopefully I'll have forgotten everything about it by tomorrow, when I fix issues in PHP legacy code written by monkeys
<Drup>
x)
* MercurialAlchemi
rides off on his camel
madroach has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 246 seconds]
eikke__ has quit [Ping timeout: 260 seconds]
Zemeio has joined #ocaml
zennist has joined #ocaml
<Denommus>
ok, I have been trying for some time and I still haven't figured out what I'm doing wrong
maattdd has quit [Ping timeout: 264 seconds]
manud has quit [Quit: manud]
<Zemeio>
Hello. i'm trying to learn ocaml and i got confused on one thing. When i create a type pointfloat = {x : float; y : float };; and then a type pointint = {x : int; y : int};; my pointfloat vanishes. Can anyone help me/explain me why?
<Zemeio>
Sorry for the noob question
<companion_cube>
field names are unique, so you are shadowing "x" and "y" as field names when you introduce pointint
<Zemeio>
I see, thanks
<Zemeio>
Weird rule
lpw25 has joined #ocaml
Nahra has quit [Remote host closed the connection]
Nahra has joined #ocaml
badon_ has joined #ocaml
dsheets has joined #ocaml
<zennist>
how can I concatenate a string and a character?
badon__ has quit [Ping timeout: 260 seconds]
<zennist>
String.make 1 c
<zennist>
got it
dsheets has quit [Ping timeout: 260 seconds]
manud has joined #ocaml
badon__ has joined #ocaml
badon_ has quit [Ping timeout: 250 seconds]
badon_ has joined #ocaml
badon__ has quit [Ping timeout: 264 seconds]
badon has joined #ocaml
badon_ has quit [Ping timeout: 240 seconds]
msaegesser has joined #ocaml
lpw25 has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
badon_ has joined #ocaml
darkf has joined #ocaml
badon has quit [Disconnected by services]
madroach has quit [Ping timeout: 250 seconds]
madroach has joined #ocaml
NoNNaN has quit [Remote host closed the connection]
NoNNaN has joined #ocaml
msaegesser has quit [Ping timeout: 272 seconds]
johnnydiabetic has quit [Ping timeout: 264 seconds]