1
29
submitted 2 months ago by [email protected] to c/[email protected]
2
39
submitted 3 months ago by [email protected] to c/[email protected]
3
5
submitted 3 months ago by [email protected] to c/[email protected]

cross-posted from: https://sopuli.xyz/post/10354955

If "category" has a better name....

Isn't it just "composite"?

Every arrow in category can be composed, the set(or class or whatnot..) of that is composite.

4
4
submitted 4 months ago by [email protected] to c/[email protected]

cross-posted from: https://sopuli.xyz/post/9969591

Understanding the Type of call/cc

He introduces but also criticizes the use of call/cc, 1. not being a function and looks like a function, 2. able to produce an union of types with it.

Is he correct? What do you think?

5
10
submitted 4 months ago by [email protected] to c/[email protected]

I've been enjoying learning ocaml, but I found it very easy to write code riddled with side effects and imperative-ness.

Take this example:

let some_func arg = 
  let input = format_input_from_stdin ()
  let read_content = read_file "some/file/path.txt"
  let to_write = get_write_file_content input read_content
  let () = write_file "some/other/path.txt" to_write 
  let output = run_external_command_with_output 
  (output, read_content)

As you can see, many side effects and imperative steps in the code. Is there a better practice for coding this in a functional manner?

6
3
submitted 4 months ago by [email protected] to c/[email protected]

I wanna see what F# is about, especially now that I am better at FP&Lip. But the Microsoft thing really puts me off. I'm on Linux, I can't use CLR, I don't wanna make a WPF application or whatever


so why would I use F#?

7
9
submitted 4 months ago by [email protected] to c/[email protected]
8
9
submitted 4 months ago by [email protected] to c/[email protected]
9
10
submitted 5 months ago* (last edited 5 months ago) by [email protected] to c/[email protected]

I just started to learn Ocaml to learn functional programming. I will use it to build a CLI that's mostly orchestrating other programs.

My experience is mostly in JS / TS, but I've also coded a good bit in Python and Lua.

Below, I provided a list of things I learned or focused on while using OCaml. But I feel like I must be missing something. This is only moderately different from what I'm used to in JS. I expected something more radical. Moreover, I constantly hear a lot of FP jargon (like "highly kinded types", monads, etc) that I feel am still missing.

So far, here's what I studied:

  • immutability
  • avoid side affects
  • static typing
  • recursion instead of loops
  • option / maybe
  • higher order functions
  • conditionals and other constructs as expressions, when they're statements in other languages
  • pipelines and functions as input —> output
  • currying
  • scoping with let

What am I missing?

10
21
submitted 5 months ago by [email protected] to c/[email protected]
11
12
Functional Classes (2023) (blog.cleancoder.com)
submitted 6 months ago by [email protected] to c/[email protected]
12
15
submitted 7 months ago by [email protected] to c/[email protected]
13
14
submitted 9 months ago by [email protected] to c/[email protected]
14
7
Category Theory Illustrated – Sets (abuseofnotation.github.io)
submitted 9 months ago by [email protected] to c/[email protected]
15
22
submitted 10 months ago by [email protected] to c/[email protected]
16
10
submitted 10 months ago* (last edited 10 months ago) by [email protected] to c/[email protected]
17
7
submitted 10 months ago by [email protected] to c/[email protected]

I talk about programming languages, compilers, and stuff like that.

18
4
submitted 11 months ago by [email protected] to c/[email protected]

Prevent bad typeclass instances using good type errors.

19
13
submitted 11 months ago by [email protected] to c/[email protected]
20
17
submitted 11 months ago by [email protected] to c/[email protected]

F# RISC-V Instruction Set formal specification. Contribute to mrLSD/riscv-fs development by creating an account on GitHub.

21
12
submitted 11 months ago by [email protected] to c/[email protected]

Lambda Calculus made fun: dive into reductions!

22
12
submitted 11 months ago by [email protected] to c/[email protected]

This paper explores how design patterns could be revisited in the era of mainstream functional programming languages. I discuss the kinds of knowledge that ought to be represented as functional design patterns: architectural concepts that are relatively self-contained, but whose entirety cannot be represented as a language-level abstraction. I present four concrete examples embodying this idea: the Witness, the State Machine, the Parallel Lists, and the Registry. Each pattern is implemented in Rust to demonstrate how careful use of a sophisticated type system can better model each domain construct and thereby catch user mistakes at compile-time.

23
4
submitted 11 months ago by [email protected] to c/[email protected]
24
6
submitted 11 months ago by [email protected] to c/[email protected]
25
4
submitted 1 year ago by [email protected] to c/[email protected]
view more: next ›

Functional Programming

1339 readers
1 users here now

founded 1 year ago
MODERATORS