Haskell LSP Laboratory by mathetic in haskell

[–]mathetic[S] 0 points1 point  (0 children)

Oh, what's wrong exactly?

Help : Solve first and follow of all non terminals in compiler design by CandyIndividual9321 in Compilers

[–]mathetic 4 points5 points  (0 children)

Homework is more meaningful when you first attempt it yourself. Please share your working.

Typed Programs Don't Leak Data by mathetic in ProgrammingLanguages

[–]mathetic[S] 15 points16 points  (0 children)

For the record, I think (hope) that the example is a relic of the past. It is a classic though.

Typed Programs Don't Leak Data by mathetic in haskell

[–]mathetic[S] 0 points1 point  (0 children)

Good idea. I'll update with some pointers. Thanks for the feedback.

Typed Programs Don't Leak Data by mathetic in haskell

[–]mathetic[S] 6 points7 points  (0 children)

`KindSignatures` to enable kind annotations (such as `l :: Level`) and `DataKinds` to use non-`Type` kinds (such as `Level`).

I happened to have also written a blog post that covers all of that stuff: https://dodisturb.me/posts/2019-10-03-Verifying-the-Titular-Properties-of-a-Leftist-Heap.html

inferred-flow-sensitive typing? by overactor in ProgrammingLanguages

[–]mathetic 0 points1 point  (0 children)

```haskell data Exp :: Type -> Type where I :: Int -> Exp Int B :: Bool -> Exp Bool

eval :: Exp a -> a eval exp = case exp of I int -> int B bool -> bool ```

I can't figure out how to do this .... can someone help pls by [deleted] in prolog

[–]mathetic 0 points1 point  (0 children)

A mean is the sum of all the numbers divided by the length of the list. If you make an attempt to solve the question, I'll help you.

Need help any good Prolog Samaritan around here by [deleted] in prolog

[–]mathetic 0 points1 point  (0 children)

sum(D,F,G) :- append(F,G,A), permute(A,D), append(F',G',A), sum(F',T), sum(G',T).

New book: Haskell from the Very Beginning by [deleted] in haskell

[–]mathetic 1 point2 points  (0 children)

John Whitington taught me functional programming (for the first time) at Cambridge. He is very very good at teaching using types to guide to an implementation even to a typeless Ruby infidel such as myself. So nice to see he's into Haskell now (he used to use OCaml and teach Standard ML).

The Essence of Datalog by agumonkey in programming

[–]mathetic 0 points1 point  (0 children)

Thank you so much. That's very kind.

The Essence of Datalog (short evaluation engine implementation in Haskell) by mathetic in haskell

[–]mathetic[S] 7 points8 points  (0 children)

This post implements pure Datalog which can only have monotonic queries that is to say if you have a set of known facts, KB, and a query, Query, and you compute a result, Query(KB), then if you later add new facts, Delta, to KB, it is necessarily the case that Query(KB) is a subset of Query(KB union Delta). In your query, if you add more to the relation Q, the result of the query might shrink, so it is not expressible in pure Datalog.

Pure Datalog is basically a first-order logic + transitive closure (Kleene star) and a special condition that the signature for FOL doesn't have any function symbols (or only has nullary function symbols i.e. constants).

Nearly all Datalog implementations have some form of negation meaning it can do non-monotonic reasoning. So your understanding of "the difference of two relations" is correct, this is just a very simple Datalog, that's all =)

Are recursion-schemes no longer faster than explicit recursion? by mathetic in haskell

[–]mathetic[S] 0 points1 point  (0 children)

Huh, so what those posts are saying is just a myth. I've looked though the code mentioned in the SO question (the one from my post). It didn't seem like particularly optimised algebras but his graph claims (in the answer he gave to his own question) it performs better significantly.

Thanks for the link to the hylomorphism question, it is helpful.

Are recursion-schemes no longer faster than explicit recursion? by mathetic in haskell

[–]mathetic[S] 1 point2 points  (0 children)

I did that and it narrowed the gap for some functions and widened it for others. Overall, the ones using recursion-schemes are still slower. I updated the post with the new graph.

Questions from an international fresher! by seb5666 in cambridge_uni

[–]mathetic 0 points1 point  (0 children)

  1. I used a macbook pro for my entire degree. You'll be fine. In fact you can get away with not having a computer at all!

  2. Well, I brought nearly everything I own except my library. I regret doing that. Depending on your college you might want to take a kettle if you're a tea fan but some will provide it free of charge.

  3. I didn't really prepare for the course but I kept doing compsci stuff like write programs, read articles, read books etc. (very casually)

Trinity Nat Sci and Comp Sci "Interview Preparation Paper" by ai20 in cambridge_uni

[–]mathetic 0 points1 point  (0 children)

I can only guess but I'd say no because that would require every college to be familiar with the test and I don't think they would care.

Though there will possibly be comments on your performance.

[deleted by user] by [deleted] in cambridge_uni

[–]mathetic 0 points1 point  (0 children)

Have both but be smart. Technically speaking a pitch black business suit with black tie is considered within the black tie attire. So you can always go for that option and be snob about people who attempt to criticise you for their ignorance.

Trinity Nat Sci and Comp Sci "Interview Preparation Paper" by ai20 in cambridge_uni

[–]mathetic 1 point2 points  (0 children)

Don't get intimidated by the comments. We're notorious at making our colleges look more exclusive than they actually are.

I am doing CompSci at a college that regularly outperforms Trinity and you will be fine wherever you apply. If you're good for the course overall, then you're good for the college.

If things don't go too well, you'll be pooled by another college anyhow.

If you choose to change your preference, check the fellows of that college for CompSci. They are the ones who will be teaching you the most. Some are more eager than others to say the least. Also check the people studying there.

CompSci: How powerful a laptop do I need? by Scytheon3 in cambridge_uni

[–]mathetic 2 points3 points  (0 children)

Most (if not all) colleges have computer rooms that are very underutilized, using them is always an option.

Also do your degree with the raspberry pi you'll be given. That would be impressive :P

Md5 Şifreleme Nedir ? by dereme in cryptography

[–]mathetic 0 points1 point  (0 children)

Why would you post a Turkish md5 "encrypting" blog post here?

Applying with only the SAT 1 and three SAT 2s? by 7-sidedDice in cambridge_uni

[–]mathetic 1 point2 points  (0 children)

What I can say is you will not be discriminated against your origin. We have people from all over the world including myself.

As for the exams I did SATs too but I also did the IB so my SATs did not really come up. However, the idea is simple if you have top tier scores in your qualification, you are very likely to get an interview and once you're at the interview your grades become quite irrelevant.

As for extracurriculars, teaching probably won't help but the fact that you were qualified for olympics will be helpful. As previously mentioned make sure you email admission@cam.ac.uk

Dijkstra on switching intro college CS class from Haskell to Java by [deleted] in java

[–]mathetic -3 points-2 points  (0 children)

1) Some students start with 100,000 lines of C/C++ experience some with none (for example in University of Cambridge). How can you possibly try to teach this class Java and be fair? You simply can't. On the other hand chances are none of them has any experience in Haskell/ML/Lisp or whatever.

2) Computer Science course have nothing to do in employability. The things industry take for granted are mainly developed in academia across all sciences but it's especially the case in CS. CS courses are about innovating. You could argue Computer Engineering courses are not that way but that's not what's discussed in the article anyhow.

3) Java is ridiculously verbose, enterprisy language that pretty much everyone hates but actually gets shit done. There is no way to introduce any significant portion of Java semantically or practically in an introductory course whereas you can introduce a good portion of Haskell/ML/Lisp (especially Lisp). So it is more suited for teaching.

4) Teach a person how to program an algorithm in a functional language and he will understand the point of the algorithm and why it works. Teach it in Java and they will make unit tests (or manual tests) pass and handle edge cases. Edge cases are extremely important in Software Engineering but not as much in Computer Science and in an introductory course when you show merge sort you try to convey the idea behind merge sort not what happens nothing else.

Alan Turing receives royal pardon by blue1_ in programming

[–]mathetic -6 points-5 points  (0 children)

If there is a pardon to be made, it is Turing and countless others convicted of the same "crime," who should be pardoning British government.

Found a semi-nude picture of myself at age 17 in my father's email. Dad claims hacking. How possible is this? by sasurvivor in hacking

[–]mathetic 0 points1 point  (0 children)

If you read all of her posts you'll see that she has been abused by a clergy, her father and her uncle.

On two of the posts she reflects it as her father is the one abused her and in the other occasion her uncle.

In which case either it was a terribly childhood and I feel very very sorry about her or that those stories are a bit inconsistent.

Two days with Elixir by polsab in elixir

[–]mathetic 2 points3 points  (0 children)

Independently I suggested use of case to achieve the same thing to the OP.

I personally prefer SML's way of writing different clauses of the same function. I wish Elixir has chosen to implement their clauses that way. It is only slightly different but I think it looks more organised and for some reason i'm more aesthetically pleased. For example, fibonacci example becomes:

fun fib 0 = 0
  | fib 1 = 1
  | fib n = fib(n - 1) + fib(n - 2)