« first day (384 days earlier)      last day (3140 days later) » 

9:28 AM
anyone knows about MATLAB
i've a question about it
 
9:58 AM
@MRS1367,Hello. Ask. The probability of obtaining a response will be greater than if you do not ask :)
 
@FoggyFinder -> tnx
classdef (Sealed = true) LwieaAlgorithm
    properties
        r
        d_n
    end

    methods (Sealed = true)
        function ET = Test(this, arg1, arg2)
            // some stuffs

            this.r = floor(arg1);
            this.d_n = arg2;

            // some stuffs

            Test = this.r + this.d_n;
        end
    end
end
it's a sample code
when a user instantiates from this class and uses that function like this:
obj = LwieaAlgorithm();
obj.TotalEnergyDissipation(1, 1)
and the function ends
I want the set values for that properties, store in the created instance of the class too
I want to know how can I get this.
tnx in advance
for example:
in this situation that I mentioned above(after ending the function):
obj.r // []
obj.d_n // []
and I want this:
obj.r // floor(arg1)
obj.d_n // arg2
 
you already asked on the site?
 
@FoggyFinder -> nope
cuz I think that it's and easy question
and I only ask my complicated questions in SO
not my easy questions
if u check my profile
u'll see that my questions :D
 
10:17 AM
Probably, but somewhere need to ask simple questions :)
I do not know MATLAB, but I'll try to find an answer to question
 
@FoggyFinder -> tnx mate
 
user4651282
10:50 AM
@MRS1367, hello. You need use Handle class not value.
 
@Atomic_alarm -> tnx. lemme check :)
 
11:05 AM
@Atomic_alarm -> tnx a lot
it worked like a charm! :D :) ^_^
 
everything turned out?
 
@FoggyFinder -> yep
 
@MRS1367, @Atomic_alarm, Then come here more often :)
 
@FoggyFinder -> I'm always here
but I'm not doing F# coding at this moment
so, I'm sleep in most of cases :D
@FoggyFinder -> can ask about other PLs and PTs in here too?
 
user4651282
@MRS1367 , =)
 
user4651282
11:12 AM
@FoggyFinder, I do not write code in F #
 
PL = Programming Language and PT = Programming Technology
 
@MRS1367, don't know, why not?
 
@FoggyFinder -> if can, I can be active in here too
to talk and help ppl and get help from them :)
 
I'm all for it :)
 
I'm mostly active in here:

 Persian Chat

It's a room for Iranian people to discuss about programming pr...
cuz can talk about every thing, not about one specific thing in Programming
and now, I'll be active in here too
I was very active in C# room too before
but for my new projs, I'm not active in there
@JohanLarsson -> Hi
he knows me :)
and I know him too :)
in here, can ask about SharePoint too?
in Sugarcube Corner on Meta Stack Exchange Chat, 23 hours ago, by MRS1367
query.Query = String.Format("<Where><Eq><FieldRef Name='Title'><Value Type='Text'>" + properties.AfterProperties["Title"].ToString() + "</Value></Eq></Where>");
SPListItemCollection splicFoundRecord = mySPList.GetItems(query);
my problem have been described in there
@FoggyFinder -> what's ur skills?
@Atomic_alarm -> wbu? ^
 
11:22 AM
I'm not allowed in Persian chat - i from Ukraine :)
 
23 secs ago, by MRS1367
@FoggyFinder -> what's ur skills?
 
In addition, I have recently started to learn English, so I am sometimes hard to understand
 
@FoggyFinder -> it's for every one and specially for Persian persons
every one can talk in Persian or English mainly or in his/her language with his/her mates, if they know his/her language :)
 
it is convenient
 
11:39 AM
hi
someone can verify a F# code that I have written?
 
Hello
Code is big?
 
12:16 PM
no
 
 
3 hours later…
2:49 PM
there is a link to it?
 
What does it mean to give an application of a function?
 
 
3 hours later…
5:36 PM
@MRS1367 hi
 
 
2 hours later…
7:33 PM
@Dahl Did you get your answer? If not, feel free to ping me again if you see me online, and I can try to help you understand it
 
8:25 PM
@Dahl, Hello. I'm just a little misunderstood your question, so was not able to answer it
 
8:43 PM
@JohanLarsson -> hw r u?
 
hello
may I have some advice about one of my short code in F#
?
hi?
 
long time I've not see u mate
 
hello?
someone is here?
 
can you help me?
first did you know F#?
 
8:57 PM
long time I've not see u mate
 
@FoggyFinder can you help me?
can someone answer to me
 
maybe, ask a question
 
ok may I have some advice about one of my short code in F#?
im new to F# and I am building a little program to train me
but I have a problem
here is the code
type BankAccount(initialSold : float, Owner : string) =
let TransactHistory : string [] = null
member val Sold = initialSold with get, set
member this.Owner = Owner
member this.DoTransaction(t : TransactionType) =
let transaction = Transaction(this, t)

override this.ToString() =
this.Owner + " has " + this.Sold.ToString() + " $."

type TransactionType =
| Deposit of float
| Withdraw of float
| Transfer of BankAccount * float

type Transaction(hostAccount : BankAccount, transactionType) =
do match transactionType with
I am making a type BankAccount with a method Dotransaction that take my type Transaction that I have defined
 
maybe save code in dotnetfiddle.net or ideone.com?
 
but I have an error, it says that I not define the transaction type!
here is my ideone
can you help me?
 
9:04 PM
few minute
 
thanks
I have an error, it says that I NOT have defined the Transaction type!
I think the error is dumb so I am referring to you
 
of course. set Transaction type to first, it's not C#
 
ok but now it says that BankAccount is not defined
because I use it in Transaction
how to do that?
if it is impossible I die
so...
I am so curious to know the answer
 
Few minutes i try find solve
 
sorry thanks
 
9:13 PM
use "and"
 
how ?
for recursion
I'm not familiar with this concept
type recursion is akward can you say me where to put the and?
 
.... override this.ToString() =
this.Owner + " has " + this.Sold.ToString() + " $."

and TransactionType =...
 
and the Transaction class?
ok this works!
but my let statement doesn't
member this.DoTransaction(t : TransactionType) =
let transaction = Transaction(this, t)
the let is incomplete what to add?
 
yes, what you want from him?
 
the let is incomplete
I get an error
I says that he except an expression
but this line is correct?
let transaction = Transaction(this, t)
what's worng
I want to create a new Transaction with the current Bank Account and the TransactionType t
in args
this says that Transaction is not defined !
lol
I will add an AND
this works!
double and !
 
yes but I get another error
says that the constructor of Withdraw is no defined
strange
| Withdraw amount -> hostAccount.Sold <- hostAccount.Sold - amount
this line says that Whithdraw don't have constructor
 
what is "amount"?
 
amout is the amount of money
sorry
are you here?
 
Transaction must change transferred BankAccount?
 
yes
it says that Withdraw is not defined
but it says nothing to Deposit
according that I put 2 and
 
9:35 PM
show me how you do it
 
like you said in ideone
like that
and I suppressed the let statement in
member this.DoTransaction(t : TransactionType) =
let transaction = Transaction(this, t)
but I don't want to return the Transaction!
 
I think your problem is rather in the logic of building types
 
it seems legal
 
now Transaction is type, maybe you want make it as method?
 
hmmm
yes
I can but we have to separe them from the class
I did things like that for respecting good patterns
but now I have strange errors
 
yes good idea
but capsulating this in a type wasn't so complicated
can you explain me the role of and ?
keyword
 
anyone feel like writing a stack overflow chat <-> irc bot so we can bridge here and #fsharp on irc?
 
Again I get this STUPID ERROR
WITHDRAW IS NOT DEFINED
YES I DEFINED IT
nervermind I corrected the error
@FoggyFinder so can you explain me a last error
 
this line
member this.DoTransaction(t : TransactionType) =
let t = new Transaction (this, t)
why the let statement is not complete ?
Visual Stduio say this is not correct
I don't want to return the transaction object
 
9:51 PM
you have something to return or end the expression
 
ignore t
 
how to end the method?
how?
ignore t?
 
@Marc-AntoineJacob use 'ignore t' on the end
or don't bind it
 
next line?
 
9:52 PM
yep
or
member this.DoTransaction(t : TransactionType) =
new Transaction (this, t) |> ignore
 
this works!
 
member this.DoTransaction(t : TransactionType) =
    Transaction(this, t) |> ignore
 
why the let statement was not correct
I want to know
 
because a binding cannot be the last line in a function
 
oh this is restriction
and what is ignore
 
9:54 PM
this is a difficult one to explain, but it is fundamental to ML languages
 
yes I am new to F#
 
ignore is just what it says, it tells the compiler you don't care about the result
 
but Ive done a lot of C#
 
what languages have you used previously?
ok
 
9:55 PM
so in C# can you do this? func() { var e = 1; }
(i hope you can't, i dont know much C#, but maybe you can and my example will be useless ;p)
 
public void MYFUNC() {var e = 3}
yes
work properly
 
hmm ok bad example then
im trying to think of a good way to explain this
 
so F# figure out that a last let binding is dumb because you will not reuse it ?
what i understood from myself
 
F# is trying to return something, because F# does implicit 'return' of the last thing in a function
 
ok so he try to return the let
but it is impossible
 
9:57 PM
yup
maybe like this in C#? func() { return (var e = 1) }
(again i hope this doesnt work, but i have no confidence that it doesnt!)
 
but we can't specify the return type like in C# we can write void and you doN't have to return anything
not working
 
yes, but you can return 'unit'
 
I always asking this question what is unit?
 
which can be used in place of void
this is the good explanation of unit: msdn.microsoft.com/en-us/library/dd483472.aspx
 
ok, a strange name
 
9:59 PM
sorta, but it means you dont confuse it with void
which it isnt
void is available in F# but its just a wrapper for native interop, and it gets translated to unit for that special case afaik
 
only in interop code
(pinvoke)
 
recursion is very strange my code have to use it and I didn't ever know!
type recursion is very strange
 
is it?
 
I don't understand but I put 2 and keyword and my code worked
"and"
 
10:01 PM
oh
 
unlike in C# if I declare a type before another »I will not be able to use the second type in the first type
I don't like that
 
order of ads is important in F #
 
too complicated
but I know that we can add new keyword to F# ?
 
first, you can just remember. Although it's actually logical
 
but I know that we can add new keyword to F# ?
how ? I always wondered a language who do that
 
10:05 PM
abandon assumptions you have from C# on what a type system should do, and learn the language as is, knowing C# is only beneficial for knowing .NET api's
(which is a great headstart)
 
yes
so?
can we add new keyword or not?
 
what do you mean by keyword?
like the word 'let' ?
 
like for and in do while
let
...
select, orderby, mutable ...
 
you can, but that might be a bit later on in your F# learnings, it isnt exactly straightforward
 
we can !? How ? I want to learn
 
10:09 PM
i arrived at those two references using google "F# add new keyword"
 
yes but this is very unclear
 
@Marc-AntoineJacob BTW - That is something that, at first is frustrating, but turns out to be a huge feature in F#
 
I read it
 
what do you find unclear?
the stackoverflow post gives you the code
 
how to add a new keyword
 
10:10 PM
Well, it's technically not adding a new keyword
 
yes but we can only use it in mseq wich I don't know what is ?
 
those are computational expressions
but, in general, in F# - there's nothing special about "keywords" - they can almost always just be thought of as any other function
other than a few like fun, do, and let (for the most part)
 
i should ask, what exactly you want to achieve? give me an example of a keyword you want to define
 
but sequence builders, query expressions, etc - are all computational expressions, which you can create your own
and within a CE, you can define "custom keywords"
 
@ReedCopsey is spot on there
 
10:12 PM
for example
keyword pure
 
lol :)
 
prevent a binding to change of type
what lol?
 
that... is not something i can see as trivial to implement (someone might correctme here)
this sounds like a compiler level thing
but what do you mean by preventing a binding to change type? bindings can't change types already
 
hum, like prevent casts
 
yeah, you can't change the type system in F#
but there are no implicit conversions to begin with - so a "cast" is a function call ;)
 
10:15 PM
ok :0
 
i wonder if you can prevent casting of a type, i will say yes you can
but i will also say, if you are doing this with types something is going wrong
 
give me an example of CE
 
@DavidK You can't really - because a "cast" is just a function that's a mapping
so you'd have to make the type unusable - but as long as you can read out info, you can convert to another form
 
well, if you define your own type, then casting between types shouldn't be allowed?
 
"casting between types" is never allowed in F#
there are no cast operations
only functions that convert from one type to another
 
10:17 PM
no I want to write pure int and not to convert it to float or other
 
for example, say you dont want the type 'int' to be castable, you could define a type of type x = XInt of int, and use that instead of int
oh right
yeah, :?> and :> isnt really casting i guess
you can still cast with Marshal though
 
if you can read the value - and want to do something with it, you can convert it to another form
it doesn't change that binding, though
 
i do it for some network performance sensitive stuff
this is true
 
@Marc-AntoineJacob From what you're describing, pretty much any binding is already 'pure'
 
@Marc-AntoineJacob type x = PureInt of int; there you go, done :)
 
10:19 PM
wow
but NOT in C#
Wait ! A type of type !?
Wohhhhhhh
 
@Marc-AntoineJacob i know this is going to come off as sounding elitist or something, but really recommend you start with fsharpforfunandprofit.com, it is the best F# resource there is and you will be doing what you want in no time
 
Try F# is good
 
its ok
fsharpforfunandprofit.com besides the awkward domain name is the best resource imo
 
thanks
:)
your help is very appreciated
 
no problems
 
10:22 PM
I will come back
;)
 
ok
 
if I have other F# blues
 
btw - the "type of type" is a Discriminated Union with only one option
 
oh
simple
have a nice day or night
 
10:39 PM
@ReedCopsey does this count as casting? breaking the F# type system:codepad.org/wpRQxPbJ
i think though it is really just still using cast as a function to convert the 'obj' to the other type
although, you cant achieve the same by boxing 'p' (making it obj) and converting it to y, it will fail at runtime with an invalid cast, because that breaks CLR i think
and i think you can also overwrite the memory in the CLR that contains the 'type' of a binding
 
I wouldn't call that a cast
that actually copies the structure to a byte array, then copies the byte array into a new structure
 
yeah, i guess not :)
this is true, there is a way to do it without copying though
but even then, it isnt really casting
i think the terminology used by F# documentation around casting could be improved
it shouldn't be called casting i guess
 
the CLR doesn't really do casting ;)
so the terminology is weird in general
the only real way to do something I'd consider a "cast" on the CLR is with overlapping structs
 
what about overwriting the memory on the object which describes what type it is ;p
 
that's about the only thing I'd consider "casting"
everything else is really conversions
and, to be fair, it's an abomination to do that :p
 
10:51 PM
aha
nice hack tho
didn't know you could do that
back to troubleshooting my F# bug
 
F# is nice - it gives you " warning FS0009: Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'." if you do that :p
C# doesn't, IIRC
 
(well my own bug in F# code)
yes, but that is a limited warning imo
ive piped on about this before, but imo as soon as you use Marshal or Pinvoke you should get that warning
 
I'm happy - just got to use Gjallarhorn as an answer on SO for the first time :D
 
its possible to write unverifiable code in F# without the compiler warning you with that warning
(where as C# it forces the acknowlegement with the 'unsafe' keyword) so i guess its plus 1 to f# and minus 1 to f#
whats gjallarhorn
 
10:55 PM
ah interesting
 
11:18 PM
does using something |> fun e -> e.SomethingElse erase the copy ?
normally something.SomethingElse can cause a copy to prevent mutation
(an example would be when SomethingElse is Nullable)
 
mmm
can you provide a sample of what you mean?
 
sure 1 tic
i ran into this stuff when using the types that WsdlService generated
seeing as you can't serialise F#'s Option with WCF easily
brb
 
11:40 PM
k
 
11:57 PM
did F# 4.0 have something along the lines of piping to .NET methods without the need to create a closure?
like in F# 3.0 something |> fun e -> IO.File.WriteAllLines(@"somefile",e)
was hoping there was a change that lest you do something |> IO.File.WriteAllLines @"somefile" and have it automatically place it
but that may have been a dream
 

« first day (384 days earlier)      last day (3140 days later) »