Skip to main content
added 831 characters in body
Source Link
Laikoni
  • 26.3k
  • 6
  • 52
  • 115

Coconut, 190 bytes, cracked by quartata

main :: RunIO
main = print (list (range (1, 101)))

list :: Fn ((Range, Int) -> (List, Int))
list = xs -> List.fromObj (xs)

range :: Fn ((Pair, Int) -> (Range, Int))
range = (x,y) -> {x..y}

Try it online!

Coconut extents Python by syntactical constructs for functional programming.

main = print (list (range (1, 101))) is the only line that is actually doing something, though a more idiomatic way would be (1,101) |*> range |> list |> print.

The lines with :: should be reminiscent of Haskell's type annotations, but Coconut is actually dynamically typed and :: is its chain operator which works lazily, which is probably the reason why those nonsensical declarations do not throw an error.

I also wanted to create the impression that functions can be used before their definition appears in the code, but actually Coconut is interpreted sequentially and list and range are build-in functions which work fine in the second line, but are redefined to nonsensical functions afterwards.

Calling list after the redefinition produces a NameError: name 'List' is not defined, because there is no function List.fromObj.

Calling the redefined range with two numbers, e.g. range(1,101) returns a singleton set which contains a function object, because the .. operator is used for function composition. This does not cause an error yet, but trying to evaluate this composed function of course throws a TypeError: 'int' object is not callable.

Coconut, 190 bytes, cracked by quartata

main :: RunIO
main = print (list (range (1, 101)))

list :: Fn ((Range, Int) -> (List, Int))
list = xs -> List.fromObj (xs)

range :: Fn ((Pair, Int) -> (Range, Int))
range = (x,y) -> {x..y}

Try it online!

Coconut extents Python by syntactical constructs for functional programming.

main = print (list (range (1, 101))) is the only line that is actually doing something, though a more idiomatic way would be (1,101) |*> range |> list |> print.

The lines with :: should be reminiscent of Haskell's type annotations, but Coconut is actually dynamically typed and :: is its chain operator which works lazily, which is probably the reason why those nonsensical declarations do not throw an error.

Coconut, 190 bytes, cracked by quartata

main :: RunIO
main = print (list (range (1, 101)))

list :: Fn ((Range, Int) -> (List, Int))
list = xs -> List.fromObj (xs)

range :: Fn ((Pair, Int) -> (Range, Int))
range = (x,y) -> {x..y}

Try it online!

Coconut extents Python by syntactical constructs for functional programming.

main = print (list (range (1, 101))) is the only line that is actually doing something, though a more idiomatic way would be (1,101) |*> range |> list |> print.

The lines with :: should be reminiscent of Haskell's type annotations, but Coconut is actually dynamically typed and :: is its chain operator which works lazily, which is probably the reason why those nonsensical declarations do not throw an error.

I also wanted to create the impression that functions can be used before their definition appears in the code, but actually Coconut is interpreted sequentially and list and range are build-in functions which work fine in the second line, but are redefined to nonsensical functions afterwards.

Calling list after the redefinition produces a NameError: name 'List' is not defined, because there is no function List.fromObj.

Calling the redefined range with two numbers, e.g. range(1,101) returns a singleton set which contains a function object, because the .. operator is used for function composition. This does not cause an error yet, but trying to evaluate this composed function of course throws a TypeError: 'int' object is not callable.

added 1080 characters in body
Source Link
Laikoni
  • 26.3k
  • 6
  • 52
  • 115

#???, 190 bytes

Coconut, 190 bytes, cracked by quartata

main :: RunIO
main = print (list (range (1, 101)))

list :: Fn ((Range, Int) -> (List, Int))
list = xs -> List.fromObj (xs)

range :: Fn ((Pair, Int) -> (Range, Int))
range = (x,y) -> {x..y}

Output is of the form Try it online!

Coconut extents Python by syntactical constructs for functional programming.

[1,main 2,= 3,print ...(list 99(range (1, 100]101))) is the only line that is actually doing something, though a more idiomatic way would be (1,101) |*> range |> list |> print.

The lines with :: should be reminiscent of Haskell's type annotations, but Coconut is actually dynamically typed and :: is its chain operator which works lazily, which is probably the reason why those nonsensical declarations do not throw an error.

#???, 190 bytes

main :: RunIO
main = print (list (range (1, 101)))

list :: Fn ((Range, Int) -> (List, Int))
list = xs -> List.fromObj (xs)

range :: Fn ((Pair, Int) -> (Range, Int))
range = (x,y) -> {x..y}

Output is of the form [1, 2, 3, ... 99, 100].

Coconut, 190 bytes, cracked by quartata

main :: RunIO
main = print (list (range (1, 101)))

list :: Fn ((Range, Int) -> (List, Int))
list = xs -> List.fromObj (xs)

range :: Fn ((Pair, Int) -> (Range, Int))
range = (x,y) -> {x..y}

Try it online!

Coconut extents Python by syntactical constructs for functional programming.

main = print (list (range (1, 101))) is the only line that is actually doing something, though a more idiomatic way would be (1,101) |*> range |> list |> print.

The lines with :: should be reminiscent of Haskell's type annotations, but Coconut is actually dynamically typed and :: is its chain operator which works lazily, which is probably the reason why those nonsensical declarations do not throw an error.

Source Link
Laikoni
  • 26.3k
  • 6
  • 52
  • 115

#???, 190 bytes

main :: RunIO
main = print (list (range (1, 101)))

list :: Fn ((Range, Int) -> (List, Int))
list = xs -> List.fromObj (xs)

range :: Fn ((Pair, Int) -> (Range, Int))
range = (x,y) -> {x..y}

Output is of the form [1, 2, 3, ... 99, 100].